Difference between revisions of "Command Line Crib Sheet"
From LMU BioDB 2013
(Move introductory sentence.) |
(A few more commands.) |
||
Line 17: | Line 17: | ||
| change directory | | change directory | ||
| Changes the current directory/folder to the one indicated in the command | | Changes the current directory/folder to the one indicated in the command | ||
+ | |- | ||
+ | | '''cp -i ''<file to copy>'' ''<destination of copy>''''' | ||
+ | | copy file | ||
+ | | Copies the given file to the given destination | ||
|- | |- | ||
| '''Ctrl-C''' | | '''Ctrl-C''' | ||
Line 41: | Line 45: | ||
| logout | | logout | ||
| Log out of your command line session. | | Log out of your command line session. | ||
+ | |- | ||
+ | | '''ls''' | ||
+ | | list files | ||
+ | | Display the files in the current directory; adding a '''-F''' to the command (i.e., '''ls -F''') adds a symbol to the file listings indicating their type | ||
|- | |- | ||
| '''pwd''' | | '''pwd''' |
Revision as of 05:55, 15 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 |
cp -i <file to copy> <destination of copy> | copy file | Copies the given file to the given destination |
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. |
ls | list files | Display the files in the current directory; adding a -F to the command (i.e., ls -F) adds a symbol to the file listings indicating their type |
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.