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

Commands For Unix/Linux Operating Systems and Their Syntax: Filesystem Informational Text Filtering / Mutative

The document provides summaries of common Linux commands organized into categories including Filesystem, Informational, Filtering/Mutative, Networking, and Bash Shell commands. It lists the command name, a brief description of its usage, and examples of common flags and arguments.

Uploaded by

Eduardo Mora
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Commands For Unix/Linux Operating Systems and Their Syntax: Filesystem Informational Text Filtering / Mutative

The document provides summaries of common Linux commands organized into categories including Filesystem, Informational, Filtering/Mutative, Networking, and Bash Shell commands. It lists the command name, a brief description of its usage, and examples of common flags and arguments.

Uploaded by

Eduardo Mora
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Filesystem

cd [-] [directory] Change directory


-R :Change to the previous directory you were in

#nformational
cat [opts] [filepattern] Print file contents on S$%"$
-* -> -v :'isplay a = at the end o! each line. :"how ta s as ?I. :"how non-printing characters. date [opts] Print or set the system date and time --date3STRING :display time descri ed y STRING. --set3STRING :set time descri ed y STRING. dmesg [opts] Print or control the kernel ring &uffer -c :Clear the contents o! the ring u!!er. file [opts] [filepattern] 'etermine the file type -% :>ry to loo6 inside compressed !iles. finger [opts] [userpattern] Show info a&out system users -m :@atch the e+act username speci!ied. free [opts] 'isplay free and used memory in the system :'isplay the in!ormation in ytes. he(dump [opts] Show all the characters of a file -c :'isplay the input o!!set in he+idecimal last [opts] [username] Show last system logins for users -num :"how last num o! sessions. -a :'isplay the hostname in the last column. -d :>ranslates IP num ers to their hostname. -! <!ile> :;se !ile as last log. less [opts] [filepattern] )iew a file a page at a time -i :'o case insensitive searching. -" :'on.t wrap long lines. man [opts] [section] <manpage> )iew online manual pages. -a :<iew all availa le manual pages !or name. -6 string :"earch !or the speci!ied string. md*sum [opts] [filepattern] Show the uni+ueness of files ps [opts] Show what processes are running on the system a :"elect all processes on a terminal. u :'isplay user oriented !ormat. @ore columns. + :"elect processes without a controlling >>A. w :"how an e+tra line o! process entry per w. *+: ps au+www 3'isplays all process in!ormation on system. +uota [opts] [user] 'isplay disk usage and limits -v :'isplay !ilesystems where no Buota is set. time [opts] [command] Show resource usage for a command top [opts] 'isplay top CP" processes e ery , seconds -d sec :"et the delay to sec seconds e!ore re!reshing. umask [opts] [mode] Set the default file permissions -" :"how current sym olic umas6. uname [opts] Show %S and system information -a :"how everything uptime Show system uptime and load w [opts] [user] Show who is logged in/what they are doing whereis [command] Locate the related files for a command which [command] CShow full path to the specified command who [opts] [args] Show who is logged in

