Memory Tables Flashcards
> 1>
Redirects STDOUT. If redirection is to a file, the current contents of that file are overwritten.
> > 1»
Redirects STDOUT in append mode. If output is written to a file, the output is appended to that file.
2>
Redirects STDERR.
2>&1
Redirects STDERR to the same destination as STDOUT. Notice that this has to be used in combination with normal output redirection, as in:
ls whuhiu > errout 2>&1
<
0<
Redirects STDIN.
Esc
In vim, switches from input mode to command mode. Press this key before typing any command.
i, a
In vim, switches from command mode to input mode at (i) or after (a) the current cursor position.
o
In vim, opens a new line below the current cursor position and goes to input mode.
:wq
In vim, writes the current file and quits.
:q!
In vim, quits the file without applying any changes. The ! forces the command to do its work. Add the ! only if you really know what you are doing.
:w filename
In vim, writes the current file with a new filename.
dd
In vim, deletes the current line.
yy
In vim, copies the current line.
p
In vim, pastes the contents that have been cut or copied into memory.
v
In vim, enters visual mode, which allows you to select a block of text using the arrow keys. Use d to cut the selection or y to copy it.
u
In vim, undoes the last command. Repeat as often as necessary.
Ctrl-r
In vim, redoes the last undo. (Cannot be repeated more than once.)
gg
In vim, goes to the first line in the document.
G
In vim, goes to the last line in the document.
/text
In vim, searches for text from the current cursor position forward.
?text
In vim, searches for text from the current cursor position backward.
In vim, goes to the first position in the current line.
$
In vim, goes to the last position in the current line.
!ls
In vim, adds the output of ls (or any other command) in the current file.
:%s/old/new/g
In vim, this would replace all occurrences of old with new.