Common commands

Command and keyword cheat sheet.

The following table describes common shell commands:

CommandDescription
>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.
awkProgramming language to parse characters.
basename fileDisplays base filename of file
calDisplays a calendar.
chgrpChanges the file group.
chmodChanges the file modes (permissions).
cutWrites out selected characters.
diff file1 file2Compares two files.
dfDisplays filesystem statistics.
sdiff file1 file2Compares two files, side-by-side.
dateDisplays system data and time.
chownChanges the file owner.
egrepPattern matching with extended regex.
filePrints the file type.
findLocates files and directories.
headViews the top of the file.
iostatShows input/output status.
lastShows login history since the wtmp file was created
moreDisplays the contents of a file, one page at a time.
netstatShows network status.
passwdChanges the user password.
psDisplays information on currently running processes.
sarReports system activity.
sedProgramming language for character substitution.
sleep lengthPauses execution for length number of seconds.
spell fileChecks spelling on file.
tailViews the end of the file.
tr chars1 chars2Translates chars1 into the format specified by chars2
wcCounts number of words, lines, and characters in a file.
wExtended who command that also provides uptime output. Displays information about who is on the system.
whoDisplays information about who is on the system.
whoamiDisplays $LOGNAME or $USER env vars.
who am iDisplays login name, terminal, login date/time, and where logged in.
vmstatShows virtual memory status.