Useful Commands/Low Level IO

From Fundamental Ramen
Jump to navigation Jump to search
🎯 Purpose ⌨️ Command
list with color and suffix for dir and link
ls -FG
list add hidden files only single quote is necessary
find . -name '.*'
delete dist directory recursively except README.md and itself.
find ../../assets/swagger/support ! -path *swagger/support ! -name 'README.md' -delete
delete files that filename leads by - or --
rm -- -X --exclude-from
Set file mtime
2013-09-01 00:00:00
touch -t 201309010000 FILENAME
create ramdisk for Linux (cannot set size)
mount -t ramfs ramfs /usr/local/ramdisk
create ramdisk for Linux/BSD
mount -t tmpfs -o size=128m tmpfs /usr/local/ramdisk
Test I/O performance of 1G write with 4K block
dd if=/dev/zero of=100k.bin bs=4k count=262144
Create file with 100K size
dd if=/dev/zero of=100k.bin bs=1k count=100
Create file with 1M size
No warning on disk full
dd if=/dev/zero of=10m.bin bs=1m count=10
Simulate memory consumption (RAM+SWAP)
mkdir /usr/local/ramdisk
mount -t tmpfs -o size=2G tmpfs /usr/local/ramdisk
dd if=/dev/zero of=/usr/local/ramdisk/fill.bin bs=1m count=2048