# Deleting, Writing and Editing

Delete safely with -WhatIf first, write and add to files, edit a file in the terminal, and watch a file grow.

Updated: November 10, 2026

## [Deleting](https://www.ask-codey.com/courses/powershell-in-depth/topics/powershell-deleting)

1. [Deleting Safely: Remove-Item, -WhatIf and -Confirm](https://www.ask-codey.com/lessons/powershell-deleting-safely) (Novice): Remove-Item deletes files and folders with no Recycle Bin to catch them, so you rehearse a delete with -WhatIf, approve each item with -Confirm, and add -Recurse only for a folder you've looked inside.

## [Writing](https://www.ask-codey.com/courses/powershell-in-depth/topics/powershell-writing)

1. [Writing to Files: Set-Content, Add-Content and >](https://www.ask-codey.com/lessons/powershell-writing-to-files) (Novice): Set-Content writes a file, replacing whatever it held, Add-Content adds lines to its end, and > and >> save a command's output into a file the same two ways, in UTF-8 text.
2. [Editing in the Terminal: edit](https://www.ask-codey.com/lessons/powershell-editing-with-edit) (Novice): edit opens a text file in Microsoft Edit, an editor inside the terminal where the arrow keys and the mouse both work, Ctrl+S saves and Ctrl+Q quits, and notepad and code open the same file in a window.

## [Watching](https://www.ask-codey.com/courses/powershell-in-depth/topics/powershell-watching)

1. [The Start and End of a File: -TotalCount, -Tail and -Wait](https://www.ask-codey.com/lessons/powershell-head-and-tail) (Apprentice): Get-Content -TotalCount shows only a file's first lines and -Tail only its last, and -Wait keeps a file open on screen so every line added to it appears as it's written, until Ctrl+C stops it.

## [Exercise: The Moving-Day List](https://www.ask-codey.com/courses/powershell-in-depth/topics/exercise-powershell-the-moving-day-list)

1. [Exercise: The Moving-Day List](https://www.ask-codey.com/lessons/exercise-powershell-the-moving-day-list) (Apprentice): Clear the hallway of a new apartment with Remove-Item and -WhatIf, write and add to its lists with Set-Content, Add-Content, > and >>, fix a settings file with edit, and read the ends of two long files, while a Pester check tells you which jobs are done.

Source: https://www.ask-codey.com/courses/powershell-in-depth/chapters/powershell-deleting-writing-and-editing
