Linux Command

Wiki Welcome to the Linux command wiki, providing information about commonly used Linux commands.

Table of Contents

  1. Navigation Commands
  2. File Management Commands
  3. System Information Commands
  4. Process Management Commands
  5. Package Management Commands

Basic list

NameCategoryStatus (Option code)DescriptionFirst appeared
adminSCCSOptional (XSI)Create and administer SCCS filesPWB UNIX
aliasMiscMandatoryDefine or display aliases
arMiscMandatoryCreate and maintain library archivesVersion 1 AT&T UNIX
asaText processingOptional (FR)Interpret carriage-control charactersSystem V
atProcess managementMandatoryExecute commands at a later timeVersion 7 AT&T UNIX
awkText processingMandatoryPattern scanning and processing languageVersion 7 AT&T UNIX
basenameFilesystemMandatoryReturn non-directory portion of a pathname; see also dirnameVersion 7 AT&T UNIX
batchProcess managementMandatorySchedule commands to be executed in a batch queue
bcMiscMandatoryArbitrary-precision arithmetic languageVersion 6 AT&T UNIX
bgProcess managementOptional (UP)Run jobs in the background
cc/c99C programmingOptional (CD)Compile standard C programsIEEE Std 1003.1-2001
calMiscOptional (XSI)Print a calendarVersion 5 AT&T UNIX
catFilesystemMandatoryConcatenate and print filesPDP-7 UNIX
cdFilesystemMandatoryChange the working directoryVersion 6 AT&T UNIX
cflowC programmingOptional (XSI)Generate a C-language call graphSystem V
chgrpFilesystemMandatoryChange the file group ownershipPWB UNIX
chmodFilesystemMandatoryChange the file modes/attributes/permissionsPDP-7 UNIX
chownFilesystemMandatoryChange the file ownershipPDP-7 UNIX
cksumFilesystemMandatoryWrite file checksums and sizes4.4BSD
cmpFilesystemMandatoryCompare two files; see also diffVersion 1 AT&T UNIX
commText processingMandatorySelect or reject lines common to two filesVersion 4 AT&T UNIX
commandShell programmingMandatoryExecute a simple command
compressFilesystemOptional (XSI)Compress data4.3BSD
cpFilesystemMandatoryCopy filesPDP-7 UNIX
crontabMiscMandatorySchedule periodic background workSystem V
csplitText processingMandatorySplit files based on contextPWB UNIX
ctagsC programmingOptional (SD)Create a tags file3BSD
cutText processingMandatoryCut out selected fields of each line of a fileSystem III
cxrefC programmingOptional (XSI)Generate a C-language program cross-reference tableSystem V
dateMiscMandatoryDisplay the date and timeVersion 1 AT&T UNIX
ddFilesystemMandatoryConvert and copy a fileVersion 5 AT&T UNIX
deltaSCCSOptional (XSI)Make a delta (change) to an SCCS filePWB UNIX
dfFilesystemMandatoryReport free disk spaceVersion 1 AT&T UNIX
diffText processingMandatoryCompare two files; see also cmpVersion 5 AT&T UNIX
dirnameFilesystemMandatoryReturn the directory portion of a pathname; see also basenameSystem III
duFilesystemMandatoryEstimate file space usageVersion 1 AT&T UNIX
echoShell programmingMandatoryWrite arguments to standard outputVersion 2 AT&T UNIX
edText processingMandatoryThe standard text editorPDP-7 UNIX
envMiscMandatorySet the environment for command invocationSystem III
exText processingOptional (UP)Text editor1BSD
expandText processingMandatoryConvert tabs to spaces3BSD
exprShell programmingMandatoryEvaluate arguments as an expressionVersion 7 AT&T UNIX
falseShell programmingMandatoryReturn false valueVersion 7 AT&T UNIX
fcMiscOptional (UP)Process the command history list
fgProcess managementOptional (UP)Run jobs in the foreground
fileFilesystemMandatoryDetermine file typeVersion 4 AT&T UNIX
findFilesystemMandatoryFind filesVersion 1 AT&T UNIX
foldText processingMandatoryFilter for folding lines1BSD
fort77FORTRAN77 programmingObsolescent (FD)FORTRAN compilerXPG4
fuserProcess managementOptional (XSI)List process IDs of all processes that have one or more files openSystem V
gencatMiscMandatoryGenerate a formatted message catalog
getSCCSOptional (XSI)Get a version of an SCCS filePWB UNIX
getconfMiscMandatoryGet configuration values
getoptsShell programmingMandatoryParse utility options
grepMiscMandatorySearch text for a patternVersion 4 AT&T UNIX
hashMiscMandatoryHash database access method
headText processingMandatoryCopy the first part of filesPWB UNIX[citation needed]
iconvText processingMandatoryCodeset conversionHP-UX
idMiscMandatoryReturn user identitySystem V
ipcrmMiscOptional (XSI)Remove a message queue, semaphore set, or shared memory segment identifierSystem V
ipcsMiscOptional (XSI)Report interprocess communication facilities statusSystem V
jobsProcess managementOptional (UP)Display status of jobs in the current session
joinText processingMandatoryMerges two sorted text files based on the presence of a common fieldVersion 7 AT&T UNIX
killProcess managementMandatoryTerminate or signal processesVersion 4 AT&T UNIX
lexC programmingOptional (CD)Generate programs for lexical tasksVersion 7 AT&T UNIX
linkFilesystemOptional (XSI)Create a hard link to a fileVersion 1 AT&T UNIX
lnFilesystemMandatoryLink filesVersion 1 AT&T UNIX
localeMiscMandatoryGet locale-specific information
localedefMiscMandatoryDefine locale environment
loggerShell programmingMandatoryLog messages4.3BSD
lognameMiscMandatoryReturn the user’s login name4.4BSD
lpText processingMandatorySend files to a printerSystem V
lsFilesystemMandatoryList directory contentsVersion 1 AT&T UNIX
m4MiscMandatoryMacro processorPWB UNIX
mailxMiscMandatoryProcess messagesVersion 1 AT&T UNIX
makeProgrammingOptional (SD)Maintain, update, and regenerate groups of programsPWB UNIX
manMiscMandatoryDisplay system documentationVersion 2 AT&T UNIX
mesgMiscMandatoryPermit or deny messagesVersion 1 AT&T UNIX
mkdirFilesystemMandatoryMake directoriesVersion 1 AT&T UNIX
mkfifoFilesystemMandatoryMake FIFO special files4.4BSD[dubious – discuss]
moreText processingOptional (UP)Display files on a page-by-page basis3BSD
mvFilesystemMandatoryMove or rename filesVersion 1 AT&T UNIX
newgrpMiscMandatoryChange to a new groupVersion 6 AT&T UNIX
niceProcess managementMandatoryInvoke a utility with an altered nice valueVersion 4 AT&T UNIX
nlText processingOptional (XSI)Line numbering filterSystem III
nmC programmingOptional (SD, XSI)Write the name list of an object fileVersion 1 AT&T UNIX
nohupProcess managementMandatoryInvoke a utility immune to hangupsVersion 4 AT&T UNIX
odMiscMandatoryDump files in various formatsVersion 1 AT&T UNIX
pasteText processingMandatoryMerge corresponding or subsequent lines of filesVersion 32V AT&T UNIX
patchText processingMandatoryApply changes to files4.3BSD
pathchkFilesystemMandatoryCheck pathnames
paxMiscMandatoryPortable archive interchange4.4BSD[citation needed]
prText processingMandatoryPrint filesVersion 1 AT&T UNIX
printfShell programmingMandatoryWrite formatted output4.3BSD-Reno
prsSCCSOptional (XSI)Print an SCCS filePWB UNIX
psProcess managementMandatoryReport process statusVersion 4 AT&T UNIX
pwdFilesystemMandatoryPrint working directoryVersion 5 AT&T UNIX
qalterBatch utilitiesObsolescent (BE)Alter batch job
qdelBatch utilitiesObsolescent (BE)Delete batch jobs
qholdBatch utilitiesObsolescent (BE)Hold batch jobs
qmoveBatch utilitiesObsolescent (BE)Move batch jobs
qmsgBatch utilitiesObsolescent (BE)Send message to batch jobs
qrerunBatch utilitiesObsolescent (BE)Rerun batch jobs
qrlsBatch utilitiesObsolescent (BE)Release batch jobs
qselectBatch utilitiesObsolescent (BE)Select batch jobs
qsigBatch utilitiesObsolescent (BE)Signal batch jobs
qstatBatch utilitiesObsolescent (BE)Show status of batch jobs
qsubBatch utilitiesObsolescent (BE)Submit a script
readShell programmingMandatoryRead a line from standard input
readlinkMiscReturns the target of a symbolic link2.1BSD[1]
reniceProcess managementMandatorySet nice values of running processes4BSD
rmFilesystemMandatoryRemove directory entriesVersion 1 AT&T UNIX
rmdelSCCSOptional (XSI)Remove a delta from an SCCS filePWB UNIX
rmdirFilesystemMandatoryRemove directories, if they are empty.Version 1 AT&T UNIX
sactSCCSOptional (XSI)Print current SCCS file-editing activitySystem III
sccsSCCSOptional (XSI)Front end for the SCCS subsystem4.3BSD
sedText processingMandatoryStream editorVersion 7 AT&T UNIX
shShell programmingMandatoryShell, the standard command language interpreterVersion 7 AT&T UNIX (in earlier versions, sh was either the Thompson shell or the PWB shell)
sleepShell programmingMandatorySuspend execution for an intervalVersion 4 AT&T UNIX
sortText processingMandatorySort, merge, or sequence check text filesVersion 1 AT&T UNIX
splitMiscMandatorySplit files into piecesVersion 3 AT&T UNIX
stringsC programmingMandatoryFind printable strings in files2BSD
stripC programmingOptional (SD)Remove unnecessary information from executable filesVersion 1 AT&T UNIX
sttyMiscMandatorySet the options for a terminalVersion 2 AT&T UNIX
tabsMiscMandatorySet terminal tabsPWB UNIX
tailText processingMandatoryCopy the last part of a filePWB UNIX[citation needed]
talkMiscOptional (UP)Talk to another user4.2BSD
teeShell programmingMandatoryDuplicate the standard outputVersion 5 AT&T UNIX
testShell programmingMandatoryEvaluate expressionVersion 7 AT&T UNIX
timeProcess managementMandatoryTime a simple commandVersion 3 AT&T UNIX
touchFilesystemMandatoryChange file access and modification timesVersion 7 AT&T UNIX
tputMiscMandatoryChange terminal characteristicsSystem V
trText processingMandatoryTranslate charactersVersion 4 AT&T UNIX
trueShell programmingMandatoryReturn true valueVersion 7 AT&T UNIX
tsortText processingMandatoryTopological sortVersion 7 AT&T UNIX
ttyMiscMandatoryReturn user’s terminal nameVersion 1 AT&T UNIX
typeMiscOptional (XSI)Displays how a name would be interpreted if used as a command
ulimitMiscOptional (XSI)Set or report file size limit
umaskMiscMandatoryGet or set the file mode creation maskSystem III
unaliasMiscMandatoryRemove alias definitions
unameMiscMandatoryReturn system namePWB UNIX
uncompressMiscOptional (XSI)Expand compressed data4.3BSD
unexpandText processingMandatoryConvert spaces to tabs3BSD
ungetSCCSOptional (XSI)Undo a previous get of an SCCS fileSystem III
uniqText processingMandatoryReport or filter out repeated lines in a fileVersion 3 AT&T UNIX
unlinkFilesystemOptional (XSI)Call the unlink functionVersion 1 AT&T UNIX
uucpNetworkOptional (UU)System-to-system copyVersion 7 AT&T UNIX
uudecodeNetworkMandatoryDecode a binary file4BSD
uuencodeNetworkMandatoryEncode a binary file4BSD
uustatNetworkOptional (UU)uucp status inquiry and job controlSystem III
uuxProcess managementOptional (UU)Remote command executionVersion 7 AT&T UNIX
valSCCSOptional (XSI)Validate SCCS filesSystem III
viText processingOptional (UP)Screen-oriented (visual) display editor1BSD
waitProcess managementMandatoryAwait process completionVersion 4 AT&T UNIX
wcText processingMandatoryLine, word and byte or character countVersion 1 AT&T UNIX
whatSCCSOptional (XSI)Identify SCCS filesPWB UNIX
whoSystem administrationMandatoryDisplay who is on the systemVersion 1 AT&T UNIX
writeMiscMandatoryWrite to another user’s terminalVersion 1 AT&T UNIX
xargsShell programmingMandatoryConstruct argument lists and invoke utilityPWB UNIX
yaccC programmingOptional (CD)Yet another compiler compilerPWB UNIX
zcatText processingOptional (XSI)Expand and concatenate data4.3BSD

