Difference between revisions of "Command Line Crib Sheet"
From LMU BioDB 2013
(A few more commands, plus add a “short form” column.) |
(Add section on regex symbols, placeholder for sed.) |
||
Line 1: | Line 1: | ||
+ | <!-- | ||
By popular demand, based on your [[Class Journal Week 3|week 3 shared journal feedback]], here is a reference-style listing of the commands we have seen so far. | By popular demand, based on your [[Class Journal Week 3|week 3 shared journal feedback]], here is a reference-style listing of the commands we have seen so far. | ||
+ | --> | ||
+ | |||
+ | == Commands, Special Symbols, and Keyboard Shortcuts == | ||
{| | {| | ||
+ | | '''!''' | ||
+ | | exclamation point/bang | ||
+ | | Shortcut for repeating a command—'''!<command number>''' repeats the command with that number (as listed by the '''history''' command); '''!!''' repeats the last command | ||
+ | |- | ||
| '''/''' | | '''/''' | ||
| forward slash | | forward slash | ||
Line 25: | Line 33: | ||
| exit | | exit | ||
| Log out of your command line session. | | Log out of your command line session. | ||
+ | |- | ||
+ | | '''history''' | ||
+ | | history | ||
+ | | Lists the commands you have typed so far | ||
|- | |- | ||
| '''left'''/'''right''' arrow keys | | '''left'''/'''right''' arrow keys | ||
Line 46: | Line 58: | ||
| Go back and forth through command history | | Go back and forth through command history | ||
|} | |} | ||
+ | |||
+ | == Search Pattern Symbols (a.k.a. regular expression or ''regex'' symbols) == | ||
+ | |||
+ | Used by '''grep''', '''sed''', and '''XMLPipeDB Match''' to indicate what patterns to find. | ||
+ | |||
+ | {| | ||
+ | | '''.''' | ||
+ | | Single-character wildcard | ||
+ | | Matches any character | ||
+ | |- | ||
+ | | '''*''' | ||
+ | | Zero or more | ||
+ | | Matches zero or more of the symbol that precedes it | ||
+ | |- | ||
+ | | '''^''' | ||
+ | | Beginning of line | ||
+ | | Matches the pattern after it only if it appears at the beginning of a line | ||
+ | |- | ||
+ | | '''$''' | ||
+ | | End of line | ||
+ | | Matches the pattern before it only if it appears at the end of a line | ||
+ | |- | ||
+ | | '''+''' | ||
+ | | One or more | ||
+ | | Matches ''one'' or more of the symbol that precedes it | ||
+ | |- | ||
+ | | '''\"''' | ||
+ | | Double-quote character | ||
+ | | Matches a double-quote in a line; the extra backslash ('''\''') is needed so that this quote is not confused for indicating the end of the search pattern | ||
+ | |- | ||
+ | | '''\d''' | ||
+ | | Number 0-9 (i.e., ''d''igit) | ||
+ | | Matches any single-digit number | ||
+ | |- | ||
+ | | '''\w''' | ||
+ | | Letter or number (i.e., something that would appear in a ''w''ord) | ||
+ | | Matches any letter or number, but not punctuation, spaces, or other symbols | ||
+ | |} | ||
+ | |||
+ | == '''sed''' Search/Replace Directives == | ||
+ | |||
+ | To be written. |
Revision as of 20:44, 14 September 2013
Commands, Special Symbols, and Keyboard Shortcuts
! | exclamation point/bang | Shortcut for repeating a command—!<command number> repeats the command with that number (as listed by the history command); !! repeats the last command |
/ | forward slash | Separates successive folders in a cd command |
~, ~username | tilde | Shortcut for a user’s home folder; when immediately followed by a username (no spaces), this represents that user’s home folder |
cd <directory or folder> | change directory | Changes the current directory/folder to the one indicated in the command |
Ctrl-C | “Panic” key—bail out of the current program and jump back to the command line | |
Ctrl-D | “End input” key—ends a program when using it in “practice” mode (where you type the data that you want it to manipulate) | |
exit | exit | Log out of your command line session. |
history | history | Lists the commands you have typed so far |
left/right arrow keys | Go backward/forward across current command (allowing you to edit it) | |
logout | logout | Log out of your command line session. |
pwd | print working directory | Displays the directory/folder in which you are working; the command prompt also shows this |
Tab key | autocomplete | Lists possible matching choices if there is more than one, or autofills immediately if there is only one match |
up/down arrow keys | Go back and forth through command history |
Search Pattern Symbols (a.k.a. regular expression or regex symbols)
Used by grep, sed, and XMLPipeDB Match to indicate what patterns to find.
. | Single-character wildcard | Matches any character |
* | Zero or more | Matches zero or more of the symbol that precedes it |
^ | Beginning of line | Matches the pattern after it only if it appears at the beginning of a line |
$ | End of line | Matches the pattern before it only if it appears at the end of a line |
+ | One or more | Matches one or more of the symbol that precedes it |
\" | Double-quote character | Matches a double-quote in a line; the extra backslash (\) is needed so that this quote is not confused for indicating the end of the search pattern |
\d | Number 0-9 (i.e., digit) | Matches any single-digit number |
\w | Letter or number (i.e., something that would appear in a word) | Matches any letter or number, but not punctuation, spaces, or other symbols |
sed Search/Replace Directives
To be written.