Wildcards are building blocks for patterns that match files or directories. When you use
ls or any other command that
works with files and directories, you provide a path (recall relative and absolute paths from the previous lesson). When
you refer to a path, you can also use wildcards that will possibly match multiple files or directories at once.
Basic wildcards are:
ls docs/photos saturday.jpg sunday.jpg dog.jpg machine.jpg scan.tiff scan2.tiff ls docs/s* saturday.jpg sunday.jpg ls docs/*.jpg saturday.jpg sunday.jpg dog.jpg machine.jpg
Also, remember the shortcut for "home directory" — it's
~. You can use it in paths. For example, if your home
~/docs is the same as
mkdirto create directory
mkdir -pto create multiple levels of directories (e.g.
mkdir -p dir1/dir2/dir3)
touchto change the date of a file or create a new file (e.g.
mvto move or rename a file or a directory (e.g.
mv old_name new_name)
rmto delete a file (e.g.
rm -rto delete a directory and all the directories inside it (e.g.
rm -r photos)