Rsync, Sudo, Cpio... Is that admin talking about robots from a science-fiction movie (again)?
To the uninitiated, working from a command line can seem daunting and foreign, and the commands sound something like an alien language. To help you get a little more comfortable with the jargon (and concepts behind it), we asked our site experts to give us a list of their favorite Linux utilities and programs that can be executed from the command line. Based on their responses, here's a guide of useful command-line tools, from the most newbie-basic to the more obscure and advanced. This list is not meant to include each and every command under the sun, so we've provided a sidebar of links to guide you to more exhaustive resources. -- Editors
An introduction to the command line and the Linux shell
By Ken Milberg
Ken Milberg
Although there's no real distinction between a command and a utility in Linux or Unix, there is a distinction between Linux (or Unix) shell commands and "standard" UNIX or Linux system commands or utilities. There are two types of commands that a person can enter from his keyboard. Those commands are shell commands and Linux/Unix commands.
Each shell (Korn, C, Bourne, Bash) has its own set of commands that are built into its program. When the name of a built-in command is used as the first word of a simple command, the shell executes the command directly, without even having to create a new process. These built-in commands are necessary to implement functionality that would be very inconvenient (at best) to obtain with separate utilities or commands. Basically, while each type of shell has its own commands, each individual shell's commands are the same regardless of what Linux distribution or Unix variant you might be running.
Examples of Linux/Unix commands are df, find, cp and ls. These commands help provide information and enable you to perform actions on files and/or directories on your system.
What is interesting is that on Posix systems, running /usr/bin/cd from a shell does not even change the shell's working directory. This is so because the shell's built-in cd command must be used. In Posix system V systems, almost every built-in shell command has a corresponding link in /usr/bin. Built-in commands are contained within the shell itself. Some examples of Bourne built-in commands are cd, eval, exec, exit, export, and pwd. Some examples of Bash commands are alias, declare, echo and enable. Here's how it works: When you enter a command, the shell will check to determine if it's a built-in command, and if it is, the shell will execute it. If it is not, then it executes it and the shell will fork a new process in which to execute the command.
Often, a built-in command may be synonymous to a system command of the same name. For example, the Bash shell echo command is different from /bin/echo, although they behave almost identically. Confusing built-in shell commands with Linux or Unix commands (which are forked by the shell) can actually impact what it is you are doing, so it is important to understand this difference.
1. Alias
Alias allows you to substitute a small or more familiar name in place of a long string.
More information
2. apt-get
The apt-get program searches for and installs software packages on Debian-based systems.
More information
3. Aspell
GNU Aspell is a free, open source spell checker. It's known for its stellar list of replacements for misspelled words.
More information
4. Awk Awk searches for patterns in a file and processes them. It enables a programmer to write small programs in the form of statements to make changes in text files when certain patterns appear or extract data from those files. This command simplifies a process historically done in C or Pascal languages.
More information on Awk
Gawk stands for "GNU awk" and is commonly used in Linux.
More about gawk
5. Bzip2
Reduce the size of backup files by by compressing them with bzip2, which can also be used for decompressing files.
More info:
6. cat
Abbreviated from the word "concatenate," which means to link things together, cat is used in Linux to link file contents and output them for viewing or printing.
More info: 'Cat' is where it's at
7. cd
The cd command sets the working directory of a process.
More information
18. eval
This POSIX special built-in command evaluates several arguments by reading them as one concatenated argument, then reports on that argument's status. More information
19. exec
Short for "execute," exec replaces the parent process by whatever command is typed.
More information
20. exit
Allows you to exit from a program, shell or UNIX network. More information
21. export
Export sets the value of a variable so it is visible to all sub-processes that belong to the current shell. More information
22. find
Find searches the directory tree rooted at each given file name by evaluating the given expression from left to right, according to the rules of precedence (see section OPERATORS), until the outcome is known (the left hand side is false for and operations, true for or), at which point find moves on to the next file name. This manual page documents the GNU version of find.
23. free
The free command enables admins to find statistics about memory usage, showing the total of free, used, physical, swap, shared and other memory used by the kernel.
More info: Put these troubleshooting tools in your toolbox
24. grep Grep is a command used for searching one or more files for a given character string or pattern. It can also be used to replace the character string with another one.
More info:
25. gzip
gzip is a compression utility designed to be a replacement for compress. Its main advantages over compress are much better compression and freedom from patented algorithms. It has been adopted by the GNU project and is now relatively popular on the Internet. gzip was written by Jean-loup Gailly and Mark Adler for the decompression code.
More information
26. ifconfig
ifconfig checks a network interface configuration. It can be used, for example, to verify a user's configuration if the user's system has been recently configured or if the user's system cannot reach the remote host while other systems on the same network can.
More info:
29. less
The less command lets an admin scroll through configuration and error log files, displaying text files one screen at a time. The command will enables a search for text within files. More information
More goes hand-in-hand with the less command and displays text one screen at a time. More information
30. locate
Locate lists files in a database that match a pattern. More information
slocate
Secure Locate provides a secure way to index and quickly search for files on your system. It uses incremental encoding just like GNU locate to compress its database to make searching faster, but it will also store file permissions and ownership so that users will not see files they do not have access to.
More information
This site gives variations on locate and slocate and how to use them. It also offers different methods for finding files in Linux.
31. ls
The ls command shows information about files. With it, admins can list the contents of a directory in order to determine when the configurations files were last edited. There are many subcommands under ls, such as ls-r, which can reverse the order in which files are displayed.
The man command is also discussed in this tip: Put these troubleshooting tools in your toolbox33. neat
Neat is a GNOME GUI admin tool. Among other things, net lets admins specify information needed to set up a network card.
More info:
34. netconfig, netcfg
Netconfig, a command used in configuring a network, displays a series of screens that ask for configuration information.
More info:
35. netstat
The netstat command shows the network status by symbolically displaying the contents of various network-related data structures. There are a number of output formats, depending on the options for the information presented. More information
36. ping
The ping command (named after the sound of an active sonar system) sends echo requests to the host you specify on the command line, and lists the responses received their round trip time. When you terminate ping (probably by hitting control-C) it summarizes the results, giving the average round trip time and the percent packet loss. This command is used constantly to determine whether there is a problem with the network connection between two hosts. More information
37. pwd
pwd is short for print working directory. The pwd command displays the name of the current working directory.
More information
38. rpm
The Red Hat Package Manager (RPM) is a command-line driven package-management system capable of installing, uninstalling, verifying, querying and updating computer software packages. Each software package consists of an archive of files along with information about the package like its version and a description.
40. screen
The screen utility is a terminal multiplexor; in essence this means that you can use a single terminal window to run multiple terminal applications.
41. sed
Sed (streams editor) isn't really a true text editor or text processor. Instead, it is used to filter text, i.e., it takes text input and performs some operation (or set of operations) on it and outputs the modified text. Sed is typically used for extracting part of a file using pattern matching or substituting multiple occurrences of a string within a file.
More information
42. shutdown
Shutdown is a command that turns off the computer and can be combined with variables such as -h for halt or -r for reboot. More information
43. Snort
Snort is an open source network intrusion-prevention and detection system utilizing a rule-driven language, which combines the benefits of signature, protocol and anomaly based inspection methods. With millions of downloads to date, Snort is the most widely deployed intrusion detection and prevention technology worldwide and has become the de facto standard for the industry. More information
44. sudo
Sudo (superuser do) allows a system administrator to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while logging the commands and arguments. More information
45. ssh Ssh is used for secure network connections and tunneling of TCP services. OpenSSH is one open source SSH version.
46. tar
The tar program provides the ability to create tar archives, as well as various other kinds of manipulation. For example, you can use tar on previously created archives to extract files, store additional files, or update or list files. Initially, tar archives were used to store files on magnetic tape. The name "tar" comes from this use; it stands for "tape archiver." Despite the utility's name, tar can direct its output to available devices, files, or other programs. Tar may even access remote devices or files. More information
47. traceroute
Traceroute determines a route to the host and is very useful for distinguishing network/router issues. If the domain does not work or is not available you can traceroute an IP. More information
48. vi
Vi is a screen-based editor preferred by many Unix users. The Vi editor has powerful features to aid programmers.
Learn more in this tutorial: Mastering the vi editor
49. vmstat
The vmstat command is used to get a snapshot of everything in a system, helping admins determine whether the bottleneck is CPU, memory or I/O. Run this command to get virtual memory statistics. More information
50. wget
Wget is a network utility to retrieve files from the Web using http and ftp, the two most widely used Internet protocols. It works non-interactively, so it will work in the background, after having logged off.
Bernard Golden, Mark Hinkle, Amy Kucharik, Ken Milberg, Jan Stafford and MiMi Yeh contributed to this guide, with much gratitude and credit due to the creators of the individual project and man pages cited above.
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.