<<

Line Cheat Sheet by DaveChild

Bash Commands Options Nano Shortcuts -a Show system and kernel -a Show all (including hidden) Files -n1 /etc/issue Show distribution -R Recursive list Ctrl-R Read Show mounted filesystems -r Reverse order Ctrl-O Save file date Show system date -t by last modified Ctrl-X Close file Show uptime -S Sort by file size and Show your username -l Long listing ALT-A marking text man command Show manual for command -1 One file per line CTRL-K Cut marked text or line

-m Comma-separated output CTRL-U Paste text Shortcuts -Q Quoted output Navigate File

CTRL- Stop current command ALT-/ End of file Search Files CTRL-z program CTRL-A Beginning of line

CTRL-a Go to start of line pattern Search for pattern in files CTRL-E End of line files CTRL-e Go to end of line CTRL-C Show line number grep -i Case insensitive search CTRL-u Cut from start of line CTRL-_ Go to line number grep -r Recursive search CTRL-k Cut to end of line Search File grep - Inverted search CTRL-r Search CTRL- find // - Find files starting with name in dir !! Repeat last command ALT-W Find next name name* !abc Run last command starting with abc CTRL-\ Search and find /dir/ -user Find files owned by name in dir !abc:p Print last command starting with abc name nano : !$ Last argument of previous command find /dir/ - Find files modifed than num http://www.nano-editor.org/docs.php !* All arguments of previous command mmin num minutes ago in dir Screen Shortcuts ^abc^123 Run previous command, replacing abc Find binary / source / manual for with 123 command command screen Start a screen session.

file Find file (quick search of system screen -r Resume a screen session. Bash Variables index) screen - Show your current screen sessions. Show environment variables list File Operations $NAME Output value of $NAME CTRL-A Activate commands for screen. variable file1 file1 Create CTRL-A c Create a new instance of terminal. export Set $NAME to value file1 Concatenate files and output CTRL-A n Go to the next instance of terminal. NAME =value file2 CTRL-A p Go to the previous instance of terminal. $PATH Executable search less file1 View and paginate file1 CTRL-A " Show current instances of terminals. $HOME Home directory file file1 Get of file1 CTRL-A A Rename the current instance of $ Current shell file1 file2 file1 to file2 terminal. file1 file2 file1 to file2 IO Redirection file1 Delete file1 File Permissions command < file Read input of command from head file1 Show first 10 lines of file1 775 file Change mode of file to 775 file file1 Show last 10 lines of file1 chmod -R 600 Recursively chmod folder to 600 command > file output of command to file tail -f file1 Output last lines of file1 as it folder command > Discard output of command changes Change file owner to user and /dev/null user :group file group to group command >> file Append output to file Management command1 | Pipe output of command1 to File Permission Numbers Show snapshot of processes command2 command2 Show real processes The first digit is the owner permission, the second the group and the third for everyone. Directory Operations pid Kill process with id pid Calculate each of the three permission digits by Kill process with name name Show current directory adding the numeric values of the permissions below. name dir directory dir 4 read (r) Kill all processes with names beginning dir Change directory to dir name name 2 write (w) cd .. Go up a directory 1 execute (x) ls List files