Basic File Management (4) Flashcards
Objective 103.3 Weight 4
Which of the following commands can create a file named test.txt?
- mkdir test.txt
- touch test.txt
- echo Hello test.txt
- echo Hello > test.txt
- rm -i test.txt
- tr 1 2 < test.txt
- touch test.txt
AND - echo Hello > test.txt
The touch command allows you to create a blank empty file, if it doesn’t previously exist (If the file does already exist, the touch command just updates the file’s timestamps). The echo Hello > test.txt command will also create a file, using STDOUT redirection.
Which of the following commands can delete a file named test.txt?
mkdir test.txt
- rm test.txt
- del test.txt
- touch -d test.txt
- rm -i test.txt
- tr 1 2 < test.txt
- rm test.txt
AND - rm -i test.txt
The rm and rm -i commands can both delete a file named test.txt on a Linux system.
Which of the following commands deletes an empty directory named test?
- rm -R test
- rm test
- del test
- touch -d test
- rm -r test
- rmdir test
- rm -R test, 5. rm -r test AND 6. rmdir test
The rmdir command is the most commonly used command to remove (delete) and empty directory. However, the rm -r and rm -R commands will work too.
Which of the following commands deletes the non-empty directory named test?
- rm -R test
- rm test
- del test
- touch -d test
- rm -r test
- rmdir test
- rm -R test
AND - rm -r test
The rm -r and rm -R commands are the ones to use to remove (delete) a directory that has files in it.
You need to create a tarball. Which tar command and options should you use?
- tar -tf
- tar -vf
- tar -cvf
- tar -xzf
- tar -czf
- tar -xvf
- tar -czf
The tar -czf command and options will create a tarball using gzip compression (but you will need to also provide the name of the tarball file, and the files to put into the tarball).
Which of the following commands creates a cpio archive?
- cpio -ov > filearch.cpio file?
- cpio -cv > filearch.cpio file?
- ls file? | cpio -ov > filearch.cpio
- ls file? | cpio -cv > filearch.cpio
- cat file? | cpio -cv filearch.cpio
- cat file? | cpio -cv > filearch.cpio
- cat file? | cpio -cv filearch.cpio
The ls file? | cpio -ov > filearch.cpio command uses the proper STDIN redirection and options for creating a cpio archive.
When you extract files from a cpio archive file or just view them, you are using what mode?
- Archive
- Extract
- Compress
- View
- Copy-Out
- Copy-In
- Copy-In
When you extract files from a cpio archive file or just view them, you are using Copy-In mode. (When you create a cpio archive, you are using Copy-Out mode.)