0
score
|
Really lazy way to print the first instance of $foo that occurs after $bar$ ifconfig | grep ^en1 -A5 | grep inet | head -n 1 |
0
score
|
Print the first instance of $foo that occurs after $bar$ sed -n '\@interface Ethernet3/1@,/!/ s/ip address/&/p' file... |
0
score
|
Print the first instance of $foo that occurs after $bar$ awk '/interface Ethernet3\/1/ {instanza=1} /!/ {instanza=0} instanza && /ip address/ {print}' file... |
0
score
|
Sort du output in Human-readable format$ du -hsx * | sort -rh |
0
score
|
Replace symlinks with the actual files they are pointing at$ find /path/to/dir -type l -exec sh -c 'cp --remove-destination "$(readlink "{}")" "{}"' \; |
0
score
|
Expire a user's password immediately$ chage -d 0 USERNAME |
0
score
|
Convert any 16:9 video to play on a QHD widescreen Android phone$ ffmpeg -i $1 -y -threads 0 -subq 6 -deinterlace -level 30 -f mp4 -acodec libfaac -ab 160k -ar 24000 -ac 2 -vcodec libx264 -b 1000k -maxrate 1000k -bufsize 2000k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -coder 0 -refs 2 -flags +loop -vol 256 -trellis 1 -me_method umh -async 1 $2 |
0
score
|
Sort du output in Human-readable format$ for i in G M K; do du -hsx * | grep "[0-9]$i\b" | sort -nr; done 2>/dev/null |
0
score
|
Sort du output in Human-readable format$ for i in $(echo -e 'G\nM\nK'); do du -hsx /* 2>/dev/null | grep '[0-9]'$i | sort -rn; done |
0
score
|
Convert a decimal number to octal, hexadecimal, binary, or anything$ echo 'obase=2;1234' | bc |
0
score
|
Convert from avi format to mp4 encoding$ ffmpeg -i file.avi file.mp4 |
0
score
|
Format input into multiple columns, like a table, useful or pretty-printing$ mount | column -t |
0
score
|
Function to extract columns from an input stream$ col() { awk '{print $'$(echo $* | sed -e 's/ /,$/g')'}'; } |
0
score
|
Resize an image proportionally to some specified width or height$ mogrify -geometry x31 path/to/image.gif |
0
score
|
Do something in another directory without going there$ (cd /path/to/somewhere; tar c .) > somewhere.tar |
0
score
|
Remove carriage return '\r' character in many files, without looping and intermediary files$ recode pc..l1 file1 file2 file3 |
0
score
|
Find the target path a symlink is pointing to$ readlink a_symbolic_link_to_somewhere |
0
score
|
0
score
|
0
score
|
Find the most recently modified files in a directory and all subdirectories$ find /path/to/dir -type f -mtime -7 -print0 | xargs -0 ls -lt | head |
0
score
|
List open files$ lsof -n |
0
score
|
Set a colorful bash prompt per dev test prod environments$ PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] ' |
0
score
|
Print the lines of file2 that are missing in file1$ grep -vxFf file1 file2 |
0
score
|
Find in files, recursively$ find /etc -type f -print0 2>/dev/null | xargs -0 grep --color=AUTO -Hn 'nameserver' 2>/dev/null |