|
|
|
|
Learning Debian GNU/LinuxBy Bill McCarty1st Edition September 1999 1-56592-705-2, Order Number: 7052 360 pages, $34.95 , Includes CD-ROM |
E. Linux Command Quick Reference
The following list describes some of the most useful and popular Linux commands. Consult the man page for each command to learn about additional arguments and details of operation.
adduseruseridCreates a new userid, prompting for necessary information (requires
rootprivileges).aproposkeywordSearches the manual pages for occurrences of the specified keyword and prints short descriptions from the beginning of matching manual pages.
attimeat -ffile timeExecutes 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 formathh:mmor in hour, minute, month, day, and year formathh:mm mm/dd/yy.atqPrints descriptions of jobs pending via the at command.
atrmjobCancels execution of a job scheduled via the at command. Use the atq command to discover the identities of scheduled jobs.
bgbgjobsPlaces 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.
calmonth yearPrints a calendar for the specified month of the specified year.
catfilesPrints the contents of the specified files.
cdcddirectoryChanges the current working directory to the user's home directory or the specified directory.
chgrpgroup fileschgrp -Rgroup filesChanges 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.
chmodmode fileschmod -Rmode filesChanges 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.
chownuserid fileschown -Ruserid filesChanges 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
clearClears the terminal screen.
cmpfile1 file2Compares two files, reporting all discrepancies. Similar to the diff command, though the output format differs.
cpfile1 file2cpfiles directorycp -Rfiles directoryCopies a file to another file or directory, or copies a subdirectory and all its files to another directory.
datedatedateDisplays the current date and time or changes the system date and time to the specified value, of the form
MMddhhmmyyorMMddhhmmyyyy.dfPrints the amount of free disk space on each mounted filesystem.
difffile1 file2Compares two files, reporting all discrepancies. Similar to the
cmpcommand, though the output format differs.dmesgPrints the messages resulting from the most recent system boot.
dududirectoriesPrints the amount of disk space used by the current directory (or the specified directories) and its (their) subdirectories.
echostringecho -nstringPrints the specified text on the standard output stream. The -n option causes omission of the trailing newline character.
fdformatdeviceFormats 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.
fdiskdeviceEdits the partition table of the specified hard disk.
fgfgjobsBrings the current job (or the specified jobs) to the foreground.
filefilesDetermines and prints a description of the type of each specified file.
findpath-namepatternSearches 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.
fingerusersPrints descriptions of the specified users.
freeDisplays the amount of used and free system memory.
ftphostnameOpens 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.
greppattern filesgrep -ipattern filesgrep -npattern filesgrep -vpattern filesSearch the specified files for text matching the specified pattern (usually enclosed in single quotes) and print 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 file name and line number. The -v option reverses the matching, causing non-matched lines to be printed.
gzipfilesgunzipfilesCompress (or expand) the specified files. Generally, a compressed file has the same name as the original file, followed by . gz.
headfilesPrints the first several lines of each specified file.
hostnamehostnamenameDisplays (or sets) the name of the host.
infoLaunches the GNU Texinfo help system.
initrun_levelChanges the system run level to the specified value (requires
rootprivileges).insmodmoduleDynamically loads the specified module (requires
rootprivileges).jobsDisplays all background jobs.
ispellfilesChecks the spelling of the contents of the specified files.
killprocess_idskill -signalprocess_idskill -lKills the specified processes, sends the specified processes the specified signal (given as a number or name), or prints a list of available signals.
killallprogramkillall -signalprogramKills all processes that are instances of the specified program or sends the specified signal to all processes that are instances of the specified program.
lnold newln -sold newCreates a hard (or soft) link associating a new name with an existing file or directory.
locatepatternLocates files with names containing the specified pattern. Uses the database maintained by the updatedb command.
lpqPrints the entries of the print queue.
lprfilesPrints the specified files.
lprmjobCancels printing of the specified print queue entries. Use lpq to determine the contents of the print queue.
lslsfilesls -afilesls -lfilesls -lRfilesLists (non-hidden) files in the current directory or the specified files or directories. The -a option lists hidden files as well has non-hidden 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.
mantitlemansectiontitlePrints the specified man page.
mkdirdirectoriesmkdir -pdirectoriesCreates the specified directories. The -p option causes creation of any parent directories needed to create a specified directory.
mkfs -ttype deviceCreates a file system of the specified type (such as
ext2ormsdos) on the specified device (requiresrootprivileges).mkswapdeviceCreates a Linux swap space on the specified hard disk partition (requires
rootprivileges).morefileLets 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 Space key moves forward one page, the b key moves back one page, and the q key exits the program.
mountmountdevice directorymount -ooption-ttype device directoryPrints 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
rootprivileges. The -o option allows specification of a variety of options; for example,rofor read-only access. The -t option allows specification of the filesystem type (for example,ext2,msdos, oriso9660, the filesystem type generally used for CD-ROMs).mvpaths targetMoves the specified files or directories to the specified target.
newgroupgroupCreates the specified group.
passwdpasswduserChanges the current user's password, or that of the specified user (requires
rootprivileges). The command prompts for the new password.pinghostSends an echo request via TCP/IP to the specified host. A response confirms that the host is operational.
prfilesFormats the specified files for printing, by inserting page breaks and so on. The command provides many arguments and functions.
psps -AuxDisplays the processes associated with the current userid or displays a description of each process.
pwdPrints the absolute path corresponding to the current working directory.
rebootReboots the system (requires
rootprivileges).resetClears the terminal screen and resets the terminal status.
rmfilesrm -ifilesrm -ffilesrm -iffilesrm -rffilesDeletes the specified files or (when the -r option is specified) recursively deletes all subdirectories of the specified files and directories. The -i option causes the command to prompt for confirmation; the -f option suppresses confirmation. Because deleted files cannot generally be recovered, the -f option should be used only with extreme care, particularly when used by the
rootuser.rmdirdirectoriesrmdir -pdirectoriesDeletes the specified empty directories or (when the -p option is specified) the empty directories along the specified path.
shutdownminutesshutdown -rminutesShuts down the system after the specified number of minutes elapses (requires
rootprivileges). The -r option causes the system to be rebooted once it has shut down.sleeptimeCauses the command interpreter to pause for the specified number of seconds.
sortfilesSorts the specified files. The command has many useful arguments; see the online documentation.
splitfileSplits a file into several smaller files. The command has many arguments; see the online documentation.
susuusersu -su -userChanges the current userid to
rootor to the specified userid (the latter requiresrootprivileges). The - option establishes a default environment for the new userid.swapondeviceEnables use of the specified device for swapping (requires
rootprivileges).swapoffdeviceDisables use of the specified device for swapping (requires
rootprivileges).syncCompletes all pending input/output operations (requires
rootprivileges).tailfiletail -nfiletail -ffilePrints the last several lines of the specified files. The -n option specifies the number of lines to be printed. The -f option causes the command to continuously print additional lines as they are written to the file.
talkuserLaunches a program that allows a chat-like dialog with the specified user.
tar cvftar_file filestar zcvftar_file filesCreates a tar file with the specified name, containing the specified files and their subdirectories. The
zoption specified that the tar file will be compressed.tar xvftar_filetar zxvftar_fileExtracts the contents of the specified tar file. The
zoption specified that the tar file has been compressed.telnethostOpens a login session on the specified host.
topPrints a display of system processes that's continually updated until the user presses the
qkey.traceroutehostUses echo requests to determine and print a network path to the host.
umountdeviceUnmounts the specified filesystem (generally requires
rootprivileges).uptimePrints the system uptime.
wPrints the current system users.
wallPrints a message to each user except those who've disabled message reception. Type Ctrl-D to end the message.
wcfilesPrints the number of characters, words, and lines in the specified files.
Table E.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.
Table E.1: MS-DOS Commands and Related 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
ae,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
Back to: Learning Debian GNU/Linux
© 2001, O'Reilly & Associates, Inc.