Disks and File Systems
Archiving vs Compressing
- Archiving packs multiple files and directories into a single file:
tar -cf files file1 file2gives mefiles.tar - Compressing is reducing the size:
gzip file1gives mefile1.gz.gzipis for zipping, andgunzipis for unzipping. It is not gun-zip, it is g-unzip. It all makes a lot of sense now. 🤦 - These generally go hand in hand, which is how we end up with
.tar.gzfiles or.tgz. - If you want to view the contents of a file before extracting them,
tar -tvf <filename>.tar. - To decompress and unarchive a file we do:
tar -xvfz <filename>.tar.gz, wherezis forzcatwhich is pretty muchgunzipwith a couple flags.
Linux directory hierarchy
Here's a blogpost from linuxhandbook explaining it. Highlights:
/etcis pronounced EHT-see, like the store and not et cetera. 🤦/tmpis temporary files that get wiped, but/var/tmpisn't./optis for additional third-party software. Not widely used, but the general practice is to symlink the binary from/optto/bin./usr/local/includehas the header files used by the C compiler.