Linux Command List - The Overnight Admin



L

|Cd |Cal |Rmdir |Uptime |

|Changes the Directory |Display a calendar |Remove folder(s) |Displays all the time information. |

|Location: |Location: /usr/bin/cal |Location:/bin/ |Location: /usr/bin/uptime |

|Syntax: cd [directory] |Syntax: cal [month] [year] |Syntax: |Syntax: uptime [-V] |

|cd../home/users/computerhope |cal |rmdir [option]…directory… |uptime –v |

|The above example would go back one |Gives you the calendar for this month.|rmdir /lib |will display the version |

|directory and then go into the |Cal 12 2000 |will delete the /lib directory |information. |

|home/users/computerhope directory. |Gives you the calendar for December of|rmdir c:\test /s |uptime |

|cd ../../ |2000. |remove the directory and all files in|Will display details about how long|

|The above example would go back two |cal 1 2011 |it. |your server has been up and |

|directories. |displays the month of January, 2011. |Rmdir c:\test –q |running, and how many users are |

|Cd | |will do a quiete deletion.(no |logged in, and system load averages|

|Cd alone will move you into the home | |questions asked.) |for the past 1, 5, and 15 minutes. |

|directory. | | |Man uptime |

| | | |Displays the manual for the uptime |

| | | |command. |

|Ls |Man |Mv |Free |

|List information about file(s) |Help manual |Move or rename files or directories |Display memory usage |

|Location: /bin/ls |Location:/usr/bin/man |Location: /bin/mv |Location: /usr/bin/free |

|Syntax: ls [-a] [-A] [-b] [-c] [-C] [-d] |Syntax: man [-] [-k keywords] topic |Syntax: mv [-f] [-i] oldname newname |Syntax: free [-b | -k | -m] [-o] |

|[-f] [-F] [-g] [-i] [-l] [-L] [-m] [-o] |man –k cal |mv oldname newname |[-s delay ] [-t] [-V] |

|[-p] [-q] [-r] [-R] [-s] [-t] [-u] [-x] |will seach for the keyword cal in all |Will rename that file in that |free –V |

|[pathnames] |manuals. |directory. |Will display version information. |

|ls/ |man mkdir |mv –f oldname newname |free –s |

|Lists the documents of your root directory|lists help information on the mkdir |Will rename file without asking you. |Will switch activates continuous |

|ls */ |command. |mv –I oldname newname |polling delay. |

|Lists the contents of all sub directories.|man –k irc |Will prompt you before overwriting |free –t |

|ls –laxo |quickly searches for manuals |another file |Will switch display line containing|

|Lists files with permissions, shows |containing irc within them. | |the totals. |

|hidden, displays in a column format, and | | |free –b |

|doesn’t show the group. | | |Will show space in bytes |

| | | |free –k |

| | | |Will display it in kilobytes. |

|Pwd |Info |Cp |Vmstat |

|Print Working Directory |Location: /usr/bin/info |Copy one or more files to another |Report virtual memory statistics |

|Location:/bin/pwd |Syntax: info [option] . . . |location. |Location: /usr/bin/vmstat |

|Syntax: pwd [option] |[menu-iteam…] [-k] [-d] [-f] [-h] |Location:/bin/co |Syntax: vmstat [-V] [-n] [delay |

|pwd |info info |Syntax: cp [OPTION]... SOURCE DEST |[count]] |

|Will display /etc in the prompt. |show the general manual for info |cp [OPTION]... SOURCE... DIRECTORY |vmstat |

|man pwd |readers |cp [OPTION]... |Running vmstat command with no |

|Will display the manual for the pwd |info emacs |--target-directory=DIRECTORY |extra options would display |

|command. |start the emacs node from top-level |SOURCE... |information about memoty, swap, io,|

|pwd –P |dir |cp file1.txt newdir |system, and CPU |

|Will print the working directory, without |info –show-options emacs |Copies the file1.txt in the current |vmstat –V |

|displaying all symlinks. |Start at node with emacs’ command line|directory to the newdir directory. |Prints version information onto |

|pwd –L |options |cp *.txt newdir |screen. |

|Use pwd from environment, even if it | |Copies all files ending in .txt into |vmstat –d |

|contains symlinks. | |newdir directory. |Prints disk statistics to the |

