{"id":14128351,"url":"https://github.com/fliptheweb/bash-shortcuts-cheat-sheet","last_synced_at":"2025-08-03T22:33:09.886Z","repository":{"id":40589380,"uuid":"10543695","full_name":"fliptheweb/bash-shortcuts-cheat-sheet","owner":"fliptheweb","description":"Useful shortcuts for bash/zsh","archived":false,"fork":false,"pushed_at":"2020-11-15T21:23:24.000Z","size":59,"stargazers_count":815,"open_issues_count":3,"forks_count":116,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-08-16T16:22:30.237Z","etag":null,"topics":["bash","cheet-sheet","fish","shell","shortcut","zsh"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fliptheweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-07T06:16:51.000Z","updated_at":"2024-08-16T16:22:30.238Z","dependencies_parsed_at":"2022-08-09T23:50:27.614Z","dependency_job_id":null,"html_url":"https://github.com/fliptheweb/bash-shortcuts-cheat-sheet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fliptheweb%2Fbash-shortcuts-cheat-sheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fliptheweb%2Fbash-shortcuts-cheat-sheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fliptheweb%2Fbash-shortcuts-cheat-sheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fliptheweb%2Fbash-shortcuts-cheat-sheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fliptheweb","download_url":"https://codeload.github.com/fliptheweb/bash-shortcuts-cheat-sheet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228571844,"owners_count":17938772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","cheet-sheet","fish","shell","shortcut","zsh"],"created_at":"2024-08-15T16:01:34.703Z","updated_at":"2024-12-07T06:31:06.307Z","avatar_url":"https://github.com/fliptheweb.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"## Useful bash / zsh shortcuts\n\nMacOS iTerm 2 users must turn on meta key — https://coderwall.com/p/_lmivq\n\nNice visual cheatsheet from the [article](https://clementc.github.io/blog/2018/01/25/moving_cli/): \n\n![visual cheetsheet](https://github.com/fliptheweb/bash-shortcuts-cheat-sheet/blob/master/moving_cli.png?raw=true)\n\n### Move cursor\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + a\u003c/td\u003e\n\u003ctd\u003eGo to the beginning of the line (Home)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + e\u003c/td\u003e\n\u003ctd\u003eGo to the End of the line (End)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + b\u003c/td\u003e\n\u003ctd\u003eBack (left) one word\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + f\u003c/td\u003e\n\u003ctd\u003eForward (right) one word\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + f\u003c/td\u003e\n\u003ctd\u003eForward one character\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + b\u003c/td\u003e\n\u003ctd\u003eBackward one character\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + xx\u003c/td\u003e\n\u003ctd\u003eToggle between the start of line and current cursor position\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n### Edit\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + u\u003c/td\u003e\n\u003ctd\u003eCut the line before the cursor position\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + Del\u003c/td\u003e\n\u003ctd\u003eDelete the Word before the cursor\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + d\u003c/td\u003e\n\u003ctd\u003eDelete the Word after the cursor\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + d\u003c/td\u003e\n\u003ctd\u003eDelete character under the cursor\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + h\u003c/td\u003e\n\u003ctd\u003eDelete character before the cursor (backspace)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + w\u003c/td\u003e\n\u003ctd\u003eCut the Word before the cursor to the clipboard\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + k\u003c/td\u003e\n\u003ctd\u003eCut the Line after the cursor to the clipboard\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + t\u003c/td\u003e\n\u003ctd\u003eSwap current word with previous\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + t\u003c/td\u003e\n\u003ctd\u003eSwap the last two characters before the cursor (typo)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eEsc + t\u003c/td\u003e\n\u003ctd\u003eSwap the last two words before the cursor.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + y\u003c/td\u003e\n\u003ctd\u003ePaste the last thing to be cut (yank)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + u\u003c/td\u003e\n\u003ctd\u003eUPPER capitalize every character from the cursor to the end of the current word.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + l\u003c/td\u003e\n\u003ctd\u003eLower the case of every character from the cursor to the end of the current word.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + c\u003c/td\u003e\n\u003ctd\u003eCapitalize the character under the cursor and move to the end of the word.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + r\u003c/td\u003e\n\u003ctd\u003eCancel the changes and put back the line as it was in the history (revert)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eСtrl + _ \u003c/td\u003e\n\u003ctd\u003eUndo\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n### History\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + r\u003c/td\u003e\n\u003ctd\u003eRecall the last command including the specified character(s)(equivalent to : vim ~/.bash_history). \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + p\u003c/td\u003e\n\u003ctd\u003ePrevious command in history (i.e. walk back through the command history)\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + n\u003c/td\u003e\n\u003ctd\u003eNext command in history (i.e. walk forward through the command history)\u003c/td\u003e\n\u003c/tr\u003e\u003ctr\u003e\n\u003ctd\u003eCtrl + s\u003c/td\u003e\n\u003ctd\u003eGo back to the next most recent command.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + o\u003c/td\u003e\n\u003ctd\u003eExecute the command found via Ctrl+r or Ctrl+s\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eCtrl + g\u003c/td\u003e\n\u003ctd\u003eEscape from history searching mode\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003eAlt + .\u003c/td\u003e\n\u003ctd\u003eUse the last word of the previous command\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n### Process control\n\n\n### Bang(!) - The History Expansion\nBash also has some handy features that use the ! (bang) to allow you to do some funky stuff with bash commands.\u003cbr\u003e\nGeneral notation is `'![event][:word[:modifier[:modifier]...]]'`.\u003cbr\u003e\nYou may omit word separator `':'`, if the word designator begins with a `'^'`, `'$'`, `'*'`, `'-'`, or `'%'`.\u003cbr\u003e\nIf a word designator is supplied without an event specification, the previous command is used as the event.\u003cbr\u003e\nAfter the optional word designator, you can add a sequence of one or more modifiers, each preceded by a `':'`.\u003cbr\u003e\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eEvents\u003c/th\u003e\u003cth\u003eMeaning\u003c/th\u003e\u003cth\u003eExample\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e!\u003c/td\u003e\n    \u003ctd\u003eStart a history substitution, except when followed by a space, tab, the end of the line, ‘=’ or ‘(’ (when the extglob shell option is enabled using the shopt builtin).\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e!\u003ci\u003en\u003c/i\u003e\u003c/td\u003e\n    \u003ctd\u003eRefer to command line \u003ci\u003e\u003cb\u003en\u003c/b\u003e\u003c/i\u003e.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ history\n1 echo foo bar baz\n2 history\n$ !1\n#Print command that will be saved in history\n#+and executed\necho foo bar baz\n#Actual execution\nfoo bar baz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e!-\u003ci\u003en\u003c/i\u003e\u003c/td\u003e\n    \u003ctd\u003eRefer to the command \u003ci\u003e\u003cb\u003en\u003c/b\u003e\u003c/i\u003e lines back.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ history\n1 echo foo\n2 echo bar\n3 echo baz\n4 history\n$ !-3\necho bar\nbar\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e!!\u003c/td\u003e\n    \u003ctd\u003eRefer to the previous command. This is a synonym for ‘!-1’.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar baz\nfoo bar baz\n$ !!\necho foo bar baz\nfoo bar baz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e!\u003ci\u003estring\u003c/i\u003e\u003c/td\u003e\n    \u003ctd\u003eRefer to the most recent command preceding the current position in the history list starting with \u003ci\u003e\u003cb\u003estring\u003c/b\u003e\u003c/i\u003e.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$printf '%s\\n' foo\nfoo\n$ echo bar\nbar\n$ !pri\nprintf '%s\\n' foo\nfoo\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e!?\u003ci\u003estring\u003c/i\u003e[?]\u003c/td\u003e\n    \u003ctd\u003eRefer to the most recent command preceding the current position in the history list containing \u003ci\u003e\u003cb\u003estring\u003c/b\u003e\u003c/i\u003e. The trailing ‘?’ may be omitted if the \u003ci\u003e\u003cb\u003estring\u003c/b\u003e\u003c/i\u003e is followed immediately by a newline.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$printf '%s\\n' foo\nfoo\n$ echo bar\nbar\n$ !?ntf\nprintf '%s\\n' foo\nfoo\n$ !?bar\necho bar\nbar\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e^\u003ci\u003estring1\u003c/i\u003e^\u003ci\u003etring2\u003c/i\u003e^\u003c/td\u003e\n    \u003ctd\u003eQuick Substitution. Repeat the last command, replacing \u003ci\u003e\u003cb\u003estring1\u003c/b\u003e\u003c/i\u003e with \u003ci\u003e\u003cb\u003estring2\u003c/b\u003e\u003c/i\u003e. Equivalent to `!!:s/string1/string2`.\u003c/td\u003e\n    \u003ctd\u003e\n    For more info, refer to `s/old/new/` in \u003cb\u003eModifiers\u003c/b\u003e section.\n\u003cpre\u003e\n$ echo foo\nfoo\n$ ^echo^printf '%s\\n'^\nprintf '%s\\n' foo\nfoo\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e!#\u003c/td\u003e\n    \u003ctd\u003eRepeat entire command line before this event.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo; echo bar; !#echo baz\necho foo; echo bar; echo foo; echo bar; echo baz\nfoo\nbar\nfoo\nbar\nbaz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth\u003eWords\u003c/th\u003e\u003cth\u003eMeaning\u003c/th\u003e\u003cth\u003eExample\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e0 (zero)\u003c/td\u003e\n    \u003ctd\u003eThe 0th word. For many applications, this is the command word.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo\nfoo\n$ !:0\necho\n\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ci\u003en\u003c/i\u003e\u003c/td\u003e\n    \u003ctd\u003eThe \u003ci\u003e\u003cb\u003en\u003c/b\u003e\u003c/i\u003eth word.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar baz\nfoo bar baz\n$ echo !:2\necho bar\nbar\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e^\u003c/td\u003e\n    \u003ctd\u003eThe first argument; that is, word 1.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar baz\nfoo bar baz\n$ echo !^\necho foo\nfoo\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003cpre\u003e$\u003c/pre\u003e\u003c/td\u003e\n    \u003ctd\u003eThe last argument.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar baz\nfoo bar baz\n$ echo !$\necho baz\nbaz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e%\u003c/td\u003e\n    \u003ctd\u003eThe word matched by the most recent `?string?` search\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo\nfoo\n$ printf '%s\\n' bar\nbar\n$ !?ch\necho foo\nfoo\n$ !% baz\necho baz\nbaz\n$ !?bar\nprintf '%s\\n' bar\nbar\n$ echo !%\necho bar\nbar\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ex-y\u003c/td\u003e\n    \u003ctd\u003eA range of words; `-y` abbreviates `0-y`.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar baz\nfoo bar baz\n$ echo !:2-3\necho bar baz\nbar baz\n$ !:-1\necho bar\nbar\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e*\u003c/td\u003e\n    \u003ctd\u003eAll of the words, except the 0th. This is a synonym for `1-$`. It is not an error to use `*` if there is just one word in the event - the empty string is returned in that case.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar baz\nfoo bar baz\n$ printf '%s\\n' !*\nprintf '%s\\n' foo bar baz\nfoo\nbar\nbaz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ex*\u003c/td\u003e\n    \u003ctd\u003eAbbreviates `x-$`\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar baz\nfoo bar baz\n$ printf '%s\\n' !:2*\nprintf '%s\\n' bar baz\nbar\nbaz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ex-\u003c/td\u003e\n    \u003ctd\u003eAbbreviates `x-$` like `x*`, but omits the last word.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar baz\nfoo bar baz\n$ printf '%s\\n' !:0-\nprintf '%s\\n' echo foo bar\necho\nfoo\nbar\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth\u003eModifiers\u003c/th\u003e\u003cth\u003eMeaning\u003c/th\u003e\u003cth\u003eExample\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ep\u003c/td\u003e\n    \u003ctd\u003ePrint the new command but do not execute it.\u003cbr\u003ePrinted command is saved in history, so you can use \u003ckbd\u003eCtrl+p\u003c/kbd\u003e to re-enter it in current prompt.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar baz\nfoo bar baz\n$ !:p\n#Printed, but not executed\necho foo bar baz\n$ !:*:p\nfoo bar baz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eh\u003c/td\u003e\n    \u003ctd\u003eRemove a trailing pathname component, leaving only the head (Actually, remove all after last `/`, including).\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo /example/path/bar.txt baz\nfoo /example/path/bar.txt baz\n$ !:p:h\necho foo /example/path\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003et\u003c/td\u003e\n    \u003ctd\u003eRemove all leading pathname components, leaving the tail (Actually, remove all before last `/`, including).\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo /example/path/bar.txt baz\nfoo /example/path/bar.txt baz\n$ !:p:t\nbar.txt baz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003er\u003c/td\u003e\n    \u003ctd\u003eRemove a trailing suffix of the form `.suffix`, leaving the basename (Actually, remove all after last `.`, including).\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo /example/path/bar.txt baz\nfoo /example/path/bar.txt baz\n$ !:p:r\necho foo /example/path/bar\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ee\u003c/td\u003e\n    \u003ctd\u003eRemove all but the trailing suffix (Actually, remove all before last `.`, including).\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo /example/path/bar.txt baz\nfoo /example/path/bar.txt baz\n$ !:p:e\ntxt baz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eq\u003c/td\u003e\n    \u003ctd\u003eQuote the substituted words, escaping further substitutions.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo 'bar baz'\nfoo bar baz\n$ !:p:q\n'echo foo '\\'bar baz'\\'''\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003ex\u003c/td\u003e\n    \u003ctd\u003eQuote the substituted words as with ‘q’, but break into words at spaces, tabs, and newlines.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo 'bar baz'\nfoo bar baz\n$ !:p:x\n'echo' 'foo' ''\\'bar' 'baz'\\'''\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u003ci\u003es/\u003ci\u003eold\u003c/i\u003e/\u003ci\u003enew\u003c/i\u003e/\u003c/i\u003e\u003c/td\u003e\n    \u003ctd\u003eSubstitute \u003ci\u003e\u003cb\u003enew\u003c/b\u003e\u003c/i\u003e for the first occurrence of \u003ci\u003e\u003cb\u003eold\u003c/b\u003e\u003c/i\u003e in the event line. Any delimiter may be used in place of `/`. The delimiter may be quoted in \u003ci\u003e\u003cb\u003eold\u003c/b\u003e\u003c/i\u003e and \u003ci\u003e\u003cb\u003enew\u003c/b\u003e\u003c/i\u003e with a single backslash. If `\u0026` appears in \u003ci\u003e\u003cb\u003enew\u003c/b\u003e\u003c/i\u003e, it is replaced by \u003ci\u003e\u003cb\u003eold\u003c/b\u003e\u003c/i\u003e. A single backslash will quote the `\u0026`. The final delimiter is optional if it is the last character on the input line.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar\nfoo bar\n$ !:p:s/foo/baz\necho baz bar\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\u0026\u003c/td\u003e\n    \u003ctd\u003eRepeat the previous substitution.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar\nfoo bar\n$ !:p:s/foo/baz\necho baz bar\n$ printf '%s\\n' foo\nfoo\n$ !:p:\u0026\nprintf '%s\\n' baz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eg\u003cbr\u003ea\u003c/td\u003e\n    \u003ctd\u003eCause changes to be applied over the entire event line. Used in conjunction with `s`, as in gs/old/new/, or with `\u0026`.\u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n$ echo foo bar foo\nfoo bar foo\n$ !:p:gs/foo/baz\necho baz bar baz\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003eG\u003c/td\u003e\n    \u003ctd\u003eApply the following ‘s’ modifier once to each word in the event.\u003c/td\u003e\n    \u003ctd\u003eResult is same as in `g` modifier\n\u003cpre\u003e\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## Recent links\n* [Bash Shortcuts For Maximum Productivity](http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/)\n* [Syntax Bashkeyboard](http://ss64.com/osx/syntax-bashkeyboard.html)\n* [Moving efficiently in the CLI](https://clementc.github.io/blog/2018/01/25/moving_cli/)\n* [Bash History Expansion](https://www.gnu.org/software/bash/manual/html_node/History-Interaction.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffliptheweb%2Fbash-shortcuts-cheat-sheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffliptheweb%2Fbash-shortcuts-cheat-sheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffliptheweb%2Fbash-shortcuts-cheat-sheet/lists"}