The following list describes some of the most useful and popular Linux commands. Consult the manpage for each command to learn about additional arguments and details of operation.
Creates a new userid, prompting for necessary information (requires root privileges).
Defines name as an alias for the specified command.
Searches the manual pages for occurrences of the specified keyword and prints short descriptions from the beginning of matching manual pages.
Executes commands entered via STDIN (or by using the alternative form, the specified file) at the specified time. The time can be specified in a variety of ways; for example, in hour and minute format (hh:mm) or in hour, minute, month, day, and year format (hh:mm mm/dd/yy).
Displays descriptions of jobs pending via the at command.
Cancels execution of a job scheduled via the at command. Use the atq command to discover the identities of scheduled jobs.
Places the current job (or by using the alternative form, the specified jobs) in the background, suspending its execution so that a new user prompt appears immediately. Use the jobs command to discover the identities of background jobs.
Displays a calendar for the specified month of the specified year.
Displays the contents of the specified files.
Changes the current working directory to the user's home directory or the specified directory.
Changes the group of the specified files to the specified group. The alternative form of the command operates recursively, changing the group of subdirectories and files beneath a specified directory. The group must be named in the /etc/groups file, maintained by the newgroup command.
Changes the access mode of the specified files to the specified mode. The alternative form of the command operates recursively, changing the mode of subdirectories and files beneath a specified directory.
Changes the owner of the specified files to the specified userid. The alternative form of the command operates recursively, changing the owner of subdirectories and files beneath a specified directory
Clears the terminal screen.
Compares two files, reporting all discrepancies. Unlike the diff command, cmp can compare multiple files and binary files.
Copies a file to another file or directory or copies a subdirectory and all its files to another directory.
Displays the current date and time or changes the system date and time to the specified value, of the form MMddhhmmyy or MMddhhmmyyyy.
Displays the amount of free disk space on each mounted filesystem.
Compares two files, reporting all discrepancies. Similar to the cmp command, though the output format differs.
Displays the messages resulting from the most recent system boot.
Displays the amount of disk space used by the current directory (or the specified directories) and its (their) subdirectories.
Displays the specified text on the standard output stream. The -n option causes omission of the trailing newline character.
Formats the media inserted in the specified floppy disk drive. The command performs a low-level format only; it does not create a filesystem. To create a filesystem, issue the mkfs command after formatting the media.
Edits the partition table of the specified hard disk.
Brings the current job (or the specified jobs) to the foreground.
Determines and prints a description of the type of each specified file.
Searches the specified path for files with names matching the specified pattern (usually enclosed in single quotes) and prints their names. The find command has many other arguments and functions; see the online documentation.
Displays descriptions of the specified users.
Displays the amount of used and free system memory.
Opens an FTP connection to the specified host, allowing files to be transferred. The FTP program provides subcommands for accomplishing file transfers; see the online documentation.
Searches the specified files for text matching the specified pattern (usually enclosed in single quotes) and prints matching lines. The -i option specifies that matching is performed without regard to case. The -n option specifies that each line of output is preceded by the filename and line number. The -v option reverses the matching, causing nonmatched lines to be printed.
Expands or compresses the specified files. Generally, a compressed file has the same name as the original file, followed by .gz.
Displays the first several lines of each specified file.
Displays (or sets) the name of the host.
Launches the GNU Texinfo help system.
Changes the system runlevel to the specified value (requires root privileges).
Dynamically loads the specified module (requires root privileges).
Checks the spelling of the contents of the specified files.
Displays all background jobs.
Kills the specified processes, prints a list of available signals, or sends the specified processes the specified signal (given as a number or name).
Kills all processes that are instances of the specified program or sends the specified signal to all processes that are instances of the specified program.
Lets the user peruse a file too large to be displayed as a single screen (page) of output. The less command, which is more powerful than the more command, provides many subcommands that let the user navigate the file. For example, the spacebar moves forward one page, the b key moves back one page, and the q key exits the program.
Views the specified web page.
Creates a hard (or soft) link associating a new name with an existing file or directory.
Locates files with names containing the specified pattern. Uses the database maintained by the updatedb command.
Displays the entries of the print queue.
Displays the specified files.
Cancels printing of the specified print queue entries. Use lpq to determine the contents of the print queue.
Lists (nonhidden) files in the current directory or the specified files or directories. The -a option lists hidden files as well as nonhidden files. The -l option causes the list to include descriptive information, such as file size and modification date. The -R option recursively lists the subdirectories of the specified directories.
Launches a simple mail client that permits sending and receiving email messages.
Displays the specified manpage.
Creates the specified directories. The -p option causes creation of any parent directories needed to create a specified directory.
Creates a filesystem of the specified type (such as ext3 or msdos) on the specified device (requires root privileges).
Creates a Linux swap space on the specified hard disk partition (requires root privileges).
Lets the user peruse a file too large to be displayed as a single screen (page) of output. The more command provides many subcommands that let the user navigate the file. For example, the spacebar moves forward one page, the b key moves back one page, and the q key exits the program.
Displays the mounted devices or mounts the specified device at the specified mount point (generally a subdirectory of /mnt). The mount command consults /etc/fstab to determine standard options associated with a device. The command generally requires root privileges. The -o option allows specification of a variety of options, for example, ro for read-only access. The -t option allows specification of the filesystem type (for example, ext3, msdos, or iso9660, the filesystem type generally used for CD-ROMs).
Moves the specified files or directories to the specified target.
Creates the specified group.
Changes the current user's password or that of the specified user (requires root privileges). The command prompts for the new password.
Launch pico to edit the specified file, if any.
Sends an echo request via TCP/IP to the specified host. A response confirms that the host is operational.
Formats the specified files for printing, by inserting page breaks and so on. The command provides many arguments and functions.
Displays the processes associated with the current userid or displays a description of each process.
Displays the absolute path corresponding to the current working directory.
Reboots the system (requires root privileges).
Clears the terminal screen and resets the terminal status.
Deletes the specified files or (when the -r option is specified) recursively deletes all subdirectories of the specified files and directories. The -f option suppresses confirmation; the -i option causes the command to prompt for confirmation. Because deleted files cannot generally be recovered, the -f option should be used only with extreme care, particularly when used by the root user.
Deletes the specified empty directories or (when the -p option is specified) the empty directories along the specified path.
Copies file from host1 to host2, via SSH.
Shuts down the system after the specified number of minutes elapses (requires root privileges). The -r option causes the system to be rebooted once it has shut down. If the -r option is absent, the system is halted and powered off; the -h option also halts and shuts down the system. Alternatively, now can be used instead of minutes, which forces an immediate reboot or halt of the system.
Causes the command interpreter to pause for the specified number of seconds.
Sorts the specified files. The command has many useful arguments; see the online documentation.
Splits a file into several smaller files. The command has many arguments; see the online documentation.
Logs in to host via SSH, using the specified userid.
Changes the current userid to root or to the specified userid (the latter requires root privileges). The - option establishes a default environment for the new userid.
Disables use of the specified device for swapping (requires root privileges).
Enables use of the specified device for swapping (requires root privileges).
Completes all pending input/output operations (requires root privileges).
Displays the last several lines of the specified files. The -f option causes the command to continuously print additional lines as they are written to the file. The -n option specifies the number of lines to be printed.
Launches a program that allows a chatlike dialog with the specified user.
Creates a tar file with the specified name, containing the specified files and their subdirectories. The z option specifies that the tarfile will be compressed.
Extracts the contents of the specified tarfile. The z option specifies that the tarfile has been compressed.
Opens a login session on the specified host.
Times the execution of a job.
Displays a display of system processes that's continually updated until the user presses the q key.
Changes file access time. If the specified file does not exist, the command creates an empty (new) file.
Uses echo requests to determine and print a network path to the host.
Specifies default permissions assigned to created directories and files.
Unmounts the specified filesystem (generally requires root privileges).
Displays information about the system.
Unzips a compressed file.
Displays the system uptime.
Displays the current system users.
Displays a message to each user except those who've disabled message reception. Type Ctrl-D to end the message.
Displays the number of characters, words, and lines in the specified files.
Displays information about system users.
Compresses the specified file.
Table D-1 identifies Linux commands that perform functions similar to MS-DOS commands. The operation of the Linux command is not generally identical to that of the corresponding MS-DOS command. See the index to this book or the Linux online documentation for further information about Linux commands.
MS-DOS |
Linux |
---|---|
ATTRIB |
chmod |
CD |
cd |
CHKDSK |
df, du |
DELTREE |
rm -R |
DIR |
ls -l |
DOSKEY |
(built-in; no need to launch separately) |
EDIT |
pico, vi, and so on |
EXTRACT |
tar |
FC |
cmp, diff |
FDISK |
fdisk |
FIND |
grep |
FORMAT |
fdformat |
MORE |
more |
MOVE |
mv |
SORT |
sort |
START |
at, bg |
XCOPY, XCOPY32 |
cp |