6. File Viewing and Manipulation and Text Editors Flashcards

1
Q

Which commands are used to view files one page at a time?

A

less filename.ext
more filename.ext

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

Which command is used to view the first ten lines of a file?

A

head filename.ext

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

Which command is used to view the first specific number of lines of a file?

A

head -number filename.ext

e.g

head -3 filename.ext will display the first 3 lines of a file

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

There is a command that works exactly like the head command but starts reading files form the end what is the name of that command?

A

tail

tail filename.ext will show the last 10 lines of a file
tail -n 3 filename.ext will show the last 3 lines of file

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

What command is used to count the lines, words, and characters in a given file?

A

wc filename.ext

result: lines words characters

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

How would you specify you want to count only the number of lines, words, or characters in a given file?

A

wc -l filename.txt => for lines
wc -w filename.txt => for words
wc -c filename.txt => for characters

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

What default Linux text editors do you know?

A

Vi
Nano

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

In Vi or Vim, how do you open/create a new file?

A

vim filename.ext

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

In Vi or Vim, how do you switch to insertion/editing mode once a file is open?

A

You press i

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

In vi or vim, how do you go back to normal mode from insertion mode?

A

press esc

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

In vi or vim, how do you save your file?

A

:w

and press enter

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

In vi or vim, how do you exit the file?

A

:q or :q! to force quit without saving

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