In POSIX, file permissions are handled by rwx bits
File Compression
Process of reducing the size of one or more files to save storage space
Compress files in different folders without including the parent directories of the path
#!/bin/bashset -euset -o pipefail# Check if a filename argument is providedif [ "$#" -eq 0 ]; then echo "Usage: xyz <filename> <path1> [<path2> ...]" exit 1fifilename=$1# Create a temporary directorymkdir myTempZip# Copy required files to the temporary directoryfor arg in "${@:2}"; do cp -R "$arg" ./myTempZip echo "$arg"done# Navigate to the temporary directorycd myTempZip# Zip the contents of the directoryzip -r "$filename" *# Move the zip file to the parent directorymv "$filename" ../# Navigate back to the original directorycd ..# Remove the temporary directoryrm -rf myTempZip
Model IO Device that has a collection of randomly addressable blocks like like Flash Memory
Character Special Files
Model IO Device that accept or output a character stream like keyboard
Line Break in File
POSIX systems uses a single character called Line Feed\n
While Windows uses carriage return and Line Feed, so 2 characters \r\n. This is because during typewriter times, you needed to mov the carriage to restart typing on the beginning of a line first, then turn the wheel to move the paper to change the line
Hands-On!
You can install dos2unix and unix2dos using Brew to play with line break.
You can view the hidden line break character by downloading and configuring bat.
Useful CLi Tools
bat
A cat clone with wings.
brew install bat && echo "alias cat='bat'" >>~/.zshrc
dua
Manage files fast, powered by rust!
brew install dua-clidua interactive
xcp
cp on tren!
cargo install xcp# Alias to cpalias cp="xcp"
xxd
Generate a hexdump from a binary file and display the output