@@ -42,6 +42,20 @@ But you can be sure that all major Linux distros come with the binaries of those
4242
4343## Commonly used commands
4444
45+ <style >
46+ .table
47+ {
48+ font-size : 1rem !important ;
49+ }
50+
51+ .table th , .table td
52+ {
53+ border : 1px solid !important ;
54+ text-align : left !important ;
55+ padding : 6px !important ;
56+ }
57+ </style >
58+
4559<style >
4660 .command-table
4761 {
@@ -326,6 +340,65 @@ Just use ``#!/usr/bin/env bash`` for cross platform bash scripts.
326340
327341Just use `` #!/bin/bash `` or `` #!/usr/bin/env sh `` for cross platform posix scripts.
328342
343+ ## File globbing
344+
345+ In many tools including many shells you can filter your file or directory selection with something called ** Globbing** ,
346+ and its a way of quickly filtering your file or directory selection selection. If you want to select a specific set of files or directories
347+ from the command line you can use this following specific syntax that is specifically designed for that purpose.
348+
349+ ### Basics:
350+
351+ <table class =" table " >
352+ <tr >
353+ <td><code>.</code></td>
354+ <td>Current directory</td>
355+ </tr >
356+ <tr >
357+ <td><code>..</code></td>
358+ <td>Parent directory</td>
359+ </tr >
360+ <tr >
361+ <td><code>~</code></td>
362+ <td>Home directory</td>
363+ </tr >
364+ <tr >
365+ <td><code>*</code></td>
366+ <td>Matches any file or directory</td>
367+ </tr >
368+ <tr >
369+ <td><code>**</code></td>
370+ <td>Matches any file or directory recursively</td>
371+ </tr >
372+ <tr >
373+ <td><code>/</code></td>
374+ <td>Directory separator</td>
375+ </tr >
376+ </table >
377+
378+ ### Examples
379+
380+ ``` bash
381+ ls ./* # list all files and dirs in this dir
382+ ls ./** # list all files and dirs recursively starting from this dir
383+ ls ./* .txt # list all text files in this dir
384+ ls ./** /* .txt # list all text files recursively starting from this dir
385+ ls ./* .* # list any files with any extension in this directory
386+
387+ ls home/* # list all files and dirs inside home
388+ ls home/** # list all files and dirs recursively starting from home
389+ ls home/** /* .txt # list all text files recursively starting from home
390+
391+ cd .. # move to the parent directory
392+ cd ~ # move to the home directory
393+ cd / # move to the root directory
394+
395+ ls ./** # list all files and dirs recursively starting from this dir
396+ ls ./** /* .txt # list all text files recursively starting from this dir
397+ ls ./** /* .* # list all files with any extension recursively starting from this dir
398+ ls src/** /* .cpp # list all cpp files recursively starting from the src dir
399+ ls ./** /* .sh # list all shell scripts recursively starting from this dir
400+ ```
401+
329402## Basics of bash and scripting
330403
331404comming soon...
0 commit comments