| Command |
Description |
Usage |
| cd |
Use cd to change your working directory to a different one. |
cd directory |
| pwd |
The pwd command echoes your working directory. |
pwd |
| ls |
ls lists the content of your working directory. Common flags for the ls
command include -l (details), -a (all files, including hidden), and -F (indicate
directories with a /). |
ls [-alF] |
| mkdir |
The mkdir command makes a new directory (folder) inside your working directory.
You can also indicate other directories using the / or .. paths. |
mkdir dirname |
| rmdir |
Remove an empty directory. If the indicated directory is not empty, it will not be deleted. |
rmdir dirname |
| cp |
The cp command copies a file or directory to a new location. |
cp oldname newname |
| mv |
mv moves a file or directory to a new location. This is different from cp
because the old file is removed. For this reason, it is a good idea to use caution when using
this command. |
mv oldname newname |
| rm |
The rm command removes (deletes) a file or directory. When used on a directory,
the -R flag recursively deletes all the contents of the directory as well. The -f
flag forces unconfirmed delete. Any time you use the rm command requires caution,
especially when using it with wildcards or the -R flag. |
rm [-Rf] filename |
| cat |
cat prints the contents of a file to stout (standard output, in most cases,
your screen). You can use cat to view the contents of a text file, or use it in
conjunction with other commands such as grep. You can redirect the output of cat
using the standard redirect (>). |
cat filename |
| grep |
The grep command matches an indicated text pattern in the contents of specified
file(s). In other words, you can search through a file and find every instance of a given
word. grep is frequenly used with wildcards, or on the redirected output of other
commands (for example, ls -l > grep *.html). |
grep searchstring filename [filename2] |
| tar |
The tar command is used to create compressed archives of files or directories.
tar produces highly compressed files that are ideal for off-site or tape back-ups.
Many compressed archive programs for PC and Mac do not support the tar format, so
it may not be ideal for file transfers. The tar command takes the -c flag to
create a new archive, -x to extract the contents from an existing archive, and the
-v flag allows you to view what is being done. The -f flag must be the final
flag, followed by a filename to indicate a specific file. |
tar [-cxvf] tarfile filename [filename2] |
| zip |
The zip command compresses files in a format that is compatible with most PC and
Mac software, making it an excellent option for uploading or downloading files from your local
computer. |
zip zipfile filename [filename2 ...] |
| unzip |
unzip uncompresses files created with zip. |
unzip zipfile |