| | |cp –r /home/hope.files/* |screen |

| | |/home/hope/files2 | |

| | |copies all the files, directories, | |

| | |and subdirectories in the files | |

| | |directory into the backup directory. | |

|Who |Cat |Tar |Id |

|Print all usernames currently logged in |Concatenate and print (display) the |Tape Archiver |Print user and group id's |

|Location: /usr/bin/who |content of files |Location: /bin/tar |Location: /usr/bin/id |

|Syntax: who [option] . . . [file | arg1 |Location:/bin/cat |Syntax: tar c [ bBeEfFhiklnopPqvwX [ |Syntax: id [-a] [-G] [-g] [-u] |

|arg2] |Syntax: cat filename [-n] [-b] [-u] |0-7 ] ] [ block ] [ tarfile ] [ |[user] |

|who –r |[-s] [-v] |exclude-file ] {-I include-file | -C |info id |

|Will display the run-level of each user. |cat file1.txt file2.txt > file3.txt |directory | file | file } |Should give you access to the |

|who –b |reads file1.txt and file2.txt and |tar r [ bBeEfFhiklnqvw [ 0-7 ] ] [ |complete manual. |

|Will indicate the time and date of the |combines those files to make |block ] {-I include-file | -C |id –g |

|last reboot |file3.txt. |directory | file | file } |Print only effective group ID. |

|who –s |cat food |tar t [ BefFhiklnqvX [ 0-7 ] ] [ |id –G |

|(Default) lists only the name, line, and |will display the cat file to the |tarfile ] [ exclude-file ] {-I |Prints all group IDs |

|time fields. |screen. |include-file | file } ... | |

| |cat eats bird > detailsat11 |tar u [ bBeEfFhiklnqvw [ 0-7 ] ] [ | |

| |Join the files eat and bird into |block ] [ tarfile ] file ... tar x [ | |

| |detailsat11. |BefFhiklmnopqvwX [ 0-7 ] ] [ tarfile | |

| | |] [ exclude-file ] [ file ... ] | |

| | |Tar –cvwf file.tar myfile.txt | |

| | |Creates a tar named file.tar in the| |

| | |directory you are currently in. | |

| | |-xvwf myfile.tar | |

| | |Uncompress (untar) the myfile.txt | |

| | |file in the current directory. | |

| | |Tar –xvwzf myfile.tar.gz | |

| | |Uncompress the myfile.tar.gz file | |

| | |in the current directory. | |

|Whoami |Head |Gzip |Shutdown |

|Print the current user id and name |Output the first part of file(s) |Compress or decompress named file(s) |Shutdown or restart linux |

|Location: /usr/bin/whoami |Location: /usr/bin/head |Location: /usr/bin/gzip |Location: /sbin/shutdown |

|Syntax: whoami [option] |Syntax: head [-number | -n number] |Syntax: gzip [ -acdfhlLnNrtvV19 ] [-S|Syntax: shutdown [-a][-t |

|whoami |filename. |suffix] [ name ... ] |sec][-krhnfFc][time][warning-messag|

|will display the name of the current |head -15 myfile.txt |gunzip [ -acfhlLnNrtvV ] [-S suffix] |e] |

|directory. |will display the first ten lines of |[ name ... ] |shutdown 8:00 |

|If you are logged on as Root and type |myfile.txt |zcat [ -fhLV ] [ name ... ] |Shutdown computer at 8-oclock |

|whoami it will say you are logged onto the|head myfile.txt | |shutdown –t sec |

|root account. |Will show the first 10 lines in | |Tells init to wait sec seconds |

|whoami –version |myfile.txt | |between sending processes the |

|Will output the version information and |head -n number | |warning and the kill signal, before|

|exit. |Shows the number of lines you chose | |changing to another run-level. |

|whoami –help |for it to display. | |shutdown –h |

|Displays the help and exit | | |Halts after shutdown. |

|su and/or sux |Tail |bzip/bzip2 |Halt |

|Substitute user identity(become super |Output the last part of files |Compress or decompress named file(s) |Reboot, poweroff – stop the |

|user) |Location: /usr/bin/tail |Location: /usr/bin/bzip2 |Location: /sbin/halt |

|Location: /bin/su |Syntax: tail [+ number] [-l] [-b] [-c]|Syntax: bzip2 |Syntax: halt [-l] [-n] [-q] [-y] |

|Syntax: su [ - ] [username [arg] ] |[-r] [-f] [-c number | -n number] |[-cdfkqstvuzVL123456789] [filenames. |  or |

|su – hope |[file] |. .] |halt [-n] [-w] [-d] [-f] [-i] [-p] |

|Login as the user hope, if she is logged |tail myfile.txt |bzip2 –f [filename] |[-h] reboot [-n] [-w] [-d] [-f] |

|in. |The above example would list the last |Forces overwrite of output files. |[-i] |

|su – hope |10 (default) lines of the file |bzip2 –t filname |poweroff [-n] [-w] [-d] [-f] [-i] |

|This will pass the environment along |myfile.txt. |Check integrity of the specified |[-h] |

|unchanged as if the user actually logged |tail –f myfile.txt |files, but don’t decompress them. |halt |

|in as the specified user. |Displays the last 10 lines and then |bzip2 –q filename |Set the computer to a mode that |

|su hope arg |update the file as new lines are being|suppress non-essential warning |enables a user to turn off the |

|Logs in as hope and additional arguments |added. This is a great command to |messages. Will still display I/O |computer. |

|that need to be passed through the su |watch log files or logs in real-time. |errors. |halt –q |

|command. |tail –f access.log |grep 24.10.160.10 | |Quick halt. No graceful shutdown |

| |Allows you to watch the access.log foe| |required. |

| |any IP address of 24.10.160.10 | |halt –l |

| | | |Suppresses sending a message to |

| | | |the system log deamon, syslogd, |

| | | |about who executed halt. |

| | | |poweroff |

| | | |Stops the processor (if you have |

| | | |the right permissions). |

|Whatis |Less |Grep |Kill |

|Display manual page descriptions. |Display output one screen at a time |Search file(s) for lines that match a|Stop a process from running |

|Location: /usr/bin/whatis |Location: /usr/bin/less |given pattern |Location: /bin/kill |

|Syntax: whatis [-dlhV] [-r|-w] [-s |Syntax: less -? |Location: /usr/bin/grep |Syntax: kill [-s] [-l] %pid |

|section] [-m system[,…]] [-M path] [-L |less --help |Syntax: grep [options] PATTERN |kill –s |

|locale] [-C file] name… |less -V |[FILE...] |Specify the signal to send. |

|whatis –d |less --version |grep [options] [-e PATTERN | -f FILE]|kill –l |

|prints debugging information to the |less [- |[FILE...] |Write all values of signal |

|screen. |[+]aBcCdeEfFgGiIJmMnNqQrRsSuUVwWX] |grep –a |supported ny the implementation. |

|whatis –M manpath –w ‘*’ | sort > |[-b space] [-h lines] [-j line] [-k |Processs a binary file as if it were |kill –pid |

|manpath/whatis |keyfile] |text; this is equivalent to |You can specify a decimal integer |

|Produces an old style text whatis database|[-{oO} logfile] [-p pattern] [-P |the—binary-files=text option |which specifies a process or group |

|from relative index database. |prompt] [-t tag] |grep –b |of processes, or a job control ID |

|whatis –V |[-T tagsfile] [-x tab,...] [-y lines] |Prints the byte offset within the |that identifies a background |

|Will display the version information to |[-[z] lines] |input file before each line of the |process group to be signaled. |

|the output of the monitor. |[+[+]cmd] [--] [filename]... |output. | |

| |less –j |grep –V | |

| |Displays the status column at the left|Prints the version number of grep to | |

| |edge of the screen. |standard error. | |

| |less –V | | |

| |Displays the version number of less. | | |

| |less table1 | | |

| |Will display the top of file table1 | | |

|Whereis |More |Ln |Ifconfig |

|Search the user's $path, man pages and |Display output one screen at a time |Make links between files |Configure a network interface |

|source files for a program |Location: /bin/more |Location: /bin/ln |Location: /sbin/ifconfig |

|Location:/usr/bin/whereis |Syntax: more [-c] [-d] [-e] [-f] [-i] |Syntax: ln [-f] [-n] [-s] |Syntax: ifconfig [-L] [-m] |

|Syntax: whereis [ -bmsu ] [ -BMS |[-l] [-n number] [-p command] [-r] |existingfile newname |interface [create] |

|directory... -f ] filename ... |[-s] [-t tagstring] [-u] [-w] [ -lines|ln –n |[address_family] |

| |] [ + linenumber ] [ +/ pattern ] [ |Will not overwrite existing files. |[address[/prefixlength] |

|whereis –b |file ... ] |ln –s |[dest_address]] [parameters] |

|Searches only for binaries. |more –c |Makes it so that it does not create a|ifconfig interface destroy |

|whereis –m |Clear before displaying. Redraws the |symbolic link existing file – the |ifconfig -a [-L] [-d] [-m] [-u] |

|Searches only for manual sections. |screen instead of scrolling for faster|file that you want to create a link |[address_family] |

|whereis –s |displays. |to. |ifconfig -l [-d] [-u] |

|Searches only for sources. |more –e |ln –f |[address_family] |

| |Exit immediately after writing the |Will link files without questioning |ifconfig [-L] [-d] [-m] [-u] [-C] |

| |last line of the last file in the |the user, even if the mode of the |ifconfig add |

| |argument list. |target forbids writing. This is |Another name for alias parameter. |

| |more –i |default in the standard input is not |ifconfig –interface |

| |Perform pattern matching in searches |a terminal. |This parameter is a string of the |

| |without regard to case. | |form ‘ ‘ name unit”’ for example, ‘|

| | | |‘ en0”. |

| | | |ifconfig remove |

| | | |Another name for the –alias |

| | | |parameter. |

|Which |Vi |Type |Alias |

|Search the user's $path for a program file|Text Editor |Describe a command |Create an alias |

|Location: /usr/bin/which |Location: /usr/bin/vi |Location: a shell builtin |Location: a shell builtin |

|Syntax: which [ filename ] ... |Syntax: vi [ -| -s ] [-l] [-L] [-R] [ |Syntax: touch [-a] [-c] [-m] [-r |Syntax: alias [name=['command']] |

|which pearl |-r [ filename ] ] [-S] [-t tag] [-v] |ref_file | -t time ] file |alias home ‘cd public_html’ |

|Would locate the executable location of |[-V] [-x] [-w] [-n ] [-C] [+command | |settime [ -f ref_file ] file |Sets home to type cd public_html |

|the pearl command |-c command ] filename |touch newfile.txt |alias |

|which -a |vi myfile.txt |Creates a file known as |this command by itself lists all |

|prints all matching executables in PATH, |Will edit the file myfile.txt |:newfile.txt”, if the file does not |the aliases we have created. |

|not just the first one. |vi- | -s myfile.txt |already exists. If the file already |alias ll |

|which() { declare –f |which |Suppress all interactive user |exists the accessed / modification |alias ll=’ls –l’ |

|–read-functions $@ } |feedback. this is useful when |time is updated for the file |Will show a long colored listing of|

|Will read shell function definitions from |processing editor scripts |newfile.txt |all the created aliases. |

|stdin, reporting matching ones on stdout. |vi –R myfile.txt |touch –a myfile.txt | |

| |readonly mode; the readonly flag is |Will change the access time of the | |

| |set, preventing accidental overwriting|file. Do not write any diagnostic | |

| |of the file. |messages concerning this condition. | |

| | |settime myfile.txt | |

| | |Sets the file myfile.txt as the | |

| | |current time/date. | |

|Find |Touch |Ping |Ssh |

|Search for files that meet a desired |Change file timestamps |Test a network connection |Secure Shell client (remote login |

|criteria |Location: /usr/bin/touch |Secure Shell client (remote login |program) |

|Location: /usr/bin/find |Syntax: touch [option] . . . file . . |program). Sends ICMP ECHO_REQUEST |Location: /usr/bin/ssh |

|Syntax: find path expressions |. |packets to network hosts. |Syntax: ssh |

|find –name “MyCPrgram.c” |touch myfile.txt |Location: /bin/ping |[-1246AaCfgkNnqsTtVvXxY] [-b |

|Finds files using names, displays files |just updates the timestamp of the file|Syntax: ping -s [-d] [-l] [-L] [-n] |bind_address] [-c cipher_spec] [-D |

|and subdirectories. |to the computer’s current date and |[-r] [-R] [-v] [ -i interface_address|port] [-e escape_char] [-F |

|find –iname “MyCProgram.c” |time. |] [-I interval] [-t ttl] host |configfile] [-i identity_file] [-L |

|Finds files using name and ignoring case. |touch project.c |[packetsize] [count] |port:host:hostport] [-l login_name]|

|find . –type -F –exec ls –s {} \; | sort |will simulate an update to project.c |ping –I 0.1 IP |[-m mac_spec] [-o option] [-p port]|

|–n –r |head -5 |touch myfile.txt –a |Decreases ping internal time. (Wait |[-R p_rt:host:hostport] |

|Finds the top 5 biggest files in the |changes only the access time. |0.1 seconds before sending the next |[user@]hostname [command] |

|current directory and its subdirectories.| |packet.) |ssh –V |

| | |ping –l 5600 –s 100 -i 0.1 |Identifies SSH client version. |

| | |192.168.15.200 |ssh –l jsmith |

| | |pretty much ping of death, increases |remotehost. |

| | |variable time, and increases packet |Login to remote host. (ssh-keygen |

| | |size. |–F publickey.pub) to get public key|

| | |ping 127.0.0.1 |fingerprints. |

| | |Pings local host. |scp |

| | | |jsmith@remotehost.:/home|

| | | |/jsmith/localhostfile.txt |

| | | |Copies the file from the remote |

| | | |host to the local host. |

|Date |Mkdir |Uname |Rsync |

|Display or change the date & time |Create new folder(s) |Print system information |Remote file copy (Synchronize file |

|Location: /bin/date |Location: /bin/mkdirwhich |Location: /bin/uname |trees) |

|Syntax: date [-a] [-u] [-s datestr] |Syntax: mkdir [-m,-p,-v,-z,or |Syntax: uname [-a] [-i] [-m] [-n] |Location: /usr/bin/rsync |

|date |directory name] directory |[-p] [-r] [-s] [-v] [-x] [-S |Syntax: rsync options source |

|List the date and time of the server. for |mkdir mydir |systemname] |destination |

|example |The above command creates a new |uname –arv |rsync –zvr |

|Thu Feb9 16:47:32 MST 2011 |directory called mydir. |Will list the basic system |/var/opt/installation/inventory/ |

|date –s “11/20/2003 12:48:00” |mkdir –m a=rwx mydir |information, OS release, and OS |/root/temp |

|Set the date and time shown |This example would use the –m option |version. |-z is to enable compression |

|date ‘+DATE:%m/%d/%y%nTIME:%H:%M:%S’ |to not only create the mydir directory|uname –p |-v verbose |

|Would list the time and date in the below |but also set the permissions to all |Will display the Linux platform. |-r indicates recursive |

|format. |users having read, write, and execute |uname –a |Syncs two directories in a local |

|DATE: 02/08/01 |permissions |Will print out all information. |computer. |

|TIME:16:44:55 |mkdir –v bigdir |uname –v |rsync –azv |

| |Will display a message for each |Will print out the kernel version. |/var/opt/installation/inventory/ |

| |created directory | |/root/temp/ |

| | | |Archives the file too. |

| | | |rsync –v /var/lib/rpm/Pubkeys |

| | | |/root/temp/Pubkeys |

| | | |Copies one file. |

|~ |> |? |

|tilde |Redirector |Question mark |

|the tilde represents the home directory of the |Redirects a file to a different output. |Expands to the status of the most recently executed|

|current user. |date > RightNow.txt |foreground pipeline. |

|~foo |.> is used to replace the content of any existing |man -? |

|Refers to the home directory of the user foo. |file having the name “RightNow.txt”. |Displays the man help list |

|. |>> || |

|period |append |pipeline |

|Run a command script in the current shell |to overwrite an existing file use “>>” to append to |A pipeline is used to make the output of one |

|(current directory) |any existing file. |command serve as the input to another command. |

|./filename |date >> RightNow.txt |echo ”cherry apple peach” |tr “ “ “\n” |

|refers to a filename in the current directory. |Will attach the information about the date to the |pipes the output of echo into translation command |

| |file RightNow.txt. |which spaces with linefeeds, represented by “\n” |

|.. |< |* |

|Parent directory |Backwards redirector |Asterisk |

|Runs a command script in the current shell. |Redirects output to a different input. |Expands to the positional parameters, starting from|

|../filename |Sort < txtfile |one. When the expansion occurs within double |

|Means you are referring to a filename in parent |is the same as |quotes, it expands to a single word with the value |

|directory. |cat textfile | sort |of each parameter separated by the first character |

| | |of the IFS special variable. |

| | |ls * |

| | |will display all directories and files. |

References

(2011) Computer Hope. Linux Command Help.

(2009) The Geek Stuff. Linux Commands.

[pic]

-----------------------

Linux Command List

Dunwoody College of Technology

11-1-11

Matthew Kerfoot

An A-Z index of the Bash command line for Linux

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download