From LQWiki
A command, in the most general sense, is an executable file or a shell builtin. For example, cd, ls, echo and firefox are commands.
Note: details of commands vary from version to version and available commands vary from distribution to distribution.
Contents |
General notes on commands
Commands may be invoked as simple commands. In these examples, the $ that starts each line is a shell prompt and not meant to be typed
$ ls
Or they may be invoked as complex commands.
$ ls -l /bin
Here "-l /bin" are a pair of arguments (separated from each other and the command by whitespace) and "-l" is specifically an option, since it modifies the behavior of ls (it produces a long listing), while "/bin" simply specifies a target for ls to act on.
They may also be invoked in multiples where the semi-colon is a command separator.
$ cd /bin; ls
That's two commands on one line. You may also execute one long command on two lines by escaping the carriage return with a backslash. (See scripting for further details on metacharacters and escaping and quoting.)
$ cd really long command line \ that we would like to finish here
Another way to invoke multiple commands is conditionally, where (in bash) "&&" means to execute the second command only if the first returns with an exit code of 0 (i.e., it succeeds).
$ cd /bin && ls
With the semicolon command separator, had the change of directory failed, ls would still have been invoked and simply listed the contents of the current directory. With the conditional operator, ls would not be invoked if cd had failed.
Similarly, "||" means to execute the second command only if the first returns a non-zero exit code (i.e., it fails).
$ cd /bing 2>/dev/null || echo 'I kinna do it, Cap'\''n!'
This will cd to the directory named "bing" if it in fact exists and the command will exit. Since it probably doesn't, being a typo, the second command will execute and print a somewhat more entertaining error message than is usual.
Learning about commands with local documentation
A Linux system should have documentation in the form of man pages and possibly GNU info pages (see also texinfo). In a manner similar to this page's alphabetical list, if you know the command you wish to learn more about,
$ man command
will show you the manual page of command.
If you do not know the command but would like to see commands relevant to a topic, use
$ apropos subject
or
$ man -k subject
to find suitable commands.
Unfortunately, most man pages will be informative and complete, many GNU utilities distribute very sketchy man pages whose primary purpose is to redirect the user to the info system. In that case,
$ info command
will invoke that system of documentation.
Many commands have an "-h", "-H", "-help", "--help" option or some combination thereof. Unfortunately, some commands understand other things by "-h" or "-H" so unexpected and possibly unpleasant results may occur.
There are also extensive miscellaneous files usually found in /usr/doc, /usr/local/doc, /usr/src/linux/Documentation (kernel docs), and elsewhere.
Lists of commands
In our Category Command you will find all commands in this wiki, but without explanation. The next chapter lists the most relevant ones with a short explanation so you can decide if the respective command is right for you. If you add to this list, your contribution should be didactic, understandable for newcomers, focused on the "real world" and contain sensible examples.
By name
This is a list of commands that gives you just enough information to decide what command you want to use.
A
- alias - allows you to create shorter or more familiar names for commonly used commands
- apropos - search the manual page names and descriptions
- at - execute a command-line task at a specified future time
- awk - print only the nth word of an input line and more
B
- badblocks - a command disk utility
- bash - a shell
- beep - customized audible alerts
- bunzip2 - unpack files packed with bzip2
- bzip2 - a pack utility
C
- cat - receive strings from stdin or a file and output them to stdout or a file
- chgrp - change the group ownership of a file
- chmod - change the permission mode of a file
- chown - change the owner of a file
- chroot - change the position of a root directory in filesystem
- chsh - change the shell of a user
- cp - copy a file
- cpio - pack or unpack files in cpio archives or tarballs
- cron - schedule tasks to be executed regularly at a specific time
- crontab - control the cron service
- cut - display specific coloumns of a file delimited by a character
- cvs - a version management system
D
- date - output or set date and time
- dd - dump a disk to/from a file and more
- df - show how much free disk space there is
- diff - show the difference between two files and more
- dig - show answer of DNS lookup of queried name server
- disown - disowns a job (removes the pid of the job). Even when the shell exits, the job won't stop running
- du - show how much disc space is used up
E
- echo - echo a string/value to stdout
- env - show all environment variables
- exit - exit most shells
- export - set an environment variable in the bash or zsh
F
- fdisk - partition a disc
- fg - fetch a process from the background to the foreground
- file (command) - determine a file's type
- find - find a file depending on its name, size, change date or other attributes
- ftp - get files from the internet
G
- g++ - compile C++ code
- gcc - compile C code
- grep - grab for patterns in a file and more
- groups - show what groups your user is in
- gunzip - unpack files from a special format
- gzip - pack files in a special format
H
- halt - shut down your computer
- head - show only the first n lines of a file and more
- hexdump - show a file's content in hexadecimal numbers and more
- history (command) - show a command history in the bash shell
- hostname - show your computer's name
- hwinfo - show your available hardware
I
- id - show your user and groups ids
- ifconfig - show your ip address and more
- info - show info about a given command
- init - reboot or change runlevel
- iptables - show your firewall configuration
- iptraf - Interactive IP LAN monitor
J
- jobs - gives a list of current background jobs (processes)
K
L
- ldd - show dynamic libraries needed by an executable
- less - show output in a viewer where you can scroll and search
- ln - link a file
- ls - list a file
- lsmod - list loaded kernel modules
- lsof - list open files and listening sockets
- lspci - list all pci devices
- lsusb - list usb devices
M
- make - compile software and more
- man - get help on questions that you never wanted to ask
- md5sum - compute the md5 sum of a file and more
- mkdir - make a directory
- mkfs - format a device
- minicom - communicate over your RS232 interface
- more - show input in a searchable pager
- mount - prepare a device for reading and writing
- mv - move a file (can also be renaming)
N
- netcat - Send some bytes to the network
- netstat - get information on listening sockets, open ports and more
- nice - set a process' priority
- nm - list the names of functions in an object file
- nmap - network and port scanner tool
O
- objdump - show information about object files
- openssl - create cryptographic server certificates and more
P
- passwd - change your and other's password
- ping - show if a given computer is up and running
- ps - show running processes
- pwd - show your current working directory
Q
- quota - manage how much resources the user is allowed to consume
R
- rar - rar files/directories
- read - read a string from your keyboard and more
- reboot - reboot the computer
- rename - rename a file
- rm - delete a file
- route - manage your network routing table
- rpm - a package management backend for Redhat and Fedora
- rsync - synchronize your folders over the network
S
- scp - (secure copy) over a network
- screen - a terminal multiplexer
- sed - manipulate a stream of characters (scripting language)
- setenv - change the value of an environment variable in the csh
- shuf - generate random permutations
- shutdown - shutdowns/reboots the system
- sleep - wait/delay some time
- ssh - login into / execute commands in a remote host
- su - change user
- sudo - execute the command as another user (usually root- /etc/sudoers)
T
- tail - show only the last n lines of a file and more
- tar - pack files in a special format
- tcpdump - dump the tcp network traffic
- tee - multiplex cli output
- time - show the time needed by a command to finish
- top - show the top CPU consuming processes and more
- touch - create a file or update its time stamp
- traceroute - show the route a package takes over the network
- tac - print the file in reverse. (opposite of cat) (cat X tac)
U
- ulimit - show the limits of your user
- umount - unmount a device (Often requires sudo permissions)
- uname - show the running kernel's version and more
- uniq - remove repeated lines in a sorted file
- unzip - unpack files
- uptime - show the time since your computer was last switched on
- useradd - add a user
- userdel - delete a user
- usermod - modify a user
V
- Vgcreate - create lvm volume groups
- Vgdisplay - display lvm volume groups
- Vgs - show information about lvm volume groups
- Vgscan - scan for lvm volume groups
- vim - its not a text editor like Notepad, it is an IDE
- Vmstat - show input/output values, swap, memory consumption and more
W
- w - print who is logged in to your system
- wc - word count (word,line,char)
- which - print the path where you find an executable file
- whoami - print your effective user name
X
- xargs - hand over stdin as a parameter
- xev - show information about your keystrokes and more
- xkill - kill a window that is in your way
- xosview - show CPU/memory/hard Drive activity and more
Y
- yacc - A C parser generator
- yes - repeatedly output a string
- yum - a package management frontend for Redhat & Fedora
- yast - a package management frontend for SUSE
Z
By category
- Cryptography Commands
- Directory Commands
- Disk and Tape Drive Commands
- File Commands
- Internet and Network Commands
- Kernel-commands
- Managing Sessions
- Packing and Unpacking files
- Programming-related Commands
- Scripting
- Shells
- System Information
- Startup/Shutdown Commands
- Text Viewing and Processing Tools
- User Commands
External links
- Complete Basic Linux Commands List (www.debianhelp.co.uk)
- Complete List of Linux Commands With man pages (www.debianadmin.com)
- Linux Man Pages Online (man-wiki.net)
- Searchable Linux command examples (http://www.examplenow.com)

This page is available under a