Commands by mrehqe (5)

  • Convert all wma to [email protected] 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 4
  • 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 4

  • 0
    sed ':a;N;$!ba;s/\n\n/\n%\n/g' input.txt >output
    mrehqe · 2011-11-06 11:55:33 0
  • 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 0
  • 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 0

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

Simulate slow network connection locally
Replace 500ms by the desired delay. To remove it: sudo tc qdisc del dev lo root netem delay 500ms

Decrypt passwords from Google Chrome and Chromium.
Read this before you down voting and comment that it is not working -> Wont work on latest versions ~75> since database file is locked and has to be decrypted. This is useful if you have an old hdd with a chrome installation and want to decrypt your old passwords fast.

Yet Another Large Screen Clock

Copy via tar pipe while preserving file permissions (cp does not!; run this command with root!)
cp options: -p will preserve the file mode, ownership, and timestamps -r will copy files recursively also, if you want to keep symlinks in addition to the above: use the -a/--archive option

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" }

Find the package that installed a command

Resample a WAV file with sox
Change the sample rate with sox, the swiss army knife of sound processing.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Remove a range of lines from a file

Display ncurses based network monitor
Nload is part of nload package, tested under Debian. Nload display network bandwidth statistics, -u m options stands for MBit unit measure.


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: