Workbook 2 Filesystem Basics: Chapter 3 Managing Files Flashcards

Workbook 2 Filesystem Basics: Chapter 3 Managing Files

1
Q

pwd > results.txt
Is the following a valid command line?
If so, what does it do?

A

Outputs the results of pwd to a file called results.txt [22]

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

Give a command line that appends the phrase “I love Linux” to the contents of the file named
greetings.txt

A

echo “I love Linux”&raquo_space; greetings.txt [23]

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

Give a command line that copies the file britney.midi and names the copy backup.midi

A

cp britney.midi backup.midi [23]

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

Give a command line that copies the file /etc/passwd to your current working directory

A

cp /etc/passwd password.txt [24]

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

If you specify more than two arguments to the cp command, what must the last argument be?

A

when cp is used with > 2 arguments, last one must be a directory. [24]

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

Give a command line that renames the file britney.midi to junk.midi

A

mv britney.midi junk.midi [24]

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

True or false?

When moving a file, the mv command always moves the file’s data.

A

False!!
mv rarely actually moves data
around. Instead, the filesystem merely records a name change [24]

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

Give a command line that moves ~/britney.midi to the songs directory.

A

mv ~/britney.midi songs [24]

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

Give a command line that renames the cisco directory to ccna

A

mv cisco ccna [25]

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

Referring to the previous question, what would happen if the ccna already existed and you tried
to rename the cisco directory to ccna?

A

The file would move into ccna[25]

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

True or false?
Assuming that you have sufficient privileges and that somedir is a directory, the following command line removes that directory.

A

False!!!

You must use the rmdir command if the directory is empty [25]

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

Give a command line that removes the files ~/britney.midi and junk.midi

A

rm ~/britney.midi junk.midi [26]

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

True or false?

For all users, cp clobbers files without confirmation.

A

True!!!

cp or mv, the existing file will be destroyed without warning. This is known as clobbering a file [26]

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

Give a command line that moves file1 and file2 to the songs directory.

A

mv file1 file2 song directory [28]

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

Give a command line that enables bash’s noclobber option.

A

set +o noclobber [30]

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

Give a command line that disables bash’s noclobber option.

A

set -o noclobber [30]