vim Flashcards

1
Q

Undo the most recent edit.

A

u

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

delete a single character

A

x

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Copy line

A

y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Paste

A

p

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Configure vim to show line numbers

A
echo 'set number'   >>   ~/.vimrc
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain the PS1 variable

A

controls the appearance of the shell prompt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

sets the locale encoding to french

A

LANG=fr_FR.UTF-8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List all input and output communication channels for processes

A

0: standard in
1: standard out
2: standard err
3: file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Diff between:
> output.log 2>&1

and

2>&1 > output.log

A

First redirects stdout to output.log and stderr to the same location as stdout which is output.log

Second redirects stderr to default place for stdout which is console and then redirects std out to output.log

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is merging redirection operator

A

&> output.log

equivalent to:

> output.log 2>&1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

redirect the output of the ls command to the output.log file and passes it to the less command

A

ls | tee output.log | less

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Different vim modes

A

1) Command mode
2) Insert mode
3) Visual edit mode
4) Extended command mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you access visual editor mode

A

while in command mode, type v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you access extended command mode

A

in command mode type colon (:)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Key commands in visual edit mode

A

1) Multiline selection Shift + v
2) Block selection Ctrl + v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Display time in the history

A

HISTTIMEFORMAT=”%F %T “

17
Q

Change number of commands stored in history

A

HISTFILESIZE=10000

18
Q

Where is the history saved?

A

~/.bash_history

19
Q

Store the history in ~/.history.txt

A

HISTFILE=~/.history.txt

20
Q

Print the date seconds

A

date +%s