# Deleting, Writing and Editing

Delete without regret, write and add to files from the terminal, edit a file in the terminal, and watch a file grow.

Updated: November 10, 2026

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

1. [Deleting Safely: rm and rmdir](https://www.ask-codey.com/lessons/bash-deleting-safely) (Novice): rm deletes files for good, with no trash can to undo it, so you check the same names with ls first, let rm -i ask about each file, and use rmdir for empty folders and rm -r only after looking inside.

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

1. [Writing to Files: echo, > and >>](https://www.ask-codey.com/lessons/bash-writing-to-files) (Novice): echo prints a line of text, > (read "into") sends it into a file and replaces whatever the file had, >> (read "add to") adds it to the end, and printf writes neat lines from a pattern.
2. [Editing in the Terminal: nano](https://www.ask-codey.com/lessons/bash-editing-with-nano) (Novice): nano is a text editor that runs inside the terminal, where you open a file with nano and its name, move with the arrow keys, save with Ctrl+O and quit with Ctrl+X; and if vim opens by accident, Esc and then :q! get you out.

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

1. [The Start and End of a File: head and tail](https://www.ask-codey.com/lessons/bash-head-and-tail) (Apprentice): head prints the first lines of a file and tail the last, ten unless -n says how many, and tail -f keeps watching a file and prints each new line as it's added.

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

1. [Exercise: The Moving-Day List](https://www.ask-codey.com/lessons/exercise-bash-the-moving-day-list) (Apprentice): Finish a new apartment's moving-day jobs in the terminal, deleting the trash safely, removing an empty box, writing a door sign and a to-do list, fixing a setting in nano and reading the ends of long files, then let a check script tell you what's done.

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