Unix-like operating systems require a working knowledge of several basic commands. Unix®, Linux, BSD and such use a ubiquitous set of these based on the Single UNIX Specification and other standards. Learning to operate a command line interface is a key skill in learning Linux and BSD.
Basic commands
| Name | Category | Description | First appeared |
|---|---|---|---|
| admin | SCCS | Create and administer SCCS files | |
| alias | Misc | Define or display aliases | |
| ar | Misc | Create and maintain library archives | |
| asa | Text Processing | Interpret carriage-control characters | |
| at | Process Management | Execute commands at a later time | Version 7 AT&T UNIX |
| awk | Text processing | Pattern scanning and processing language | Version 7 AT&T UNIX |
| basename | Filesystem | Return non-directory portion of a pathname | |
| bash | Shell | The Bourne-again shell | |
| batch | Process Management | Schedule commands to be executed in a batch queue | |
| bc | Misc | Arbitrary-precision arithmetic language | |
| bg | Process Management | Run jobs in the background | |
| break | Shell programming | Exit from for, while, or until loop | |
| c99 | C Programming | Compile standard C programs | |
| cal | Misc | Print a calendar | Version 5 AT&T UNIX |
| cat | Filesystem | Concatenate and print files | Version 1 AT&T UNIX |
| cd | Filesystem | Change the working directory | |
| cflow | C Programming | Generate a C-language flowgraph | |
| chgrp | Filesystem | Change the file group ownership | |
| chmod | Filesystem | Change the file modes/attributes/permissions | Version 1 AT&T UNIX |
| chown | Filesystem | Change the file ownership | Version 1 AT&T UNIX |
| chroot | Processes | run a command or interactive shell using a specific directory as the root directory | Prior to 4.2BSD |
| cksum | Filesystem | Write file checksums and sizes | 4.4BSD |
| cmp | Filesystem | Compare two files | Version 1 AT&T UNIX |
| comm | Text Processing | Select or reject lines common to two files | Version 4 AT&T UNIX |
| command | Shell Programming | Execute a simple command | |
| compress | Filesystem | Compress data | 4.3BSD |
| continue | Shell programming | Continue for, while, or until loop | |
| cp | Filesystem | Copy files | Version 1 AT&T UNIX |
| crontab | Misc | Schedule periodic background work | |
| csplit | Text Processing | Split files based on context | PWB UNIX |
| ctags | C Programming | Create a tags file | 3.0BSD |
| cut | Shell Programming | Cut out selected fields of each line of a file | |
| cxref | C Programming | Generate a C-language program cross-reference table | |
| date | Misc | Write the date and time | Version 1 AT&T UNIX |
| dd | Filesystem | Convert and copy a file | |
| delta | SCCS | Make a delta (change) to an SCCS file | |
| df | Filesystem | Report free disk space | Version 1 AT&T UNIX |
| diff | Text processing | Compare two files | |
| dirname | Filesystem | Return the directory portion of a pathname | |
| dot | Shell programming | Execute commands in the current environment | |
| du | Filesystem | Estimate file space usage | Version 1 AT&T UNIX |
| echo | Shell programming | Write arguments to standard output | |
| ed | Text processing | The standard text editor | Version 1 AT&T UNIX |
| env | Misc | list environment variables or invoke a command in a modified environment | |
| eval | Shell programming | Construct command by concatenating arguments | |
| ex | Text processing | Text editor | BSD |
| exec | Shell programming | Execute commands and open, close, or copy file descriptors | |
| exit | Shell programming | Cause the shell to exit | |
| expand | Text Processing | Convert tabs to spaces | 3.0BSD |
| export | Misc | Set the export attribute for variables | |
| expr | Shell Programming | Evaluate arguments as an expression | |
| false | Shell programming | Return false value | |
| fc | Misc | Process the command history list | |
| fg | Process Management | Run jobs in the foreground | |
| file | Filesystem | Determine file type | Version 4 AT&T UNIX |
| find | Filesystem | Find files | Version 1 AT&T UNIX |
| flex | C Programming | Generate programs for lexical tasks | |
| fold | Text processing | Filter for folding lines | |
| fort77 | C Programming | w:FORTRAN compiler | |
| fortune | Misc | Displays a random quotation | |
| ftp | Internet | Internet file transfer program | |
| fuser | Process Management | List process IDs of all processes that have one or more files open | |
| gawk | Text processing | Pattern scanning and processing language, GNU's version of awk | |
| gencat | Misc | Generate a formatted message catalog | |
| get | SCCS | Get a version of an SCCS file | |
| getconf | Misc | Get configuration values | |
| getopts | Shell Programming | Parse utility options | |
| grep | Misc | Search text for a pattern | |
| groups | Misc | List groups a user belongs to | |
| hash | Misc | Remember or report utility locations | |
| head | Text processing | Copy the first part of files | PWB UNIX |
| hostname | Networking | Show the system's host name | |
| iconv | Text processing | Codeset conversion | |
| id | Misc | Return user identity | 4.4BSD |
| iostat | Input/Output information | collect and show operating system storage input and output statistics | |
| ipcrm | Misc | Remove a message queue, semaphore set, or shared memory segment identifier | |
| ipcs | Misc | Report interprocess communication facilities status | |
| jobs | Process Management | Display status of jobs in the current session | |
| join | Text Processing | Relational database operator | |
| kill | Process Management | Terminate or signal processes | Version 3 AT&T UNIX |
| less | Text processing | Display files on a page-by-page basis | |
| lex | C Programming | Generate programs for lexical tasks | |
| link | Filesystem | Call link function | Version 1 AT&T UNIX |
| ln | Filesystem | Link files | Version 1 AT&T UNIX |
| locale | Misc | Get locale-specific information | |
| localedef | Misc | Define locale environment | |
| logger | Shell programming | Log messages | |
| login | Misc | Begin sessions on a system | |
| logname | Misc | Return the user's login name | 4.4BSD |
| logout | Misc | End sessions on a system | |
| lp | Text Processing | Send files to a printer | |
| ls | Filesystem | List directory contents | Version 1 AT&T UNIX |
| m4 | Misc | Macro processor | PWB UNIX |
| mailx | Misc | Process messages | Version 1 AT&T UNIX |
| make | Programming | Maintain, update, and regenerate groups of programs | |
| man | Misc | Display system documentation | |
| mesg | Misc | Permit or deny messages | Version 1 AT&T UNIX |
| mkdir | Filesystem | Make directories | Version 1 AT&T UNIX |
| mkfifo | Filesystem | Make FIFO special files | 4.4BSD |
| mktemp | Filesystem | Create a temporary file or directory | |
| more | Text processing | Display files on a page-by-page basis | |
| mount | Filesystem | Mount a file system | |
| mv | Filesystem | Move files | Version 1 AT&T UNIX |
| nano | Text Programming | Small text editor | |
| netstat | Networking | Displays network information and statistics | |
| newgrp | Misc | Change to a new group | Version 6 AT&T UNIX |
| nice | Process Management | Invoke a utility with an altered nice value | Version 4 AT&T UNIX |
| nl | Text Processing | Line numbering filter | |
| nm | C Programming | Write the name list of an object file | |
| nohup | Process Management | Invoke a utility immune to hangups | |
| od | Misc | Dump files in various formats | Version 1 AT&T UNIX |
| passwd | System | Set or change user password | |
| paste | Text processing | Merge corresponding or subsequent lines of files | Version 32V AT&T UNIX |
| patch | Text processing | Apply changes to files | |
| pathchk | Filesystem | Check pathnames | |
| pax | Misc | Portable archive interchange | 4.4BSD |
| pgrep | Process Management | Find processes with the given name using pattern matching | |
| pkill | Process Management | Kills processes with the given name using pattern matching | |
| pr | Text processing | Print files | Version 1 AT&T UNIX |
| printf | Shell programming | Write formatted output | 4.3BSD-Reno |
| prs | SCCS | Print an SCCS file | |
| ps | Process Management | Report process status | Version 4 AT&T UNIX |
| pstree | Process Management | Display a tree of processes | |
| pwd | Filesystem | print working directory - Return working directory name | |
| qalter | Batch Utilities | Alter batch job | |
| qdel | Batch Utilities | Delete batch jobs | |
| qhold | Batch Utilities | Hold batch jobs | |
| qmove | Batch Utilities | Move batch jobs | |
| qmsg | Batch Utilities | Send message to batch jobs | |
| qrerun | Batch Utilities | Rerun batch jobs | |
| qrls | Batch Utilities | Release batch jobs | |
| qselect | Batch Utilities | Select batch jobs | |
| qsig | Batch Utilities | Signal batch jobs | |
| qstat | Batch Utilities | Show status of batch jobs | |
| qsub | Batch Utilities | Submit a script | |
| read | Shell Programming | Read a line from standard input | |
| readonly | Misc | Set the readonly attribute for variables | |
| renice | Process Management | Set nice values of running processes | 4.0BSD |
| return | Shell Programming | Return from a function | |
| rm | Filesystem | Remove files or directories | Version 1 AT&T UNIX |
| rmdel | SCCS | Remove a delta from an SCCS file | |
| rmdir | Filesystem | Remove directories | Version 1 AT&T UNIX |
| sact | SCCS | Print current SCCS file-editing activity | |
| sar | System Administration | System Activity Report | Report System Activity |
| sccs | SCCS | Front end for the SCCS subsystem | |
| sed | Text processing | Stream editor | Version 7 AT&T UNIX |
| seq | Misc | Print a sequence of numbers | |
| set | Misc | Set or unset options and positional parameters | |
| sh | Shell programming | Shell, the standard command language interpreter | Version 7 AT&T UNIX |
| shift | Shell programming | Shift positional parameters | |
| shopt | Shell programing | Control optional shell behavior | |
| sleep | Shell programming | Suspend execution for an interval | Version 4 AT&T UNIX |
| sort | Text Processing | Sort, merge, or sequence check text files | |
| split | Misc | Split files into pieces | Version 3 AT&T UNIX |
| strings | C Programming | Find printable strings in files | |
| strip | C Programming | Remove unnecessary information from executable files | |
| stty | Misc | Set the options for a terminal | |
| suspend | Shell programming | Suspend execution of the shell until it receives a continue signal | |
| tabs | Misc | Set terminal tabs | PWB UNIX |
| tail | Text processing | Copy the last part of a file | PWB UNIX |
| talk | Misc | Talk to another user | 4.2BSD |
| tee | Shell programming | Duplicate standard input | |
| test | Shell programming | Evaluate expression | |
| time | Process Management | Time a simple command | Version 3 AT&T UNIX |
| times | Process Management | Write process times | |
| touch | Filesystem | Create file and Change file access and modification times | Version 7 AT&T UNIX |
| top | Process Management | Real-time display of running processes | |
| tput | Misc | Change terminal characteristics | System V |
| tr | Text processing | Translate characters | Version 4 AT&T UNIX |
| trap | Process Management | Trap signals | |
| true | Shell programming | Return true value | |
| tsort | Text processing | Topological sort | Version 7 AT&T UNIX |
| tty | Misc | Return user's terminal name | Version 1 AT&T UNIX |
| type | Misc | Displays how a name would be interpreted if used as a command | |
| ulimit | Misc | Set or report file size limit | |
| umask | Misc | Get or set the file mode creation mask | |
| umount | Filesystem | Unmount a filesystem | |
| unalias | Misc | Remove alias definitions | |
| uname | Misc | Return system name | PWB UNIX |
| uncompress | Misc | Expand compressed data | 4.3BSD |
| unexpand | Text Processing | Convert spaces to tabs | 3.0BSD |
| unget | SCCS | Undo a previous get of an SCCS file | |
| uniq | Text Processing | Report or filter out repeated lines in a file | Version 3 AT&T UNIX |
| unlink | Filesystem | Call the unlink function | Version 1 AT&T UNIX |
| unset | Misc | Unset values and attributes of variables and functions | |
| uucp | Network | System-to-system copy | |
| uudecode | Network | Decode a binary file | 4.0BSD |
| uuencode | Network | Encode a binary file | 4.0BSD |
| uustat | Network | uucp status inquiry and job control | |
| uux | Process Management | Remote command execution | |
| val | SCCS | Validate SCCS files | |
| vi | Text processing | Screen-oriented (visual) display editor | BSD |
| wait | Process Management | Await process completion | |
| wc | Text processing | Word, line, and byte or character count | Version 1 AT&T UNIX |
| what | SCCS | Identify SCCS files | |
| who | System Administration | Display who is on the system | Version 1 AT&T UNIX |
| write | Misc | Write to another user's terminal | Version 1 AT&T UNIX |
| xargs | Shell Programming | Construct argument lists and invoke utility | PWB UNIX |
| yacc | C Programming | Yet another compiler compiler | PWB UNIX |
| zcat | Text Processing | Expand and concatenate data | |
Unix-like
Like RMS says, "GNU means GNU's Not Unix". Only Unix® is really Unix. Linux and the BSDs are definitely Unix-like though neither one is compliant with the above-mentioned "official" specification. What we present here is based on a set of tools that have been around for a long time. We will be looking at generalizations that behave in similar ways in most *nix environments.
BusyBox
BusyBox is a good example of a more basic collection of utilities and are well suited to the novice. They can be found in Mini Linux distributions, such as Tiny Core Linux.
Exercise 1 Go to TinyCoreLinux.com and check it out.
GNU Core Utilities
The GNU Core Utilities are much more extensive and not for the faint at heart. They are found on most full-sized BSD and Linux systems in their full glory.
Command line arguments
This section is under development.