2
score
|
Create a thumbnail from the first page of a PDF file$ convert -thumbnail x80 file.pdf[0] thumb.png |
0
score
|
Recreate or update an existing zip file and remove files that do not exist anymore$ zip --filesync -r /path/to/out.zip /path/to/dir |
3
score
|
Remove offending key from known_hosts file with one swift move$ sed -i 18d .ssh/known_hosts |
0
score
|
How to expand a CIDR notation to its IPs$ for j in $(seq 0 255); do for i in $(seq 0 255) ; do seq -f "10.$j.$i.%g" 0 255; done; done |
1
score
|
Get load average in a more parse-able format$ python -c 'import os; print os.getloadavg()[0]' |
1
score
|
Function to extract columns from an input stream$ col() { awk '{print $('$(echo $* | sed -e s/-/NF-/g -e 's/ /),$(/g')')}'; } |
5
score
|
Show dd status every so often$ watch --interval 5 killall -USR1 dd |
0
score
|
Make the output of the `time` builtin easier to parse$ TIMEFORMAT=%R |
1
score
|
Define an own watch(1)-like function$ watch () { interrupted=false; trap "interrupted=true" INT; while ! $interrupted; do $*; sleep 1 || interrupted=true; done; } |
1
score
|
Remove offending key from known_hosts file with one swift move$ vi +18d +wq ~/.ssh/known_hosts |
1
score
|
Replace the header of all files found.$ find . -type f -name '*.html' -exec sed -i -e '1r common_header' -e '1,/STRING/d' {} \; |
0
score
|
Remove EXIF data such as orientation from images$ mogrify -strip /path/to/image.jpg |
0
score
|
Get the last modification date of a file in any format you want$ date -r /etc/motd +%Y%m%d_%H%M%S |
0
score
|
Forget all remembered path locations$ hash -r |
0
score
|
Rename files with numeric padding$ perl -e 'for (@ARGV) { $o = $_; s/\d+/sprintf("%04d", $&)/e; print qq{mv "$o" "$_"\n}}' |
0
score
|
Copy or create files with specific permissions and ownership$ install -b -m 600 /dev/null NEWFILE |
1
score
|
Redirect stdout to a file you don't have write permission on$ echo hello | sudo tee -a /path/to/file |
1
score
|
`tail -f` a file until text is seen$ tail -f /path/to/file.log | sed '/^Finished: SUCCESS$/ q' |
0
score
|
Run command multiple times with a for loop and a sequence expression$ for i in {1..10}; do date; sleep 1; done |
1
score
|
Recording SSH sessions$ ssh -l USER HOST | tee -a /path/to/file |
0
score
|
Clear the swap space forcing everything back to main memory in Linux$ sudo swapoff -a; sudo swapon -a |
0
score
|
Redirection operator to override the noclobber option$ some_command >| output.txt |
0
score
|
How to set the ip address in Solaris 11$ ipadm create-addr -T static -a 192.168.1.10/24 eth0/staticaddr |
1
score
|
Record audio from microphone or sound input from the console$ sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | lame -x -m s - File.mp3 |
1
score
|
Use vim to pretty-print code with syntax highlighting$ vim +'hardcopy > output.ps' +q style.css |