Lesson 7 - Chapter 3: Working with Files Flashcards
What is a wildcard?
A way to search for specific types of files
A wildcard consists of 1 of 2 special characters which are:
- Asterisk *
- Question Mark ?
How do you use a wildcard? What does it replace?
You use a wildcard in place of all or part of a filename (so that it can target more than one file at a time)
What types of commands does a wildcard work with?
virtually every command that deals with multiple files or directories will take wildcards (like dir on Windows)
A good way to think about the wildcard is to replace the part of the filename that you don’t….?
replace the part of the filename that you don’t care about with an asterisk (*.txt)
What’s an example of using a wildcard using the dir command to see all files with the .txt extension?
dir *.txt
What’s an example of using a wildcard when using dir command to see every file that starts with the letter k?
dir k.
(dir k star-dot-star)
(remember, replacing the parts we don’t care about with the asterisk so don’t care about the rest of the filename, don’t care about the extension)
What’s an example of using a wildcard in Linux to find all files that start with o?
ls o* -l
What 2 commands can you use to delete files in Windows?
- del
- erase
What command do you use to delete files in Linux/macOS?
rm
(same as deleting directories with contents)
Files and directories deleted via the command line go to the recycling bin. T or F?
False, once they’re gone they’re GONE.
(Might be able to recover with a recovery utility called Piriform’s Recuva but don’t count on it)
How do you delete multiple files?
use wildcards
Linux example: rm *.txt
In Windows, how do you delete files named config with any extension?
del config.*
How do you delete all the files in a directory in Windows?
del .
(the star dot star wildcard)
What command do you use in Windows to delete a single file?
del
What command do you use in Linux/macOS to delete a file?
rm
NEVER fall for this Linux syntax prank:
sudo rm -rf /
it deletes every file and directory on the hard drive, -f switch forces the system to obey the command and / is the root of the drive