Chapter 5
Files and directories
Updated July 3, 2026
Creating and moving:
$ mkdir project # create a directory
$ mkdir -p a/b/c # create a chain of directories at once
$ touch notes.txt # create an empty file (or update its timestamp)
$ cp notes.txt copy.txt # copy
$ cp -r project backup # copy a directory with everything in it
$ mv copy.txt archive/ # move
$ mv notes.txt todo.txt # the same command renamesmv does two jobs at once: it moves and it renames. For Linux, renaming is moving to the same place under a new name.
Deletion in Linux is permanent. There is no trash in the terminal.
$ rm todo.txt # delete a file
$ rm -r backup # delete a directory with everything insideThe command This chapter is free once you sign in. Create an account to keep reading. Already have an account? Sign inrm -rf /somethingFree with accountRead the rest with a free account