0 added
0 removed
Original
2026-01-01
Modified
2026-02-21
1
<h3>Important note</h3>
1
<h3>Important note</h3>
2
<p>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.</p>
2
<p>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.</p>
3
<p>Basic wildcards are:</p>
3
<p>Basic wildcards are:</p>
4
<ul><li><ul><li><ul><li>represents zero or more characters</li>
4
<ul><li><ul><li><ul><li>represents zero or more characters</li>
5
</ul></li>
5
</ul></li>
6
</ul></li>
6
</ul></li>
7
<li>? - represents a single character</li>
7
<li>? - represents a single character</li>
8
<li>[] - represents a range of characters</li>
8
<li>[] - represents a range of characters</li>
9
</ul><p>Example:</p>
9
</ul><p>Example:</p>
10
<p>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</p>
10
<p>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</p>
11
<p>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.</p>
11
<p>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.</p>
12
<h3>Lesson notes</h3>
12
<h3>Lesson notes</h3>
13
<ul><li>mkdir to create directory</li>
13
<ul><li>mkdir to create directory</li>
14
<li>mkdir -p to create multiple levels of directories (e.g. mkdir -p dir1/dir2/dir3)</li>
14
<li>mkdir -p to create multiple levels of directories (e.g. mkdir -p dir1/dir2/dir3)</li>
15
<li>touch to change the date of a file or create a new file (e.g. touch newfile.txt)</li>
15
<li>touch to change the date of a file or create a new file (e.g. touch newfile.txt)</li>
16
<li>mv to move or rename a file or a directory (e.g. mv old_name new_name)</li>
16
<li>mv to move or rename a file or a directory (e.g. mv old_name new_name)</li>
17
<li>rm to delete a file (e.g. rm readme.txt)</li>
17
<li>rm to delete a file (e.g. rm readme.txt)</li>
18
<li>rm -r to delete a directory and all the directories inside it (e.g. rm -r photos)</li>
18
<li>rm -r to delete a directory and all the directories inside it (e.g. rm -r photos)</li>
19
</ul>
19
</ul>