{"id":3502,"date":"2013-05-24T04:13:05","date_gmt":"2013-05-24T11:13:05","guid":{"rendered":"http:\/\/blog.networkpresence.co\/?p=3502"},"modified":"2013-05-24T04:13:25","modified_gmt":"2013-05-24T11:13:25","slug":"some-shell-shortcuts","status":"publish","type":"post","link":"http:\/\/blog.networkpresence.co\/?p=3502","title":{"rendered":"Some Shell Shortcuts"},"content":{"rendered":"<p>The following describes some common and useful &#8220;Shell&#8221; (\/bin\/sh) or &#8220;Bash&#8221; (\/bin\/bash) Unix and Linux command-line &#8216;shell&#8217; key based shortcuts for commands or actions:<\/p>\n<p>a)      CTRL-a brings the cursor to the start of the current line and CTRL-e puts it to the end of the current line<\/p>\n<p>b)      CTRL-z will \u201csuspend\u201d the current running command and return you to the shell prompt, where if you then type \u201cbg\u201d &#038; enter, that command will be allowed to run again, but be \u201cin the background\u201d and you\u2019ll be back at the shell prompt. Type \u201cjobs\u201d to see the still running backgrounded command and \u201cfg\u201d to return to it.<\/p>\n<p>c)      CTRL-w will delete the word _behind_ the current cursor position &#038; CTRL-u will delete the whole line behind the current cursor position<\/p>\n<p>d)      CTRL-k will delete the rest of the line after the current cursor position<\/p>\n<p>e)      CTRL-l will clear the current shell screen\/window, same as the \u201cclear\u201d command<\/p>\n<p>f)      The \u201creset\u201d command in a shell will clear the screen and \u2018reset\u2019 the shell\u2019s character-set and other settings (useful if the screen gets binary chars output on it)<\/p>\n<p>g)      !! (\u201cbang bang\u201d) on a command-line will re-run the previous command<\/p>\n<p>h)      !* (\u201cbang star\u201d) on a command-line will include \u201cthe previous command line EXCEPT its last parameter\u201d) at the place where the !* chars are located in the current command-line<\/p>\n<p>i)      !$ (\u201cbang dollar\u201d) used on a command-line will include the \u201clast parameter of the previous command line\u201d at the place where the !$ chars are located in the current command-line<br \/>\nEg: if the previous command was: ls \u2013l \/a\/directory\/path\/here  then !$ on the next command-line will be \u201c\/a\/directory\/path\/here\u201d and you could easily cd to that dir with: cd !$<\/p>\n<p>j)      Adding the chars \u201c:p\u201d to the !* or !$ commands will just print what they\u2019d insert, not actually insert those chars, but will put them into the history list<\/p>\n<p>k)      You can change text in the previous command line with the \u2018^text-to-change^replacement-text^\u2019 character sequence at the start of a new command-line<br \/>\nEg: If the previous command had a typo like: ls \u2013latr \/a\/directory\/pathhereismissingsome\/<br \/>\nAnd you want to add some missed \u2018\/\u2019 char after the \u2018path\u2019 directory name, start the next command line with ^path^path\/^ and the command-line executed will be: ls \u2013latr \/a\/directory\/path\/hereismissingsome\/<\/p>\n<p>There\u2019s lots of pages on these shortcuts, here\u2019s a useful one from a useful site:<br \/>\nhttp:\/\/www.techrepublic.com\/article\/master-the-linux-bash-command-line-with-these-10-shortcuts\/5827311<\/p>\n<p>FYI,<br \/>\nRichard.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following describes some common and useful &#8220;Shell&#8221; (\/bin\/sh) or &#8220;Bash&#8221; (\/bin\/bash) Unix and Linux command-line &#8216;shell&#8217; key based shortcuts for commands or actions: a) CTRL-a brings the cursor to the start of the current line and CTRL-e puts it &hellip; <a href=\"http:\/\/blog.networkpresence.co\/?p=3502\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,54],"tags":[78],"class_list":["post-3502","post","type-post","status-publish","format-standard","hentry","category-network-presence","category-rich","tag-sysadmin"],"_links":{"self":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts\/3502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3502"}],"version-history":[{"count":3,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts\/3502\/revisions"}],"predecessor-version":[{"id":3506,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=\/wp\/v2\/posts\/3502\/revisions\/3506"}],"wp:attachment":[{"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3502"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.networkpresence.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}