Advance list

A
&Start a new process in the background
aliasCreate an alias •
aproposSearch Help manual pages (man -k)
aptSearch for and install software packages (Debian/Ubuntu)
apt-getSearch for and install software packages (Debian/Ubuntu)
aptitudeSearch for and install software packages (Debian/Ubuntu)
aspellSpell Checker
atSchedule a command to run once at a particular time
awkFind and Replace text, database sort/validate/index
B
basenameStrip directory and suffix from filenames
base32Base32 encode/decode data and print to standard output
base64Base64 encode/decode data and print to standard output
bashGNU Bourne-Again SHell
bcArbitrary precision calculator language
bgSend to background
bindSet or display readline key and function bindings •
breakExit from a loop •
builtinRun a shell builtin
bzip2Compress or decompress named file(s)
C
calDisplay a calendar
callerReturn the context of any active subroutine call •
caseConditionally perform a command
catConcatenate and print (display) the content of files
cdChange Directory
cfdiskPartition table manipulator for Linux
chattrChange file attributes on a Linux file system
chgrpChange group ownership
chmodChange access permissions
chownChange file owner and group
chpasswdUpdate passwords in batch mode
chrootRun a command with a different root directory
chkconfigSystem services (runlevel)
cksumPrint CRC checksum and byte counts
clearClear the terminal screen/console (ncurses)
clear_consoleClear the terminal screen/console (bash)
cmpCompare two files
commCompare two sorted files line by line
commandRun a command - ignoring shell functions •
continueResume the next iteration of a loop •
cpCopy one or more files to another location
cpioCopy files to and from archives
cronDaemon to execute scheduled commands
crontabSchedule a command to run at a later time
csplitSplit a file into context-determined pieces
curlTransfer data from or to a server
cutDivide a file into several parts
D
dateDisplay or change the date & time
dcDesk Calculator
ddData Duplicator - convert and copy a file, write disk headers, boot records
ddrescueData recovery tool
declareDeclare variables and give them attributes •
dfDisplay free disk space
diffDisplay the differences between two files
diff3Show differences among three files
digDNS lookup
dirBriefly list directory contents
dircolorsColour setup for ‘ls’
dirnameConvert a full pathname to just a path
dirsDisplay list of remembered directories
dos2unixWindows/MAC to UNIX text file format converter
dmesgPrint kernel & driver messages
dpkgPackage manager (Debian/Ubuntu).
duEstimate file space usage
E
echoDisplay message on screen •
egrepSearch file(s) for lines that match an extended expression
ejectEject removable media
enableEnable and disable builtin shell commands •
envEnvironment variables
ethtoolEthernet card settings
evalEvaluate several commands/arguments
execExecute a command
exitExit the shell
expandConvert tabs to spaces
exportSet an environment variable
exprEvaluate expressions
F
falseDo nothing, unsuccessfully
fdformatLow-level format a floppy disk
fdiskPartition table manipulator for Linux
fgSend job to foreground
fgrepSearch file(s) for lines that match a fixed string
fileDetermine file type
findSearch for files that meet a desired criteria
fmtReformat paragraph text
foldWrap text to fit a specified width
forExpand words, and execute commands
formatFormat disks or tapes
freeDisplay memory usage
fsckFile system consistency check and repair
ftpFile Transfer Protocol
functionDefine Function Macros
fuserIdentify/kill the process that is accessing a file
G
gawkFind and Replace text within file(s)
getoptsParse positional parameters
getfaclGet file access control lists
grepSearch file(s) for lines that match a given pattern
groupaddAdd a user security group
groupdelDelete a group
groupmodModify a group
groupsPrint group names a user is in
gzipCompress or decompress named file(s)
H
hashRemember the full pathname of a name argument
headOutput the first part of file(s)
helpDisplay help for a built-in command •
historyCommand History
hostnamePrint or set system name
htopInteractive process viewer
I
iconvConvert the character set of a file
idPrint user and group id’s
ifConditionally perform a command
ifconfigConfigure a network interface
ifdownStop a network interface
ifupStart a network interface up
importCapture an X server screen and save the image to file
installCopy files and set attributes
iostatReport CPU and i/o statistics
ipRouting, devices and tunnels
J
jobsList active jobs •
joinJoin lines on a common field
K
killKill a process by specifying its PID
killallKill processes by name
klistList cached Kerberos tickets
L
lessDisplay output one screen at a time
letPerform arithmetic on shell variables •
linkCreate a link to a file
lnCreate a symbolic link to a file
localCreate a function variable •
locateFind files
lognamePrint current login name
logoutExit a login shell •
lookDisplay lines beginning with a given string
lpcLine printer control program
lprPrint files
lprintPrint a file
lprintdDelete a print job
lprintqList the print queue
lprmRemove jobs from the print queue
lsattrList file attributes on a Linux second extended file system
lsblkList block devices
lsList information about file(s)
lsofList open files
lspciList all PCI devices
M
makeRecompile a group of programs
manHelp manual
mapfileRead lines from standard input into an indexed array variable •
mkdirCreate new folder(s)
mkfifoMake FIFOs (named pipes)
mkfileMake a file
mkisofsCreate a hybrid ISO9660/JOLIET/HFS filesystem
mknodMake block or character special files
mktempMake a temporary file
moreDisplay output one screen at a time
mostBrowse or page through a text file
mountMount a file system
mtoolsManipulate MS-DOS files
mtrNetwork diagnostics (traceroute/ping)
mvMove or rename files or directories
mmvMass Move and rename (files)
N
ncNetcat, read and write data across networks
netstatNetworking connections/stats
nftnftables for packet filtering and classification
niceSet the priority of a command or job
nlNumber lines and write files
nohupRun a command immune to hangups
notify-sendSend desktop notifications
nslookupQuery Internet name servers interactively
O
openOpen a file in its default application
opOperator access
P
passwdModify a user password
pasteMerge lines of files
pathchkCheck file name portability
PerfPerformance analysis tools for Linux
pingTest a network connection
pgrepList processes by name
pkillKill processes by name
popdRestore the previous value of the current directory
prPrepare files for printing
printcapPrinter capability database
printenvPrint environment variables
printfFormat and print data •
psProcess status
pushdSave and then change the current directory
pvMonitor the progress of data through a pipe
pwdPrint Working Directory
Q
quotaDisplay disk usage and limits
quotacheckScan a file system for disk usage
R
ramram disk device
rarArchive files with compression
rcpCopy files between two machines
readRead a line from standard input •
readarrayRead from stdin into an array variable •
readonlyMark variables/functions as readonly
rebootReboot the system
renameRename files
reniceAlter priority of running processes
remsyncSynchronize remote files via email
returnExit a shell function
revReverse lines of a file
rmRemove files
rmdirRemove folder(s)
rsyncRemote file copy (Synchronize file trees)
S
screenMultiplex terminal, run remote shells via ssh
scpSecure copy (remote file copy)
sdiffMerge two files interactively
sedStream Editor
selectAccept user choices via keyboard input
seqPrint numeric sequences
setManipulate shell variables and functions
setfaclSet file access control lists.
sftpSecure File Transfer Program
sha256sumCompute and check SHA256 (256-bit) checksums
shiftShift positional parameters
shoptShell Options
shufGenerate random permutations
shutdownShutdown or restart linux
sleepDelay for a specified time
slocateFind files
sortSort text files
sourceRun commands from a file ’.’  •
splitSplit a file into fixed-size pieces
ssSocket Statistics
sshSecure Shell client (remote login program)
statDisplay file or file system status
straceTrace system calls and signals
suSubstitute user identity
sudoExecute a command as another user
sumPrint a checksum for a file
suspendSuspend execution of this shell •
syncSynchronize data on disk with memory
T
tailOutput the last part of a file
tarStore, list or extract files in an archive
teeRedirect output to multiple files
testEvaluate a conditional expression
timeMeasure Program running time
timeoutRun a command with a time limit
timesUser and system times
tmuxTerminal multiplexer
touchChange file timestamps
topList processes running on the system
tputSet terminal-dependent capabilities, color, position
tracerouteTrace Route to Host
trapExecute a command when the shell receives a signal •
trTranslate, squeeze, and/or delete characters
trueDo nothing, successfully
tsortTopological sort
ttyPrint filename of terminal on stdin
typeDescribe a command •
U
ulimitLimit user resources •
umaskUsers file creation mask
umountUnmount a device
unaliasRemove an alias •
unamePrint system information
unexpandConvert spaces to tabs
uniqUniquify files
unitsConvert units from one scale to another
unix2dosUNIX to Windows or MAC text file format converter
unrarExtract files from a rar archive
unsetRemove variable or function names
unsharUnpack shell archive scripts
untilExecute commands (until error)
uptimeShow uptime
useraddCreate new user account
userdelDelete a user account
usermodModify user account
usersList users currently logged in
uuencodeEncode a binary file
uudecodeDecode a file created by uuencode
V
vVerbosely list directory contents (‘ls -l -b’)
vdirVerbosely list directory contents (‘ls -l -b’)
viText Editor
vmstatReport virtual memory statistics
W
wShow who is logged on and what they are doing
waitWait for a process to complete •
watchExecute/display a program periodically
wcPrint byte, word, and line counts
whereisSearch the user’s $path, man pages and source files for a program
whichSearch the user’s $path for a program file
whileExecute commands
whoPrint all usernames currently logged in
whoamiPrint the current user id and name (‘id -un’)
wgetRetrieve web pages or files via HTTP, HTTPS or FTP
writeSend a message to another user
X
xargsExecute utility, passing constructed argument list(s)
xdg-openOpen a file or URL in the user’s preferred application.
xxdMake a hexdump or do the reverse
xzCompress or decompress .xz and .lzma files
yesPrint a string until interrupted
zipPackage and compress (archive) files
.Run a command script in the current shell
!!Run the last command again
Comment / Remark

