← Linux & the Command Line tutorial

Linux & the Command Line

Working with Files

mkdir name creates a folder; touch name creates an empty file. cp source dest copies, mv source dest moves (or renames, the same command does both, since a rename is really just a move to a new name in the same place).

Example: building up a small project structure

$ mkdir project
$ touch project/notes.txt
$ cp project/notes.txt project/notes-backup.txt
$ mv project/notes.txt project/README.txt

The result: a project/ folder containing README.txt and notes-backup.txt (the original notes.txt was renamed, not duplicated, by that last mv). rm name deletes a file, there's no recycle bin at the command line, so it's genuinely permanent the moment you press enter. Add -r to rm/cp to work on an entire folder recursively, and be especially careful with rm -r, since a mistyped path can delete far more than intended with no confirmation prompt by default.

Example
$ mkdir project
$ touch project/notes.txt
$ cp project/notes.txt project/notes-backup.txt
$ mv project/notes.txt project/README.txt
Output
Creates a project/ folder containing README.txt and notes-backup.txt (the original notes.txt was renamed).
Ready to go further?

These free tutorials are a preview, our Cybersecurity cohort covers it in depth, with a real project and a cohort alongside you. Closes Nov 30

Enroll in Cybersecurity

Cookie preferences

Choose what you're comfortable with. You can change this any time from the footer.

Don't miss out

Ready to build something real?

Create a free account to enroll in a track, and get notified the moment a cohort opens.

Create free account