Basic Unix Commands Pdf

UNIX commands, however, are stand-alone programs; they may incorporate both system calls and library functions in their programming. 21) What is Bash Shell? It is a free shell designed to work on the UNIX system. Being the default shell for most UNIX-based systems, it combines features that are available both in the C and Korn Shell. In Unix/Linux, software is installed in the form of packages. A package contains the program itself. Any dependent component needs to be downloaded separately. You can also send e-mails from terminal using the 'mail' command; Cheat Sheet. Below is a Cheat Sheet of Linux commands we have learned in this tutorial.

  1. Basic Unix Commands Cheat Sheet.pdf
  2. Unix Basics Commands Pdf With Example
  3. Basic Unix Linux Commands Pdf
  4. Basic Unix Commands For Beginners Pdf
  5. Basic Unix Administration Commands Pdf

The first character, the type field, indicates the file type. In the example above the file type is “-”, which indicates a regular file. Other file types include: d for directory, l (lower case ell) for symbolic link, s for Unix domain socket, p for named pipe, c for character device file and b for block device file. This tutorial is written to help people understand some of the basics of shell script programming (aka shell scripting), and hopefully to introduce some of the possibilities of simple but powerful programming available under the Bourne shell. As such, it has been written as a basis for one-on-one or group tutorials and exercises, and as a reference for subsequent use. Compiled by Aluizio using the book UNIX IN A NUTSHELL, Arnold Robbins, O'Reilly Ed., 4th edition, 2005, ISBN 0­596­10029­9. USEFUL UNIX COMMANDS cancel cancel print requested with lp cat file Display the file cat file1 file2 files Combine file1 and file2 into files. Some Basic UNIX Commands by Donald Hyatt The UNIX operating system has for many years formed the backbone of the Internet, especially for large servers and most major university campuses. File Access Modes The permissions of a file are the first line of defense in the security of a Unix system. The basic building blocks of Unix permissions are the read, write, and execute permissions, which have been described below − Read. Grants the capability to read, i.e., view the contents of the file.

This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems.

List[edit]

IEEE Std 1003.1-2008 utilities
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 filesVersion 1 AT&T 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/permissionsVersion 1 AT&T UNIX
chownFilesystemMandatoryChange the file ownershipVersion 1 AT&T 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 filesVersion 1 AT&T 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 editorVersion 1 AT&T UNIX
envMiscMandatorySet the environment for command invocationSystem III
exText processingOptional (XSI)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]
moreText processingOptional (UP)Display files on a page-by-page basis3BSD
mvFilesystemMandatoryMove or rename filesVersion 1 AT&T UNIX
newgrpMiscMandatoryChange to a new group (functionality similar to sg[1])Version 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
pwdFilesystemMandatorypresent working directory - Return working directory nameVersion 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
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

See also[edit]

Footnotes[edit]

  1. ^Stanfield, Vicki (2006). Linux System Administration. Craig Hunt Linux Library. Roderick W. Smith (2 ed.). John Wiley & Sons. p. 152. ISBN9780782152203. Retrieved 2012-11-27. The command sg is frequently a synonym for newgrp.

External links[edit]

Basic Unix Commands Cheat Sheet.pdf

The Wikibook Guide to UNIX has a page on the topic of: Commands
Wikimedia Commons has media related to Unix reference cards.
  • Rosetta Stone For *Nix – configurable list of equivalent programs for *nix systems.
  • The Unix Acronym List – explains the names of many Unix commands.
Retrieved from 'https://en.wikipedia.org/w/index.php?title=List_of_Unix_commands&oldid=913154746'

The total number of Unix commands is immense. No normal user or system administrator would ever need to know them all.

The Unix commands available to you will vary based upon several factors:

  • The version of Unix you are using (FreeBSD, Linux, Solaris, AIX, HP-UX, OpenBSD, etc…)
  • The Unix shell you are using (sh, csh, tcsh, ksh, bash, etc…)
  • The packages installed on the system and the way the system is configured
  • Your access level on the system

This list of basic Unix commands will get you started using and learning Unix.

Chart of Basic Unix Commands

Unix CommandDescription
lsList directory contents
cpCopy files
rmRemove directory entries
fileDetermine file type
findWalk a file hierarchy
whichLocate a program file in the user’s path
whereisLocate programs
gcc, g++GNU project C and C++ Compiler
gdbThe GNU Debugger
lessView the contents of a text file
diffFind differences between two files
cmpCompare two files
viText editor
chmodChange file modes
manDisplay the on-line manual pages
mvMove and rename files
ispellInteractive spelling checker
biffBe notified if mail arrives and who it is from
lprPrint a file
lpqShow the print queue
ftpTransfer a file to another Unix system
logoutQuit using the system
pwdPrint working directory name
cdChange working directory
lnMake a file link
mkdirMake directories
rmdirRemove directories
chmodChange file modes
quotaDisplay disk usage and limits
historyDisplay a list of recent commands
psShow the status of processes
killStop a running processes
passwdChange your password
aliasCreate a command alias
unaliasDelete a command alias
exportSet an environment variable
scriptRecord your terminal session to a file
bgSend a job to the background
fgBring a job to the foreground
jobsPrint a list of current jobs

The basic Unix commands are fairly standard across the various Unix platforms, although command arguments differ at times. In addition, the basic Unix commands vary between Unix shells.

Use the Unix `man` command to learn more about any of these commands.

