Essential file and directory management: taking control
Now that you can navigate, let’s learn how to manage files and directories.
Creating directories
Use mkdir directory_name to make a new directory.
Creating files
The touch file_name command creates an empty file.
Copying files
Use cp source destination to copy a file. cp -r source_directory destination_directory is used to copy an entire directory recursively.
Moving/renaming files
Use mv source destination to move or rename a file. For example, mv old_name new_name. mv source_directory destination_directory will move or rename directories.
Deleting files
Use rm file_name to remove a file. Be careful with this command! rm -r directory_name removes a directory and all its contents. Be extra cautious with rm -rf, which will force the recursive deletion of files and directories.
Viewing file content
Running cat filename displays the content of a file in the terminal. less filename...