Common commands
Command and keyword cheat sheet.
The following table describes common shell commands:
| Command | Description |
|---|---|
| > | Redirects, creates, or overwrites a file. |
| » | Appends to a file. |
| & | Executes the program in the background. |
| * | Matches any number of characters. |
| ? | Matches a single character. |
| awk | Programming language to parse characters. |
| basename file | Displays base filename of file |
| cal | Displays a calendar. |
| chgrp | Changes the file group. |
| chmod | Changes the file modes (permissions). |
| cut | Writes out selected characters. |
| diff file1 file2 | Compares two files. |
| df | Displays filesystem statistics. |
| sdiff file1 file2 | Compares two files, side-by-side. |
| date | Displays system data and time. |
| chown | Changes the file owner. |
| egrep | Pattern matching with extended regex. |
| file | Prints the file type. |
| find | Locates files and directories. |
| head | Views the top of the file. |
| iostat | Shows input/output status. |
| last | Shows login history since the wtmp file was created |
| more | Displays the contents of a file, one page at a time. |
| netstat | Shows network status. |
| passwd | Changes the user password. |
| ps | Displays information on currently running processes. |
| sar | Reports system activity. |
| sed | Programming language for character substitution. |
| sleep length | Pauses execution for length number of seconds. |
| spell file | Checks spelling on file. |
| tail | Views the end of the file. |
| tr chars1 chars2 | Translates chars1 into the format specified by chars2 |
| wc | Counts number of words, lines, and characters in a file. |
| w | Extended who command that also provides uptime output. Displays information about who is on the system. |
| who | Displays information about who is on the system. |
| whoami | Displays $LOGNAME or $USER env vars. |
| who am i | Displays login name, terminal, login date/time, and where logged in. |
| vmstat | Shows virtual memory status. |