Commands by mrehqe (5)

  • Convert all wma to mp3@128k with ffmpeg into directory.


    1
    for f in *.wma; do ffmpeg -i "$f" -ab 128k "${f%.wma}.mp3" -ab 128K; done
    mrehqe · 2011-11-25 17:48:26 6
  • Crop several images by imagemagik's convert command. substitute , ,, with pixel value and with a different existent directory.


    -2
    for k in *.png; do convert $k -crop <width>x<high>+<cropwidth>+<cropthigh> <newpath>/$k; done
    mrehqe · 2011-11-14 17:04:15 6

  • 0
    sed ':a;N;$!ba;s/\n\n/\n%\n/g' input.txt >output
    mrehqe · 2011-11-06 11:55:33 2
  • Use w_scan to build italian DTT video channel list. To change country, substitute IT with 2 letter country code. Userful to be played in vlc by: vlc -f dvb-channels.conf Show Sample Output


    0
    w_scan -X -P -t 2 -E 0 -c IT > dvb-channels.conf
    mrehqe · 2011-11-04 11:17:31 6
  • Great for telnet stream. Substitute aa with caca for colour. To see in terminal: cat video.txt Show Sample Output


    0
    mplayer -vo aa:eight:driver=curses video.avi >video.txt
    mrehqe · 2011-10-31 10:06:10 4

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Check syntax of remote ruby file

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

Add prefix onto filenames
Best to try first with -n flag, to preview

function to verify an IP address - can be used at the shell prompt or in a shell script
When processing IP addresses in the shell (or shell script) it is useful to be able to verify that the value of data is an IP address (an not some random string or non-sensible IP address).

Show whats going on restoring files from a spectrum protect backup
spectrum protect's dsmc command shows file names and total amount of restore. This command shows which files are actually open and their siz in GB and highlights the change to the previous output

Check difference between two file directories recursively

list files recursively by size

Advanced python tracing
Trace python statement execution and syscalls invoked during that simultaneously

check open ports without netstat or lsof

Rename files in batch


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: