Important note
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:
- - - represents zero or more characters
- ? - represents a single character
- [] - represents a range of characters
Example:
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 directory is /home/michael, then ~/docs is the same as /home/michael/docs.
Lesson notes
mkdirto create directorymkdir -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.touch newfile.txt)mvto move or rename a file or a directory (e.g.mv old_name new_name)rmto delete a file (e.g.rm readme.txt)rm -rto delete a directory and all the directories inside it (e.g.rm -r photos)