This is an old revision of the document!
Most user-level commands can be found in the /bin
, /usr/bin
, and /usr/local/bin
directories. Some programs can be found in /sbin
and/or /usr/sbin
, but those programs are usually reserved for the administrator, and they won't work for you unless you have the password. You can also use the man
command to search for commands by keyword, but search is limited. Google is probably a better choice unless you know a specific keyword you're looking for.
Command | Description |
---|---|
arch | Outputs the hardware architecture of the current machine. $ arch x86_64 |
awk | A very powerful text processing program. Entire books have been dedicated to it's use, and I won't even begin to understand everything that it can do. Unix Man PageExamples |
basename | Given a path as a command line argument, output the last segment: $ basename /path/to/directory/file.txt file.txt Additionally, when given a suffix, it will strip off the suffix: $ basename /path/to/directory/file.txt .txt file |
bash | A standard shell program available on almost every Unix-based system. Unix Man PageFull Manual |
bc | An arbitrary-precision command line calculator. man pagefull manualExamples |
cat | Concatenate one or more files. |
cd | Change directory. |
chmod | Change file or directory permissions. |
chown | Change file or directory ownership. |
clear | Clear the terminal screen. |
cp | Copy file(s). |
cut | Read input line at a time, removing a segment of each line before output. |
date | Return a time and date in configurable formats. |
df | Return the space used on a filesystem. |
dirname | Given a path as a command line argument, output everything except the last segment (the inverse of basename ). |
echo | Output a string |
exec | Replace the currently running shell or script with a new command. |
exit | Return an exit code to the parent shell. |
export | Add a variable to the environment. |
file | Get information about the type of data inside a file. |
find | Locate files and/or directories according to user-supplied search criteria. |
for | A loop command: for <condition>; do <commands>; done |
free | Outputs information about how much memory exists and is being used. |
grep | Reads input line at a time searching for a regular expression. If found, an action is taken. (Or if not found, an action is taken, depending on command line options used.) |
gzip | Compress a file. |
head | Reads input line at a time, outputting the first <N> lines. |
id | Outputs the effective and real user and group identity. |
if | A conditional command: if <condition>; then <commands>; fi Or a more complex example: if <condition>; then <commands> elif <condition2>; then <commands2> ; elif <condition3>; then <commands3> ; ... ; fi |
last | Ouptuts a list of users who last logged into this machine. |
less | Reads input and prints it to the screen, one page at a time. It pauses the output and gives the user a chance to read what they want. It will resume when the user pressed the space bar or the return key. This command is a newer version of the more command, which does the same thing except without some nice features like the ability to go backward or to search through the file. |
ln | Creates a symbolic (think Windows' shortcut) or hard link (file physically exists in two places on the filesystem at once). |
ls | Outputs a directory listing. |
make | Searched for a file named “Makefile” or “makefile” and, if found, executes the commands within. Execution stops if an error occurs. |
mc | A text-based file manager. |
mkdir | Create a directory. |
mv | Move or rename a file or directory. |
paste | Merge lines from multiple files. |
ping | Tests to see if a remote host is reachable over the network. |
pwd | Ouptuts the current working directory. |
read | Reads a line from input and stores it in an environment variable. |
rm | Deletes a file. (NOTE: There is no going back!) |
rsync | A synchronization tool that can update, copy, or delete files between two locations – both locally and over a network. |
screen | A fake terminal tool that can be used to run commands even after you log out. |
script | A fake terminal tool that will store everything typed or printed to the terminal window into a file – handy for recording your terminal session. |
sed | A search-and-replace text editing tool. |
set | This command will show you all of the environment variables currently set in your shell. |
seq | This command takes two integer command line arguments and outputs every integer between them, inclusively, as it counts from the first to the second. |
shift | Used for processing command line arguments in shell scripts. |
sort | Reads input one line at a time, sorts the lines, and then outputs the results. |
ssh | A program for connecting to a remote host securely. |
tail | Reads input line at a time, only outputting the last <N> lines. |
tar | A program used to pack multiple files or directories into a single file. Like a zip file, but without compression. (Compression is usually handled by a separate program like gzip , bzip2 , or xz .) |
test | Used to test certain conditional expressions. Often used with if , for , and while conditional statements. |
time | Used to measure the amount of time that a command takes to execute. |
touch | Used to create empty files, or to update the timestamp on existing files. |
tr | Used to transform input. A simple example would be to capitalize text. |
true | Always returns a successful exit code. Used in conjunction with boolean logic expressions and/or inside if , for , and while conditional statements. |
uptime | Outputs the amount of time that this machine has been turned on. |
wc | Reads input line at a time and outputs user-specified metrics such as the number of lines, the number of words, the number of characters, or the number of bytes. |
wget | A command line tool for interacting with a web server. Can be used to download HTML, or to download a file from a web page. |
which | Outputs the location of a program, if known. |
while | A conditional loop command: while <condition>; do <commands>; done |