Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
command-line_ninjary [2013/02/16 01:53] ishivverscommand-line_ninjary [2013/04/01 14:59] (current) – [Navigation] c.axen
Line 1: Line 1:
-==== Command-line Ninjary GSPS 2013 ==== +====== Command-line Ninjary GSPS 2013 ======
  
 This is meant to be a quick reference guide to command-line usage for those of us  This is meant to be a quick reference guide to command-line usage for those of us 
 who have the basics down, but aren't yet true ninjas.  Please add your own tips who have the basics down, but aren't yet true ninjas.  Please add your own tips
-or quick examples!+or quick examples!  We spend a surprising amount of our lives inside a terminal, 
 +so learn to love it and use it well.  Note: this page was written for ''bash'', 
 +but much of this stuff should translate to ''csh'' or your shell of choice.  
  
 ------------------------------------ ------------------------------------
  
-=== Navigation ===+==== Navigation ===
 +General notes about navigation commands: First, "Ctrl" commands are the same as in the text editor emacs, so you may find that other emacs line navigation commands work as well. Second, if you are on a Unix machine, note that the line navigation commands work almost anywhere you can edit text - you will learn that accidentally if you start using these commands compulsively. Third, if you use "Ctrl" commands often, you may consider setting the "Caps Lock" key as an additional "Control" key - this is just a computer setting for Unix (e.g. System Preferences > Keyboard > Modifier Keys) but requires slightly more work on Windows (e.g. the AutoHotkey program). 
  
   * ''cntrl-a'': go to beginning of line   * ''cntrl-a'': go to beginning of line
   * ''cntrl-e'': go to end of line   * ''cntrl-e'': go to end of line
-  * ''cntrl-''k: delete everything to right+  * ''cntrl-k'': delete everything to right
   * ''cntrl-u'': delete everything to left   * ''cntrl-u'': delete everything to left
   * ''cntrl-w'': delete word to left   * ''cntrl-w'': delete word to left
   * (''option'' or ''cntrl'')-(''left'' or ''right''): move left/right. ''cntrl'' for linux, ''option'' for mac.   * (''option'' or ''cntrl'')-(''left'' or ''right''): move left/right. ''cntrl'' for linux, ''option'' for mac.
 +  * Ctrl-f: move forward one character
 +  * Ctrl-b: move backward one character
   * use backslash ''\'' to literally interpret any command characters   * use backslash ''\'' to literally interpret any command characters
      
Line 49: Line 54:
  
  
-=== Really Useful Built-ins ===+==== Really Useful Built-ins ====
  
   * ''clear'': clear the terminal screen   * ''clear'': clear the terminal screen
Line 149: Line 154:
      
   * ''awk'': programming language to edit pipes on the fly   * ''awk'': programming language to edit pipes on the fly
-      * basic usages are powerful, learn more [[http://www.gnu.org/software/gawk/manual/gawk.html|here]+      * basic usages are powerful, learn more [[http://www.gnu.org/software/gawk/manual/gawk.html|here]]
       * ''awk '{print $1}'': print the first item of each line, items split by spaces/tabs       * ''awk '{print $1}'': print the first item of each line, items split by spaces/tabs
       * ''awk -F, '{print $2}'': print the second item of each line, items split by '',''       * ''awk -F, '{print $2}'': print the second item of each line, items split by '',''
Line 162: Line 167:
  
  
-== Looping ==+==== Loops & Functions ====
  
 === Variables === === Variables ===
Line 256: Line 261:
  
  
-== .profile or .bashrc or .whatever ==+== .profile or .bashrc ==
  
 There are a set of system files in your home directory that are executed every time There are a set of system files in your home directory that are executed every time
 a terminal is opened - use those to define aliases, functions, or variables a terminal is opened - use those to define aliases, functions, or variables
 you want always available. you want always available.