davidsouther_bash-zsh-shourtcuts.pdf

Upload: chester-connolly

Post on 10-Jan-2016

6 views

Category:

Documents


0 download

TRANSCRIPT

  • Bash/ZSH Shourtcuts Cheat Sheetby DavidSouther via cheatography.com/2124/cs/1151/

    Bash/ZSH Keyboard ShortcutsTab Auto complete^a Beginning of line^e End of line^f Forward one character^b Back one character^h Delete one character (backw ards)%f Forward one word%b Back one word^w Delete one word (backw ards)^u Clear to beginning of line^k Clear to end of line^y Paste from Kill Ring^t Swap cursor with previous character%t Swap cursor with previous word^p Previous line in history^n Next line in history^r Search backwards in history^l Clear screen^o Execute command but keep line^z Suspend processfg restore processbg continue process in background^c Kill current process^d Exit shell^ - Hold Control while pressing key% - Hold meta (alt, or command on mac)

    Bash Parameter Expansions${pa ram eter} Value of

    parameter${pa ram ete r:- word} Use default${pa ram ete r:= word} Assign default${pa ram ete r:? word} Display Error${pa ram ete r:+ word} Use Alternate${pa ram ete r:o ffs et} Substring${pa ram ete r:o ffs et: len gth}${!n ame [@]} List Array Keys${#p ara met er} Parameter length${pa ram ete r#m atch} Remove prefix${pa ram ete r## mat ch} (longest)${pa ram ete r%m atch} Remove suffix${pa ram ete r%% mat ch} (longest)${pa ram ete r/p att ern /st ring}

    Substi tution

    ${pa ram ete r^p att ern} Uppercase match${pa ram ete r^^ pat tern} Uppercase all${pa ram ete r,p att ern} Lowercase match${pa ram ete r,, pat tern} Lowercase all

    Rockstar Penguin

    Sed commands:[la bel] Set labelZero/One address commands= Print current line numbera \ Append texttext (embedded newlines)Address range commandsb [label] Jump to labelt (T) [label] Jump to label on (failed) s///c \ Replace matchtext (Embedded newlines)d (D) Delete (to newline)h H Copy/A ppend patterng G Paste/ Append holdx Exchange hold/p atternn N Read/A ppend next linep Print patterns/re gex /re pla ce/ Substi tutionAddr essesfirs t~s tep Starting at first, every

    stepth/reg ex/ Lines matching regexaddr 1,+N addr1 and N following linesVari ous{c1; c2; c3;} List of commands; Separate commandsUsing GNU Sed 4.2.2. Handy one-li ners:http:/ /se d.s our cef org e.n et/ sed 1li ne.txt

    By DavidSouthercheatography.com/davidsouther/

    Published 18th July, 2013.Last updated 22nd July, 2013.Page 1 of 1.

    Sponsored by Readability-Score.comMeasure your website readability!https://readability-score.com

    Bash/ZSH Shourtcuts Cheat Sheet - Page 1Bash/ZSH Keyboard ShortcutsBash Parameter ExpansionsSed commandsRockstar Penguin