0 = STDIN
1 = STDOUT
2 = STDERR
cat > output.txt
cat 1> output.txt
cat >> output.txt
Redirection of STDOUT breaks pipelines
cat -k asdf 2> error.txt
cat -k asdf 2>> error.txt
cat 0< index.html 1> index.php
cat < index.html > index.php
Piping connects STDOUT of one command to the STDIN of another
date | cut -d " " -f 1
date | cut -d " " -f 2 > ~/month.txt
To save a data 'snapshot' without breaking pipelines
date | tee ~/date.txt | cut -d " " -f 1 > today.txt
To pipe if command does not accept STDIN
date | cut -d " " -f 1 | xargs echo
cat files_to_delete.txt | xargs rm
Directory | Purpose |
---|---|
**/ ** | Root |
**/bin ** | Common user command binaries ex. date, cat, cal |
**/boot ** | Bootable linux kernel and bootloader config files |
**/dev ** | Devices ex. tty=terminal, sd or hd = hard disks, ram etc. |
**/home ** | Home directories for regular users |
**/media ** | Removable media mounting directory ex. usb |
**/lib ** | Libraries needed by applications in /bin and /sbin to boot the system |
**/mnt ** | External devices mounting directory (supressed by /media ) |
**/misc ** | Used to sometimes automout filesystems on request |
**/opt ** | Directory structure used to store additional software |
**/proc ** | Information about system resources |
**/root ** | Home folder for the root user |
**/sbin ** | Administrative command binaries for super user |
**/tmp ** | Temporary files used by running apps |
**/usr ** | Users files that don't change after installation |
**/var ** | Variable data ex. logs |
**/etc ** | Administrative config files |
mkdir {jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec}_{2020, 2021}
touch file_{a..z}_{0..9}.txt
*
matches anything?
matches anything but just for one place[]
matches just one place but allow to specify regular expression
ls file*.txt
ls file?.txt
ls file[0-9].txt