Basic Unix Commands in Detail

mkdir

Create the DIRECTORY(ies), if they do not already exist.

Usage

mkdir [OPTION] DIRECTORY

Options

Note: Mandatory arguments to long options are mandatory for short options too.

-m, mode=MODE set permission mode (as in chmod), not rwxrwxrwx – umask

-p, parents no error if existing, make parent directories as needed

-v, verbose print a message for each created directory

-help, display this help and exit

-version, output version information and exit

Examples

Create single directory

Create 3 directories

cd

Use cd to change directories. Type cd followed by the name of a directory to access that directory.Keep in mind that you are always in a directory and can navigate to directories hierarchically above or below.

Usage

cd DIRECTORYNAME

Example

mv

To change the name of a directory. Type mv followed by the current name of a directory and the new name of the directory.

Usage and Example

This renames the filejunkas the fileprecious.

pwd

print working directory; will show you the full path to the directory you are currently in. This is very handy to use, especially when you need to perform other directory related tasks.

Usage

pwd

Example:

rmdir

Remove an existing directory

Usage

rm DIRECTORYNAME

Options

rm -r

Removes directories and files within the directories recursively.

Example

To delete a directory named usersmith, type the following command ((from any directory except usersmith):

chown

change file owner and group; Change the owner and/or group of each FILE to OWNER and/or GROUP. With –reference, change the owner and group of each FILE to those of RFILE

Usage

chown [OPTION] OWNER[:[GROUP]] FILE

chown [OPTION] :GROUP FILE

chown [OPTION] –reference=RFILE FILE

Options

-c, changes like verbose but report only when a change is made

-dereference affect the referent of each symbolic link, rather than the symbolic link itself

-h, no-dereference affect each symbolic link instead of any referenced file (useful only on systems that can change the ownership of a symlink)

-from=CURRENT_OWNER:CURRENT_GROUP

change the owner and/or group of each file only if its current owner and/or group match those specified here. Either may be omitted, in which case a match is not required for the omitted attribute.

-no-preserve-root do not treat `/’ specially (the default)

-preserve-root fail to operate recursively on `/’

-f, -silent, -quiet suppress most error messages

Unix Basics Commands Pdf With Example

Simple unix commands pdf

-reference=RFILE use RFILE’s owner and group rather than the specifying OWNER:GROUP values

-R, -recursive operate on files and directories recursively

-v, -verbose output a diagnostic for every file processed

The following options modify how a hierarchy is traversed when the -R option is also specified. If more than one is specified, only the final one takes effect.

-H if a command line argument is a symbolic link to a directory, traverse it

-L traverse every symbolic link to a directory encountered

-P do not traverse any symbolic links (default)

Examples

The owner of the ‘test.txt’ file is root, Change to new user hiox.

chmod

change file access permissions

Usage

chmod [-r] permissions filenames

r Change the permission on files that are in the subdirectories of the directory that you are currently in.

permission Specifies the rights that are being granted. Given below are the different rights that you can grant in an alphanumeric format.

Commands

u – User who owns the file.

g – Group that owns the file.

o – Other.

a – All.

r – Read the file.

w – Write or edit the file.

x – Execute or run the file as a program.

Numeric Permissions:

CHMOD can also to attributed by using Numeric Permissions:

400 read by owner

040 read by group

004 read by anybody (other)

200 write by owner

020 write by group

002 write by anybody

100 execute by owner

010 execute by group

001 execute by anybody

Examples

gives:

read, execute, and write access to the user (that’s you)

read and execute access to the group and

read and execute access to others

Basic Unix Linux Commands Pdf

The same can be achieved by using the command

ls

Short listing of directory contents

Usage

ls [OPTION]

Options

-a list hidden files

-d list the name of the current directory

-F show directories with a trailing ‘/’

executable files with a trailing ‘*’

-g show group ownership of file in long listing

-i print the inode number of each file

-l long listing giving details about files and directories

-R list all subdirectories encountered

-t sort by time modified instead of name

Example

To list the contents of the current directory:

cp

To copy files

Usage and Examples

Copy the files “myfile” to the file “yourfile” in the current working directory. This command will create the file “yourfile” if it doesn’t exist. It will normally overwrite it without warning if it exists.

With the “-i” option, if the file “yourfile” exists, you will be prompted before it is overwritten.

Copy the file “/data/myfile” to the current working directory and name it “myfile”. Prompt before overwriting the file.

Copy all files from the directory “srcdir” to the directory “destdir” preserving links (-doption), file attributes (-p option), and copy recursively (-r option). With these options, a directory and all it contents can be copied to another directory.

ln

Creates a symbolic link to a file.

Usage and Example

Creates a symbolic link named symlink that points to the file test.

Typing “ls -i test symlink” will show the two files are different with different inodes.

Basic Unix Commands For Beginners Pdf

Typing “ls -l test symlink” will show that symlink points to the file test.

locate

A fast database driven file locator.

<! >

<! >

Usage

locate [options] name(s)

Basic Unix Administration Commands Pdf

Options

-q – to suppress error messages

-n – followed by an integer, this option limits the results to a specific number

-i – performs a case-insensitive search

Examples

>locate '*.png'

Diplays all the files that have .png file extension.

>locate -n 15 '*.html'

Displays 15 results from a search for files with .html extension

>locate -i '*.HtmL'

Returns all files with extensions .html, .HTML or any such similar combination.

Comments are closed.