$ cd
To change back to the directory you were in before the last cd command:
$ cd
To change to your home directory:
$ cd
To change to the
$ cd
To change to
$ cd ~
4.3.1.7. Creating and removing directories from the command line
To create a directory from the command line, use the
$ mkdir
This will create
To create a chain of directories, or a directory when one or more of the parent directories might not exist, use the -p (path) option:
$ mkdir -p
This has the side effect of turning off any warning messages if the directory already exists.
To delete a directory that is empty, use
$ rmdir
This will fail if the directory is not empty. To delete a directory as well as all of the directories and files within that directory, use the
$ rm -r
rm -r can delete hundreds or thousands of files without further confirmation. Use it carefully!
4.3.1.8. Copying files
To copy a file, use the
$ cp
This will make a copy of
$ cp
4.3.1.9. Renaming and moving files
In Linux, renaming and moving files are considered the same operation and are performed with the
To change a file named
$ mv
To move the file
$ mv
4.3.1.10. Removing files
The
$ rm
You will not be prompted for confirmation as long as you are the owner of the file. To disable confirmation in all cases, use -f (force):
$ rm -f
Or to enable confirmation in all cases, use -i (interactive):
$ rm -i
rm: remove regular empty file Q
' ?
-f and -i can also be used with
The graphical desktop tools don't directly delete files; they relocate them to a hidden directory named