0
score
|
Print the lines of file2 that are missing in file1$ grep -vxFf file1 file2 |
1
score
|
Uses 'at' to run an arbitrary command at a specified time.$ echo 'play alarmclock.wav 2>/dev/null' | at 07:30 tomorrow |
1
score
|
Calculate an h index from an EndNote export$ MAX=$(NUM=1;cat author.xml |perl -p -e 's/(Times Cited)/\n$1/g'|grep "Times Cited" |perl -p -e 's/^Times Cited:([0-9]*).*$/$1/g'|sort -nr | while read LINE; do if [ $LINE -ge $NUM ]; then echo "$NUM"; fi; NUM=$[$NUM+1]; done;); echo "$MAX"|tail -1 |
1
score
|
Cut select pages from a pdf file and create a new file from those pages.$ pdftk input.pdf cat 2-4 7 9-10 output output.pdf |
0
score
|
Find in files, recursively$ find /etc -type f -print0 2>/dev/null | xargs -0 grep --color=AUTO -Hn 'nameserver' 2>/dev/null |
1
score
|
Re-compress a gzip (.gz) file to a bzip2 (.bz2) file$ time gzip -cd file1.tar.gz 2>~/logfile.txt | pv -t -r -b -W -i 5 -B 8M | bzip2 > file1.tar.bz2 2>>~/logfile .txt |
1
score
|
Test your hard drive speed$ time (dd if=/dev/zero of=zerofile bs=1M count=500;sync);rm zerofile |
1
score
|
Recursively remove all empty sub-directories from a directory tree$ find . -depth -type d -empty -exec rmdir {} \; |
1
score
|
Group count sort a log file$ A=$(FILE=/var/log/myfile.log; cat $FILE | perl -p -e 's/.*,([A-Z]+)[\:\+].*/$1/g' | sort -u | while read LINE; do grep "$LINE" $FILE | wc -l | perl -p -e 's/[^0-9]+//g'; echo -e "\t$LINE"; done;);echo "$A"|sort -nr |
1
score
|
Use ghostscript to shrink PDF files$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf |
1
score
|
How to find all hard links to a file$ find /home -xdev -samefile file1 |
1
score
|
Find all the unique 4-letter words in a text$ cat ipsum.txt | perl -ne 'print map("$_\n", m/\w+/g);' | tr A-Z a-z | sort | uniq | awk 'length($1) == 4 {print}' |
0
score
|
Concatenate PDF files using GhostScript$ gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=output.pdf -dBATCH file1.pdf file2.pdf file3.pdf |
0
score
|
Format text with long lines to text with fixed width$ fmt -s -w80 file.txt |
0
score
|
Come back quickly to the current directory after doing some temporary work somewhere else$ pushd /some/where/else; work; cd /somewhere; work; cd /another/place; popd |
0
score
|
Export a git project to a directory$ git archive master | tar x -C /path/to/dir/to/export |
0
score
|
Delete all tables of a mysql database$ mysql --defaults-file=my.cnf -e 'show tables' | while read t; do mysql --defaults-file=my.cnt -e 'drop table '$t; done |
0
score
|
Run remote X11 applications with ssh$ ssh -X servername |
0
score
|
Calculate the total disk space used by a list of files or directories$ du -s file1 dir1 | awk '{sum += $1} END {print sum}' |
1
score
|
Concatenate two or more movie files into one using mencoder$ mencoder cd1.avi cd2.avi -o movie.avi -ovc copy -oac copy |
1
score
|
Calculate the average execution time (of short running scripts) with awk$ for i in {1..10}; do time some_script.sh; done 2>&1 | grep ^real | sed -e s/.*m// | awk '{sum += $1} END {print sum / NR}' |
0
score
|
Check the performance of a script by re-running many times while measuring the running time$ for i in {1..10}; do time curl http://localhost:8000 >/dev/null; done 2>&1 | grep real |
1
score
|
0
score
|
1
score
|
Rotate a movie file with mencoder$ mencoder video.avi -o rotated-right.avi -oac copy -ovc lavc -vf rotate=1 |