Fork me on GitHub

HistSync.io: cloud .bash_history

HistSync automatically uploads every command you type,
and lets you bookmark and share the most important commands.

Install now » Read FAQ »

Shared by eleweek 2 years ago

Dump 1 frame using mplayer(i.e. take a screenshot)

 $ mplayer -vo jpeg -frames 1 -ss 40 <file>
Shared by raoulvdberge 2 years ago

Squash commits

 $ git reset --soft HEAD~<number of commits to squash> && git commit
Shared by 1135586 2 years ago

Find the largest top 5 files and directories from cwd

 $ sudo du -hsx * | sort -rh | head -5
Shared by eleweek 2 years ago

Count the number of times each line occurs in a file

 $ cat <something> | awk '{a[$0]++} END{for (i in a) print i, a[i]}'
Shared by elimohl 2 years ago

Restore datababase from dump file

 $ pg_restore -d mydb dumpfile 
Shared by raoulvdberge 2 years ago

 $ echo This is awesome!
Shared by eleweek 2 years ago

(On OS X) count how many characters are in the clipboard

 $ pbpaste | wc -c
Shared by elimohl 1 year, 11 months ago

select all interval more than 3 days when there is no date

 $ cat huh.dmp | xargs -n 1 -I {} date --date={} +%s | awk '{if (prev != 0) if ($1 - prev > 3 * 24 * 60 * 60) {print "@" prev "\n" "@" $1}; prev = $1}' | xargs -n 1 -I {} date --date={} +%d.%m.%y | awk 'ORS=NR%2 ? "\t" : "\n"'
Shared by lwgray 2 years ago

All user processes launched from tty

 $ ps x
Shared by patallen 2 years ago

 $ git add -A
Shared by elimohl 2 years ago

count length of string

 $ echo -n string | wc -m
Shared by elimohl 2 years ago

run docker container

 $ docker run -it --rm image command
Shared by elimohl 2 years ago

built docker image

 $ docker build -t image_name directory
Shared by cenrak 2 years ago

 $ vim /etc/yum.repos.d/epel.repo 
Shared by cenrak 2 years ago

 $ yum install man