Unix CLI Tools

Disks and drives

Wipe empty space

sudo dd if=/dev/zero of=out bs=1M count=1024
shred -n 5 --remove out

Bootable drive

sudo dd if=Downloads/os.iso of=/dev/disk3 bs=4m && sync

General

date

date
date +"%Y-%m-%d"
date +%s

Files

sed

sed 's/foo/bar/g' file
sed 's#foo#bar#g' file
sed --in-place='' 's/foo/bar/g' file

find

shred

shred --remove file
find <dir> -type f -exec shred --remove {} \;

Access control

groupadd

groupadd foo

useradd

useradd \
	-s /bin/bash \
	-g foo \
	-m \
	bar