Workbook 2 Filesystem Basics: Chapter 3 Managing Files Flashcards
Workbook 2 Filesystem Basics: Chapter 3 Managing Files
pwd > results.txt
Is the following a valid command line?
If so, what does it do?
Outputs the results of pwd to a file called results.txt [22]
Give a command line that appends the phrase “I love Linux” to the contents of the file named
greetings.txt
echo “I love Linux”»_space; greetings.txt [23]
Give a command line that copies the file britney.midi and names the copy backup.midi
cp britney.midi backup.midi [23]
Give a command line that copies the file /etc/passwd to your current working directory
cp /etc/passwd password.txt [24]
If you specify more than two arguments to the cp command, what must the last argument be?
when cp is used with > 2 arguments, last one must be a directory. [24]
Give a command line that renames the file britney.midi to junk.midi
mv britney.midi junk.midi [24]
True or false?
When moving a file, the mv command always moves the file’s data.
False!!
mv rarely actually moves data
around. Instead, the filesystem merely records a name change [24]
Give a command line that moves ~/britney.midi to the songs directory.
mv ~/britney.midi songs [24]
Give a command line that renames the cisco directory to ccna
mv cisco ccna [25]
Referring to the previous question, what would happen if the ccna already existed and you tried
to rename the cisco directory to ccna?
The file would move into ccna[25]
True or false?
Assuming that you have sufficient privileges and that somedir is a directory, the following command line removes that directory.
False!!!
You must use the rmdir command if the directory is empty [25]
Give a command line that removes the files ~/britney.midi and junk.midi
rm ~/britney.midi junk.midi [26]
True or false?
For all users, cp clobbers files without confirmation.
True!!!
cp or mv, the existing file will be destroyed without warning. This is known as clobbering a file [26]
Give a command line that moves file1 and file2 to the songs directory.
mv file1 file2 song directory [28]
Give a command line that enables bash’s noclobber option.
set +o noclobber [30]