
Linux Command Line Cheat Sheet by Dave Child (DaveChild) via cheatography.com/1/cs/49/ Bash Commands Bash Variables Command Lists uname -a Show system and kernel env Show environ ment cmd1 ; cmd2 cmd1 cmd2 head -n1 /etc/issue Show distrib ution variables Run then $NAME $NAME cmd1 cmd2 mount Show mounted echo Output value of && cmd2 cmd1 filesys tems variable Run if is successful NAME value $NAME value cmd1 cmd2 date Show system date export = Set to || Run cmd2 if cmd1 is not successful uptime Show uptime $PATH Executable search path cmd & whoami Show your username $HOME Home directory Run cmd in a subshell man command Show manual for $SHELL Current shell command Directory Operations IO Redirection pwd Show current directory Bash Shortcuts cmd < file cmd file mkdir dir Make directory dir CTRL-c Stop current command Input of from cmd1 cmd2 cd dir Change directory to dir CTRL-z Sleep program <( ) Output of cmd2 as file input to cmd1 cd .. Go up a directory CTRL-a Go to start of line cmd > file ls List files CTRL-e Go to end of line Standard output (stdout) of cmd to file CTRL-u Cut from start of line cmd > /dev/null ls Options CTRL-k Cut to end of line Discard stdout of cmd -a Show all (including hidden) CTRL-r Search history cmd >> file -R Recursive list !! Repeat last command Append stdout to file -r Reverse order !abc Run last command starting with cmd 2> file -t Sort by last modified abc Error output (stderr) of cmd to file -S Sort by file size !abc:p Print last command starting with cmd 1>&2 abc stdout to same place as stderr -l Long listing format !$ Last argument of previous cmd 2>&1 -1 One file per line command stderr to same place as stdout -m Comma-s epa rated output cmd file ALT-. Last argument of previous &> -Q Quoted output command Every output of cmd to file !* All arguments of previous cmd refers to a command. Search Files command grep pattern files Search for pattern in ^abc^123 Run previous command, replacing Pipes files abc with 123 cmd1 | cmd2 grep -i Case insensi tive stdout of cmd1 to cmd2 search cmd1 |& cmd2 grep -r Recursive search stderr of cmd1 to cmd2 grep -v Inverted search grep -o Show matched part of file only find /dir/ -name name* Find files starting with name in dir By Dave Child (DaveChild) Published 28th October, 2011. Sponsored by Readability-Score.com cheatography.com/davechild/ Last updated 27th June, 2014. Measure your website readability! www.addedbytes.com Page 1 of 2. https://readability-score.com Linux Command Line Cheat Sheet by Dave Child (DaveChild) via cheatography.com/1/cs/49/ Search Files (cont) Process Management Screen Shortcuts (cont) find /dir/ -user name Find files owned by ps Show snapshot of processes CTRL-A name dir in top Show real time processes Activate commands for screen. /dir/ num find -mmin Find files modifed less kill pid Kill process with id pid CTRL-A c than num minutes ago in Create a new instance of terminal. pkill name Kill process with name name dir CTRL-A n killall name Kill all processes with names whereis command Find binary / source / Go to the next instance of terminal. beginning name command manual for CTRL-A p locate file Find file (quick search of Go to the previous instance of terminal. Nano Shortcuts system index) CTRL-A " Files Show current instances of terminals. File Operations Ctrl-R Read file CTRL-A A touch file1 Ctrl-O Save file Rename the current instance. Create file1 Ctrl-X Close file More screen info at: cat file1 file2 Cut and Paste http:// www .gn u.or g/ sof twa re/ scr een/ Concate nate files and output ALT-A Start marking text less file1 File Permissions CTRL-K Cut marked text or line View and paginate file1 chmod 775 file CTRL-U Paste text file file1 Change mode of file to 775 Get type of file1 Navigate File chmod -R 600 folder ALT-/ End of file cp file1 file2 Recursi vely chmod folder to 600 Copy file1 to file2 CTRL-A Beginning of line chown user:group file mv file1 file2 CTRL-E End of line Change file owner to user and group to Move file1 to file2 group CTRL-C Show line number rm file1 CTRL-_ Go to line number Delete file1 File Permission Numbers Search File head file1 First digit is owner permiss ion, second is group CTRL-W Find Show first 10 lines of file1 and third is everyone. ALT-W Find next tail file1 Calculate permission digits by adding numbers Show last 10 lines of file1 CTRL-\ Search and replace below. tail -f file1 More nano info at: 4 read (r) Output last lines of file1 as it changes http:// www .na no- edi tor .or g/d ocs .php 2 write (w) 1 execute (x) Watch a Command Screen Shortcuts watch -n 5 'ntpq -p' screen Issue the 'ntpq -p' command every 5 Start a screen session. seconds and display output screen -r Resume a screen session. screen -list Show your current screen sessions. By Dave Child (DaveChild) Published 28th October, 2011. Sponsored by Readability-Score.com cheatography.com/davechild/ Last updated 27th June, 2014. Measure your website readability! www.addedbytes.com Page 2 of 2. https://readability-score.com.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages2 Page
-
File Size-