def generate_dummy_file(file_path, size_gb): with open(file_path, 'wb') as f: f.write(b'\0' * (1024 * 1024 * 1024 * size_gb))file_path = input("Enter the name for the dummy file: ") + '.bin'size_gb = int(input("Enter the size in GB: "))generate_dummy_file(file_path, size_gb)print(f"Dummy file of size {size_gb}GB generated at '{file_path}'")
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