Bash How-to guides and examples

ArgumentsShell parameters.
Array variablesArray Variables.
FunctionsDefine Function Macros.
PermissionsAllow or Deny actions.
RedirectionSpooling to and from files.
PipesRedirect the output from one command as input for another.
Shell variablesDefault Shell variables / bash variables.
Local varsCreate environment variables in bash.

Looping constructs:

if-then-elseConditionally perform a command.
forExpand words, and execute commands.
untilExecute commands (until error).
whileExecute commands.
breakControl loop execution.
continueControl loop execution.

Evaluating expressions:

Arithmetic expressions.
Using brackets to Group and expand expressions.
Conditional Execution command_A_ AND/OR command_B_
Command Substitution
Escape Characters, delimiters and Quotes
File operators/Comparisions - exists, greater than,-a, -nt
Shell expansion { } ~ &{}()
Wildcards Pattern matching

Working with the bash Shell:

Run scriptRun a bash shell script.
Here documentsand Here Strings
Job ControlSuspend and resume a process.
KeyboardCursor control - Cut & paste.
.bashrcStartup files (Startup scripts and Aliases).
.inputrcStartup files (Set Key bindings and Tab completion).
PromptPrompt variable.
Comment / Remark.
BashBangSplatPronunciation guide for unix.
vi editorvi commands.
Xterm colours256 Colors for the XTerm prompt (console).

The pronounciation for Linux is ‘Lyn-ux’ not ‘Line-ux’ Listen to Linus .

See also: Websites, Books, OS Downloads, Apps & Utilities for GNU/Linux.

doc

doc