0% found this document useful (0 votes)
95 views

Mkdir (Option) Directory

The document provides summaries of common Linux commands and their usage including: mkdir creates new directories; cd changes the current directory; mv renames files or directories; pwd prints the current working directory; rmdir removes empty directories; and chown changes file ownership and permissions. Common commands for working with files include cp to copy files, ln to create symbolic links, locate to search for files, more/less to view file contents, cat to output file contents, and wc to count lines, words and bytes. Commands for managing running processes include bg to run jobs in the background, fg to bring jobs back to the foreground, kill to terminate processes, and top to view currently active processes. Additional commands provide

Uploaded by

mrinalmishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views

Mkdir (Option) Directory

The document provides summaries of common Linux commands and their usage including: mkdir creates new directories; cd changes the current directory; mv renames files or directories; pwd prints the current working directory; rmdir removes empty directories; and chown changes file ownership and permissions. Common commands for working with files include cp to copy files, ln to create symbolic links, locate to search for files, more/less to view file contents, cat to output file contents, and wc to count lines, words and bytes. Commands for managing running processes include bg to run jobs in the background, fg to bring jobs back to the foreground, kill to terminate processes, and top to view currently active processes. Additional commands provide

Uploaded by

mrinalmishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

mkdir - make directories

Usage
mkdir [OPTION] DIRECTORY
Options
Create the DIRECTORY (ies), i the! do not a"read! e#ist$
%andator! arg&ments to "ong options are mandator! or short options
too$
'm, mode(%ODE set permission mode (as in )hmod), not r*#r*#r*# '
&mask
'p, parents no error i e#isting, make parent dire)tories as needed
'+, +er,ose print a message or ea)h )reated dire)tor!
'he"p disp"a! this he"p and e#it
'+ersion o&tp&t +ersion inormation and e#it
cd - change directories
Use )d to )hange dire)tories$ T!pe )d o""o*ed ,! the name o a
dire)tor! to a))ess that dire)tor!$ -eep in mind that !o& are a"*a!s in
a dire)tor! and )an na+igate to dire)tories hierar)hi)a""! a,o+e or
,e"o*$
mv- change the name of a directory
T!pe m+ o""o*ed ,! the )&rrent name o a dire)tor! and the ne* name
o the dire)tor!$
E#. m+ testdir ne*namedir
pwd - print working directory
/i"" sho* !o& the &"" path to the dire)tor! !o& are )&rrent"! in$ This is
+er! hand! to &se, espe)ia""! *hen perorming some o the other
)ommands on this page
rmdir - Remove an existing directory
rm -r
Remo+es dire)tories and 0"es *ithin the dire)tories re)&rsi+e"!$
chown - change fle owner and group
Usage
)ho*n [OPTION] O/NER[.[1ROUP]] 2I3E
)ho*n [OPTION] .1ROUP 2I3E
)ho*n [OPTION] ''reeren)e(R2I3E 2I3E
Options
Change the o*ner and4or gro&p o ea)h 2I3E to O/NER and4or
1ROUP$ /ith ''reeren)e, )hange the o*ner and gro&p o ea)h 2I3E to
those o R2I3E$
'), )hanges "ike +er,ose ,&t report on"! *hen a )hange is made
'dereeren)e a5e)t the reerent o ea)h s!m,o"i) "ink, rather than the
s!m,o"i) "ink itse"
'h, no'dereeren)e a5e)t ea)h s!m,o"i) "ink instead o an! reeren)ed
0"e (&se&" on"! on s!stems that )an )hange the o*nership o a
s!m"ink)
'rom(CURRENT6O/NER.CURRENT61ROUP
)hange the o*ner and4or gro&p o ea)h 0"e on"! i its )&rrent o*ner
and4or gro&p mat)h those spe)i0ed here$ Either ma! ,e omitted, in
*hi)h )ase a mat)h is not re7&ired or the omitted attri,&te$
'no'preser+e'root do not treat 849 spe)ia""! (the dea&"t)
'preser+e'root ai" to operate re)&rsi+e"! on 849
', 'si"ent, '7&iet s&ppress most error messages
'reeren)e(R2I3E &se R2I3E9s o*ner and gro&p rather than the
spe)i!ing O/NER.1ROUP +a"&es
'R, 're)&rsi+e operate on 0"es and dire)tories re)&rsi+e"!
'+, '+er,ose o&tp&t a diagnosti) or e+er! 0"e pro)essed
The o""o*ing options modi! ho* a hierar)h! is tra+ersed *hen the 'R
option is a"so spe)i0ed$ I more than one is spe)i0ed, on"! the 0na" one
takes e5e)t$
': i a )ommand "ine arg&ment is a s!m,o"i) "ink to a dire)tor!,
tra+erse it
'3 tra+erse e+er! s!m,o"i) "ink to a dire)tor! en)o&ntered
'P do not tra+erse an! s!m,o"i) "inks (dea&"t)
chmod - change fle access permissions
Usage
)hmod ['r] permissions 0"enames
r Change the permission on 0"es that are in the s&,dire)tories o the
dire)tor! that !o& are )&rrent"! in$ permission ;pe)i0es the rights
that are ,eing granted$ <e"o* is the di5erent rights that !o& )an grant
in an a"pha n&meri) ormat$0"enames 2i"e or dire)tor! that !o& are
asso)iating the rights *ith Permissions
& ' User *ho o*ns the 0"e$
g ' 1ro&p that o*ns the 0"e$
o ' Other$
a ' =""$
r ' Read the 0"e$
* ' /rite or edit the 0"e$
# ' E#e)&te or r&n the 0"e as a program$
N&meri) Permissions.
C:%OD )an a"so to attri,&ted ,! &sing N&meri) Permissions.
>?? read ,! o*ner
?>? read ,! gro&p
??> read ,! an!,od! (other)
@?? *rite ,! o*ner
?@? *rite ,! gro&p
??@ *rite ,! an!,od!
A?? e#e)&te ,! o*ner
?A? e#e)&te ,! gro&p
??A e#e)&te ,! an!,od!
ls - Short listing of directory contents
'a "ist hidden 0"es
'd "ist the name o the )&rrent dire)tor!
'2 sho* dire)tories *ith a trai"ing 949
e#e)&ta,"e 0"es *ith a trai"ing 9B9
'g sho* gro&p o*nership o 0"e in "ong "isting
'i print the in ode n&m,er o ea)h 0"e
'" "ong "isting gi+ing detai"s a,o&t 0"es and dire)tories
'R "ist a"" s&,dire)tories en)o&ntered
't sort ,! time modi0ed instead o name
cp - Copy fles
)p m!0"e !o&r0"e
Cop! the 0"es Cm!0"eC to the 0"e C!o&r0"eC in the )&rrent *orking
dire)tor!$ This )ommand *i"" )reate the 0"e C!o&r0"eC i it doesn9t e#ist$
It *i"" norma""! o+er*rite it *itho&t *arning i it e#ists$
)p 'i m!0"e !o&r0"e
/ith the C'iC option, i the 0"e C!o&r0"eC e#ists, !o& *i"" ,e prompted
,eore it is o+er*ritten$
)p 'i 4data4m!0"e
Cop! the 0"e C4data4m!0"eC to the )&rrent *orking dire)tor! and name
it Cm!0"eC$ Prompt ,eore o+er*riting the 0"e$
)p 'dpr sr)dir destdir
Cop! a"" 0"es rom the dire)tor! Csr)dirC to the dire)tor! CdestdirC
preser+ing "inks ('poption), 0"e attri,&tes ('p option), and )op!
re)&rsi+e"! ('r option)$ /ith these options, a dire)tor! and a"" it
)ontents )an ,e )opied to another dir
ln - Creates a symbolic link to a fle.
"n 's test s!m"ink
Creates a s!m,o"i) "ink named s!m"ink that points to the 0"e test
T!ping C"s 'i test s!m"inkC *i"" sho* the t*o 0"es are di5erent *ith
di5erent inodes$ T!ping C"s '" test s!m"inkC *i"" sho* that s!m"ink points
to the 0"e test$
locate ' = ast data,ase dri+en 0"e "o)ator$
slocate -u
This )ommand ,&i"ds the s"o)ate data,ase$ It *i"" take se+era" min&tes
to )omp"ete this )ommand$This )ommand m&st ,e &sed ,eore
sear)hing or 0"es, ho*e+er )ron r&ns this )ommand periodi)a""! on
most s!stems$"o)ate *hereis 3ists a"" 0"es *hose names )ontain the
string C*hereisC$ dire)tor!$
more - =""o*s 0"e )ontents or piped o&tp&t to ,e sent to the s)reen
one page at a time
less - Opposite o the more )ommand
cat ' ;ends 0"e )ontents to standard o&tp&t$ This is a *a! to "ist the
)ontents o short 0"es to the s)reen$ It *orks *e"" *ith piping$
whereis ' Report a"" kno*n instan)es o a )ommand
wc - Print ,!te, *ord, and "ine )o&nts
bg
,g Do,s P"a)es the )&rrent Do, (or, ,! &sing the a"ternati+e orm, the
spe)i0ed Do,s) in the ,a)kgro&nd, s&spending its e#e)&tion so that a
ne* &ser prompt appears immediate"!$ Use the Do,s )ommand to
dis)o+er the identities o ,a)kgro&nd Do,s$
cal month year ' Prints a )a"endar or the spe)i0ed month o the
spe)i0ed !ear$
cat fles ' Prints the )ontents o the spe)i0ed 0"es$
clear - C"ears the termina" s)reen$
cmp fle1 fle - Compares t*o 0"es, reporting a"" dis)repan)ies$
;imi"ar to the di5 )ommand, tho&gh the o&tp&t ormat di5ers$
di! fle1 fle ' Compares t*o 0"es, reporting a"" dis)repan)ies$
;imi"ar to the )mp )ommand, tho&gh the o&tp&t ormat di5ers$
dmesg - Prints the messages res&"ting rom the most re)ent s!stem
,oot$
fg
g Do,s ' <rings the )&rrent Do, (or the spe)i0ed Do,s) to the oregro&nd$
fle fles - Determines and prints a des)ription o the t!pe o ea)h
spe)i0ed 0"e$
fnd path -name pattern -print
;ear)hes the spe)i0ed path or 0"es *ith names mat)hing the spe)i0ed
pattern (&s&a""! en)"osed in sing"e 7&otes) and prints their names$ The
0nd )ommand has man! other arg&ments and &n)tionsE see the on"ine
do)&mentation$
fnger users - Prints des)riptions o the spe)i0ed &sers$
free - Disp"a!s the amo&nt o &sed and ree s!stem memor!$
ftp hostname
Opens an 2TP )onne)tion to the spe)i0ed host, a""o*ing 0"es to ,e
transerred$ The 2TP program pro+ides s&,)ommands or
a))omp"ishing 0"e transersE see the on"ine do)&mentation$
head fles - Prints the 0rst se+era" "ines o ea)h spe)i0ed 0"e$
ispell fles - Che)ks the spe""ing o the )ontents o the spe)i0ed 0"es$
kill process"ids
ki"" ' signa" pro)ess6ids
ki"" '"
-i""s the spe)i0ed pro)esses, sends the spe)i0ed pro)esses the
spe)i0ed signa" (gi+en as a n&m,er or name), or prints a "ist o
a+ai"a,"e signa"s$
killall program
ki""a"" ' signa" program
-i""s a"" pro)esses that are instan)es o the spe)i0ed program or sends
the spe)i0ed signa" to a"" pro)esses that are instan)es o the spe)i0ed
program$
mail - 3a&n)hes a simp"e mai" )"ient that permits sending and
re)ei+ing emai" messages$
man title
man se)tion tit"e ' Prints the spe)i0ed man page$
ping host ' ;ends an e)ho re7&est +ia TCP4IP to the spe)i0ed host$ =
response )on0rms that the host is operationa"$
reboot ' Re,oots the s!stem (re7&ires root pri+i"eges)$
shutdown minutes
sh&tdo*n 'r min&tes
;h&ts do*n the s!stem ater the spe)i0ed n&m,er o min&tes e"apses
(re7&ires root pri+i"eges)$ The 'r option )a&ses the s!stem
to ,e re,ooted on)e it has sh&t do*n$
sleep time - Ca&ses the )ommand interpreter to pa&se or the
spe)i0ed n&m,er o se)onds$
sort fles - ;orts the spe)i0ed 0"es$ The )ommand has man! &se&"
arg&mentsE see the on"ine do)&mentation$
split fle - ;p"its a 0"e into se+era" sma""er 0"es$ The )ommand has
man! arg&mentsE see the on"ine do)&mentation
sync - Comp"etes a"" pending inp&t4o&tp&t operations (re7&ires root
pri+i"eges)$
telnet host ' Opens a "ogin session on the spe)i0ed host$
top - Prints a disp"a! o s!stem pro)esses that9s )ontin&a""! &pdated
&nti" the &ser presses the 7 ke!$
traceroute host ' Uses e)ho re7&ests to determine and print a
net*ork path to the host$
uptime - Prints the s!stem &ptime$
w - Prints the )&rrent s!stem &sers$
wall - Prints a message to ea)h &ser e#)ept those *ho9+e disa,"ed
message re)eption$ T!pe Ctrl-# to end the message$

You might also like