Text Processing and Editing Flashcards

1
Q

How to exit Nano

A

Ctrl X

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

How to save in Nano

A

ctrl O

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

Get help in Nano

A

ctrl G

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

Open a second file within Nano

A

ctrl R then alt F (new buffer, otherwise it just inserts)

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

Swap between buffers in Nano

A

alt > or <

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

Create a new buffer (file) alongside one already open in Nano

A

ctrl R, alt F

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

Copy/cut a line in Nano

A

ctrl K (cuts) then ctrl U (pastes)

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

Mark a region in Nano

A

alt A, then move cursor

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

Copy a region in Nano

A

ctrl ^
(ctrl shift 6)

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

Find a word (string) in Nano

A

ctrl W.

Is not case sensitive
alt W will continue to search

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

How to find a replace all instances of a string in Nano?

A

ctrl\ or alt R

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

How to enter insert mode in Vim

A

i

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

How to enter command mode in Vim

A

:

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

How to enter visual mode in Vim

A

It opens into visual mode, otherwise hit Esc

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

How to delete a line in Vim

A

: d
Or Esc -d-d

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

How to save then quit Vim

A

:wq

17
Q

How to quit without saving in Vim

A

:q!

18
Q

How to bring up line numbers in Vim

A

:set number

19
Q

How select a range of lines in Vim

A

:1,100

20
Q

Copy in Vim

A

Y (in command)
yy (in visual)

21
Q

Paste in Vim

A

p
Or pp

22
Q

Find a string in Vim

A

/STRING (case sensitive)

23
Q

Jump to a string instance in vim as you open

A

vim +/STRING FILE

24
Q

How to repeat a search in Vim

A

/ ENTER
or from visual mode
‘n’ (forwards) N (backwards)

25
Q

How to search AND replace in Vim

A

:s/STRING/REPLACEMENT

26
Q

How to search and replace over a range of lines in Vim

A

:1,1000s/STRING/REPLACEMENT

27
Q

Reload original file in Vim e.g to undo

A

:e!

28
Q

Common “pr “ options

A

-n Display in n columns
-l n Change default 66 line page to n
-m Merge multi files in parallel column
-s c Change default separator to c
-t Omit head and tails
-w n change default 72 width to n

29
Q

Common “cat” options

A

-A show all (inc non printing char)
-E Display $ for new line feed
-n Number lines
-s Squeeze (no display) blank lines
-T Show tabs (with ^I)
-v Show non printing (^ or M-)

30
Q

What is file globbing?

A

When wildcards are added to a filename argument, so the name can be expanded into multiple names

31
Q

How do you repress file globbing in “locate”

A

“\STRING”

32
Q

Common “locate” options

A

-A Files that match all patterns
-b just match in the name, not in dir
-c display number of matches
-i ignore case
-q quiet, don’t show errors
-r use regex
-w defaults and is anything in name or dir that matches

33
Q

syntax for “getent”

A

getent FILE USER