Earlier quoted context omitted.
same here - my cheatsheet is `history | grep`
I'm curious why history | grep and not ctrl-R?
Ask HN: Can I see your cheatsheet?
41–50 of 173 posts
Re: Ask HN: Can I see your cheatsheet?
#42On a related note: has anyone used a good tool for using/inserting these kinds of custom snippets? It would be neat to have a snippet manager with quick search bound to a keypress.
Re: Ask HN: Can I see your cheatsheet?
#43 - Find all files modified in the last 90 minutes
find . -type f -mmin -90
- Find all files and do something to each one
find . -type f -mmin -90 | xargs ls -l
- Find all files modified before 2 days ago
find . -type f -mtime +2
- Removing files older than 7 days
find . -type f -mtime +7 -name '*.gz' -exec rm {} \;
- Find all files modified after last 2 days
find . -type f -mtime -2
- Find all files modified at the last 2 day mark
find . -type f -mtime 2Re: Ask HN: Can I see your cheatsheet?
#44Earlier quoted context omitted.
I'm curious why history | grep and not ctrl-R?
Probably because ctrl-R doesn't present you a list in most shells. Maybe you want to scan the list visually and look at neighboring commands. ctrl-R doesn't really take advantage of human vision by showing all results next to each other.
Re: Ask HN: Can I see your cheatsheet?
#45 ln -s /the/target the_link (can never remember order)
for f in *.mp4; do mv "$f" "$(echo "$f" | sed s/S1E/S01E/)"; done
tar -theuniverse (insert xkcd here)
grep -E 'foo|bar' file (can never remember the flag for regex)Re: Ask HN: Can I see your cheatsheet?
#46- Find all files modified in the last 90 minutes find . -type f -mmin -90 - Find all files and do something to each one find . -type f -mmin -90 | xargs ls -l - Find all files modified before 2 days ago find . -type f -mtime +2 - Removing files older than 7 days find . -type f -mtime +7 -name '*.gz' -exec rm {} \; - Find all files modified after last 2 days find . -type f -mtime -2 - Find all files modified at the la…
Re: Ask HN: Can I see your cheatsheet?
#47Re: Ask HN: Can I see your cheatsheet?
#48You might like https://github.com/cheat/cheat/
Re: Ask HN: Can I see your cheatsheet?
#49 - List dirs and file count, to find dir with high file count.
for i in /home/*; do echo $i; find $i | wc -l; done
for i in /*; do echo $i; find $i | wc -l; done
- Report space usage of the top level subdirectories.
du -h --max-depth=2
- Report space summary only, no directory output.
du -s -h
- Find out which device a directory is in.
df /tmp
df /home
- Print of tree of directories
tree .
- Disk
fdisk -l, list disk partitions
lsblk, show a tree of disks, partitions, and lvm volumes
lsblk -d, show physical devices
lsblk -io KNAME,TYPE,SIZE,MODEL, name/type/size/modelRe: Ask HN: Can I see your cheatsheet?
#50See; https://news.ycombinator.com/item?id=31009313760 (78 days ago -- 245 comments)