A command, in the most general sense, is a string passed to a shell, which triggers the execution of an executable file of the same name or of a shell builtin. For example, cd, ls, echo and firefox are commands. The first three trigger simple operations: to change the current working directory, to list that directory or to print a specific piece of data. After that, the shell will prompt you for the next command. The final example, firefox opens a more complex program which continues to interact with you after it starts. Such programs are sometimes called applications. Many, but not all, of these applications interact through a graphical interface, or GUI.
Note: only some of the commands are listed here. A more complete list is automatically kept on the page Category:Command
Note: details of commands vary from version to version and available commands vary from distribution to distribution.
GNU/Linux Basic Operating System book is a useful resource for beginning with Linux command line.
Another resource is the book: The Linux Command Line
This wiki is a reference rather than a tutorial.
- 1 General notes on commands
- 2 Learning about commands with local documentation
- 3 Lists of commands
- 4 Links
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
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 semicolon 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
$ man -k subject
to find suitable commands.
Unfortunately, while 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.
Man pages are monolithic and some are quite long, and it's occasionally hard to find what you want. The tradeoff is that the man command automatically puts you in a pager that allows you to search for specific text, usually using key bindings like vi. This can be good if you know what to look for.
Info pages are usually subdivided, and contain some directory and hyperlink information. The tradeoff is that you need to be at least minimally familiar with the key bindings used for navigation. They are a subset of those for emacs. Alternatively, you can export the entire tree as a single text document and view through a pager with the command
$ info --subnodes command | less
this loses the hyperlinks, but you can use the same navigation skills you use on a man page.
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.
This is a list of commands that gives you just enough information to decide what command you want to use.
- alias - allows you to create shorter or more familiar names for commonly used commands
- apropos - search the manual page names and descriptions
- apt-get - a package management frontend for Debian-based distributions
- at - execute a command-line task at a specified future time
- awk - print only the nth word of an input line and more
- badblocks - a command disk utility
- bash - a shell
- beep - customized audible alerts
- bg - run a process in the background
- bunzip2 - unpack files packed with bzip2
- bzip2 - a pack utility
- cat - receive strings from stdin or a file and output them to stdout or a file
- cd - change to directory
- 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
- clear - clear the terminal screen
- cmp - compare arbitrary files.
- 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
- 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
- echo - echo a string/value to stdout
- emacs - a text editor (and much more)
- env - show all environment variables
- exit - exit most shells
- export - set an environment variable in bash and sh
- 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
- fuser - identify processes using files or sockets
- g++ - compile C++ code
- gawk - This command is used to find text within files and replace it.
- gcc - compile C code
- getopts - Parse positional parameters
- git - a version control system
- grep - grab for patterns in a file and more
- groupadd - Use this command to add security user groups.
- groupdel - This one is used for deleting a certain group.
- groupmod - While the last one deletes, this one modified a group.
- groups - show what groups your user is in
- gunzip - unpack files from a special format
- gzip - pack files in a special format
- 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
- id - show your user and groups ids
- ifconfig - show your ip address and more
- info - show info about a given command
- init - change runlevel
- iptables - show your firewall configuration
- iptraf - Interactive IP LAN monitor
- 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 files in a directory
- lshal - list HAL devices
- lshw - list hardware
- lsmod - list loaded kernel modules
- lsof - list open files and listening sockets
- lspci - list all pci devices
- lsusb - list usb devices
- make - compile software and more
- man - get help on commands
- 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 (or rename a file)
- netcat - Send some bytes to the network
- netstat - get information on listening sockets, open ports and more
- nice - set a process's priority
- nm - list the names of functions in an object file
- nmap - network and port scanner tool
- notepad - a simple text editor, good for folks transitioning to linux, provided by wine.
- objdump - show information about object files
- openssl - create cryptographic server certificates and more
- passwd - change user password
- ping - show if a given computer is up and running
- ps - show running processes
- pwd - show your current working directory
- quota - manage how much resources the user is allowed to consume
- 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
- rmdir - remove empty directories
- route - manage your network routing table
- rpm - a package management backend for Redhat and Fedora
- rsync - synchronize your folders over the network
- 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)
- 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 packet takes over the network
- tac - print the file in reverse. (opposite of cat) (cat X tac)
- tune2fs - adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems
- 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
- unrar - extract .rar files
- 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
- Vgcreate - create lvm volume groups
- Vgdisplay - display lvm volume groups
- Vgs - show information about lvm volume groups
- Vgscan - scan for lvm volume groups
- vim - a text editor, not entirely unlike Notepad, but more powerful and programmable.
- Vmstat - show input/output values, swap, memory consumption and more
- w - print who is logged in to your system
- watch - repeat a command every x seconds
- wc - word count (word,line,char)
- wget - The non-interactive network downloader
- whereis - locate the binary, source, and manual page files for a command
- which - print the path where you find an executable file
- who - see who is on the system
- whoami - print your effective user name
- 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
- yes - repeatedly output a string
- yum - a package management frontend for Redhat & Fedora
- yast - a package management frontend for SUSE
- zcat - apply cat on Gzip files
- zcmp - apply cmp on Gzip files
- zdiff - apply diff on Gzip files
- zgrep - apply grep(search in) possibly compressed files
- zip - pack a file
- zless - apply less on a compressed file
- zmore - apply more on a compressed file
- Cryptography Commands
- Directory Commands
- Disk and Tape Drive Commands
- File Commands
- Internet and Network Commands
- Managing Sessions
- Packing and Unpacking Files
- Programming-related Commands
- System Information
- Startup/Shutdown Commands
- Text Viewing and Processing Tools
- User commands