$e(t Filtering / Mutati e


awk [opts] [exp] pattern scanning and processing language
-9fs :"et the !ield separator !or commands. *+: cat accessDlog E aw6 F(print =1.G 7prints hostnames8 'o a (man aw6. !or more in!ormation and e+amples. comm [opts] [file1] [file2] Compare two sorted files -1 :"uppress lines uniBue to le!t !ile. -H :"uppress lines uniBue to right !ile. -I :"upress lines uniBue to oth !iles. csplit [opts] [file] [pattern] Split a file on conte(t -! prefix :;se prefix instead o! ++ in output !ilenames. -n digits :;se digits num er o! digits instead o! H. -% :Remove empty output !iles. *+: csplit mailspool!ile J,?9rom ,J FKG cut [opts] [filepattern] !emo e sections from each line -c range :&utput only the characters in range *+: cut -c 1-LM file 7truncate lines at LM characters8 diff [opts] [file1] [file2] 'ifferentiate two files *+: di!! program-old.c program.c > program.patch echo [opts] [string] Print a line of te(t -e :*na le interpretation o! ac6slashed seBuences. -n :'on.t automatically insert a newline character. grep [opts] [pattern] [file] Print lines matching pattern -N num :Print num lines o! leading conte+t on matches. -C num :Print num lines o! trailing conte+t on matches. -* :Interpret pattern as an e+tended regular e+pression -i :'o case insensitve matching. -l :Oust print the !iles that match the pattern. -r :Read all !iles under each directory recursively. -v :Print the lines that don.t match pattern. head [opts] [file] Print the first part of a file -n num :Print the !irst num lines instead o! the !irst 1M. nl [opts] [file] -um&er the lines of a file patch [opts] <[patchfile] Patch a file using a diff file sed [expression] [file] Stream editor *+: cat !ile E sed (s,frompattern,topattern,. > output sort [opts] [file] Sort lines of te(t files -n :Compare according to string numerical value. -r :Reverse the result o! comparisons. split [opts] [file] Split a file into pieces -l num :Put num lines per output !ile. tail [opts] [file] Print the last lines of a file -! :&utput appended data as the !ile grows. -n num :Print last num lines o! a !ile instead o! last 1M tr [opts] <set1> [set2] $ranslate char. from set. to set/ *+: cat inde+.html E tr P-Q a-% > inde+-new.html uni+ [opts] [input] [output] !emo e duplicate lines -c :Pre!i+ lines with num er o! occurances. -d :&nly print duplicated lines. -u :&nly print uniBue lines. wc [opts] [file] Print the num&er of lines in files0 etc. -m :Print the character count. -l :Print the line count. -w :Print the word count. -5 :Print the length o! the longest line.

chmod [opts] <mode> <filepattern> Change permissions


:Change permissions recursively chown [-R] <user>[.group] <file> Change ownership -R :Change ownership recursively cp [opts] <from> <to> Copy files and directories -i :Interactive mode. Prompt e!ore overwriting -p :Preserve !ile permissions and ownership -R :Copy directories recursively df [opts] [device name] Print filesystem usage info -a :"how all !ilesystems. -h :#uman reada le !ormat. $uanti!y yte in!ormation. -i :"how inode usage in!o. du [opts] [pattern] Show space usage on files and dirs -c :Produce a grand total !or all arguments. -h :#uman reada le !ormat. $uanti!y yte in!ormation. -s :"ummari%e. &nly show a total !or each argument. -" :'o not include si%e o! su directories. find <path> [-name (pattern)] Search for a file. *+: !ind ,home -name (inde+.html. -perms -/00 -ls gzip [opts] <filepattern> Compress a file or files -1..2 : "et compression level. 23highest4 13lowest. -d :'ecompress !ile. "ame as the gunzip command. -l :5ist the statistics !or a compressed !ile. ln [opts] <tofile> <linkfile> Create a sym/hard link -s :Create a sym olic lin6 etween !iles. 7alias name8 -! :9orce creation4 even i! the lin6 !ile e+ists. ls [opts] [pattern] List file and directory entries -a :5ist all !iles including . and .. -d :5ist directories themselves4 not their contents. -l :5ong list. "hows permissions and modi!ied time. -r :Recusively list !iles in directories. -" :"ort output y !ile si%e. -u :"ort y the last access time. -: :"ort y !ilename e+tension. -1 :Print output !iles one per line. --time3atime :"how last access timestamp !or !ile. mkdir [opts] <dirname> Make a new directory -m mode: "et the initial permissions to mode. -p :Create parent directories i! they don.t e+ist. m [-i] <frompattern> <tofile> Mo e/!ename a file -i :Interactive move. Prompt e!ore moving !iles. rm [opts] <filepattern> !emo e a file -! :9orce removal. 'on.t as6 i! it.s o6 to remove. -i :Interactive remove. Prompt e!ore each !ile. -r :Recusively delete directories an their contents. tar [opts] [tarfile] [pattern] Create an archi e c :Create mode. Create a tar archive. + :*+tract mode. ;ntar archive contents. t :5ist mode. 5ist the contents o! the archive. ! :"peci!y a tar!ile to use. v :<er ose mode. "how !iles eing added or untared. % :Compress. 9ilter input,output through g%ip. touch [opts] <pattern> "pdate the timestamp on a file -a :&nly change the access time on the !ile. -t :"peci!y a timestamp to use instead o! current time

-etwork
ifconfig [devicename] [action] [options] ipchains [opts] Manip. ipchains firewall1kernel /./23 ipta&les [opts] Manip. ipta&les firewall1kernel /.423 mail [opts] [address] Send mail from the command line 8

7ash Shell
Send S$'%"$ to a file. o erwrite/create a file *+: ls -l > list-o!-!iles.t+t >new!ile 88 Send S$'%"$ to a file0 appending to te end of the file *+: ps au+ > pslog.t+t date >> pslog.t+t 9 Send the S$'%"$ from a command to the S$'#- of another *+: cat listo!names E sort cat accessDlog E aw6 F(print =1.G E sort E uniB /8 Send S$':!! to a file0 o erwriting the filename *+: start+ H> .errorlog alias Create a command alias in the shell *+: alias ls3.ls -la --color3auto. cd [-] [directory] Change the current working directory - :Change to the previous directory you were in. clear Clear the terminal display en [opts] [command] !un command in modified en ironment e(port [opts] [variable] :(port an en ironment aria&le *+: e+port >*R@ ;"*RXP@* P"1 @PI5"P&&5 e+port >*R@3vt1MM for :(ecute se+uence of commands for a list of items *+: !or i in K.mpI Z do mpg1HI =i Z done !or n in 1 H I 0 Z do m6dir =n Z done history Show the command history up til now nice [opts] [command] Set the %S process priority *+: nice 12 g%ip accessDlog 7lowest priority on 5inu+8 *+: nice -HM 6swapd 7real time priority on 5inu+8 pwd Print out the current working directory renice [opts] <arg> Change priority of a running process -p %I&: "peci!y a process id to renice *+: = ps au+w E grep g%ip 6319 ? S 0:20 gzip bigfile.txt = renice 12 -p /I12 reset #nitializes the terminal as if you ;ust logged in set Set a shell option or aria&le 1run <help set=3 sleep Pause for specified period &efore continuing *+: ps au+ Z sleep I/MM Z ps au+ umask Set the default file permissions *+: umas6 MHH 7!iles will e created /00 y de!ault.8 while > loop that runs commands while a condition is true *+: while 7true8 Z do ps au+w Z sleep 1m Z done > pslog (args [opts] [command] :(ecute a command for each arg -n number :#ow many arguments to give each command run. -p :Prompt the user e!ore each command is run. -d -g -[ -s

>dmin
adduser [opts] <username> >dd a user to the local system
<dir> : "et the home directory !or the user to dir. <group> : "et the primary group !or the user to group. <group4group4'> : "et additional groups !or the user. <shell> : "et the de!ault shell !or the user to shell. chfn Change the finger information for a user chsh Change the shell used for the user ed+uota [opts] <user> :dit a user=s or group=s +uota -g : *dit the group Buota instead o! user Buota. kill [-signal] <pid> $erminate a process/Send it a signal -#;P4-1 : "ignal usually ma6es process to reread con!ig. -2 :"end a "I[\I554 process must die. -l :Print a list o! signal names and num ers. killall [-signal] [name]?ill processes &y name -e :ReBuire an e+act name o! a process. -i :Interactively as6 !or con!irmation e!ore 6illing. ldd [opts] [program] Show a programs li&rary dependencies mount [opts] <device> [mountpoint] Mount a file system -o <opts> : "peci!y options !or mounting. 5isted elow.
loop remount ro4 rw user @ount a dis6 !ile such as a C'-R&@ image or !loppy image. Remount the !ilesystem with new options @ount !ilesystem in readonly or read-write mode. Pllow normal users to mount this !ilesystem.

-s sub ect :"peci!y the su Rect as sub ect. -c list :"end car on copy to list o! users. - list :"end lind car on copy to list o! users. *+: echo S@eet me at noon.T E mail -s SReminderT -c U o Vcompany.com4su%yVcompany.com Rac6Vcompany.com netstat [opts] Print network connections and info -a :"how oth listening and non-listening soc6ets. -n :'o not attempt to resolve IP addresses. -t :&nly show tcp soc6et connection ta le. ping [opts] [host] Send #CMP packets to network hosts -c count :"end count num er o! pac6ets and then Buit. -i sec :Wait sec seconds etween sending pac6ets. route [opts] [target] Show/Manipulate #P routing ta&le -n :"how numerical addresses instead o! hostnames. scp [opts] [[host!]fromfile] [[host!]to] Secure copy -C :Compresses the data that is sent over the session. -r :Recursively copy directories. ssh [opts] [[user"]host] [command] Secure shell/login -C :Compresses the data that is sent over the session. sniffit [opts] !ecord $CP network traffic -i :Interactive mode. "hows all tra!!ic. -l <length> :"et the ma+imum sni!! length to length. -p <port> :"peci!y the port num er on the target host. -s <source> :"et the source IP !rom which pac6ets come. -t <target> :"et the IP to which pac6ets are going. tcpdump [opts] [expression] 'ump traffic on a network telnet [opts] [host] [port] %pen $CP socket to a host -n <!ile> : &pens file !or recording trace in!ormation. -+ :>urns on encryption o! the data stream i! possi le. traceroute [opts] [host] Show the route packets take -n :'on.t do 'X" loo6ups o! the IP addresses. wget [opts] [#R$] Make a 5$$P re+uest from the shell -r :Recursive get the ;R5 and all it.s lin6s. -6 :Convert the non-relative lin6s to relative ones. whois [opts] <arg["server]> C6uery a whois data&ase *+: whois domain.com whois domain.comVwhois.networ6solutions.com whois 1HY.M.M.1Varin.net

-r :@ount the !ilesystem read-only. "ame as (-o ro. -t <vfstype> :"peci!y the type o! !ilesystem to mount.
e+tH4 e+tI v!at iso2//M n!s Xative 5inu+ partition types. Windows 2+ IH- it partition type. C'-R&@ !ilesystem. Xetwor6 remote !ilesystem.

passwd [opts] [username]Change user=s system password


-l :5oc6 the password !or the account. -u :;nloc6 the password !or the account. -" :"how the status o! the password !or the account. su [-] [username] Switch users or login as the superuser - :@a6e shell a login shell -c <command> : Run command as username. umount [opts] [path,device]"nmount a mounted filesystem -! :9orce unmounting 7in case o! unreacha le X9" system8.

Most commands accept the use of v, -h or help for displaying verbose information and help information. Commands and options displayed in red can only be used by the superuser (root).

Commands for Unix/Linux operating systems and their syntax


his !uic" info sheet is Copyright #$$% & by 'uso (anderas. )or more information, do*nloads, ordering and the original .doc file that created this sheet, please visit http://suso.suso.org/docs/infosheets/ on the *eb.

You might also like