Info on that horrible operating system that's a million times better than Micro$oft Windoze. Why do I say it's horrible? Mostly because I don't spend enough time there to know how to do things and figuring it out is often a PITA.
grep MemTotal /proc/meminfo | tr -s ' ' | cut -d ' ' -f 2 | xargs printf "%'d\n"
Bonus: That particular command tells you how much memory is installed. I think.
echo 172.16.16.112/30 | awk -F '[./]' '{printf "%03d.%03d.%03d.%03d/%03d\n", $1,$2,$3,$4,$5}' 172.016.016.112/030
My preferred date/time format is ISO 8601.
date '+%Y-%m-%d_%H:%M:%S'
Can also be accomplished with…
date '+%F_%T'
Specific timezone and 3 hours in the future…
TZ="America/New_York" date -d "+3 hours" '+%Y-%m-%d_%H:%M:%S'
I never remember how to find old files… either of these will work. The second one uses minutes (I don't know why you'd want to) and shows how to exclude files.
find DIR -name "*_FILENAME-*.gz" -mtime +45 find . ! -name '*NOT_THIS*.gz' -mmin +$((45*24*60))
Add this to the end and anything that matches will be deleted.
-exec rm -f {} \;
Limit depth to current directory.
find . -maxdepth 1 -name "v*.tar.gz" -mtime +30
# to delete empty dirs
find -type d -empty -delete
# to delete files over some age & empty dirs
find /some/path -depth \( \( -type f -daystart -mtime +100 \) -o -type d -empty \) -ls
Useful for finding which directory is sucking up all your disk space.
du -h --max-depth=1 | sort -hr