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 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 3

  • 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

Change every instance of OLD to NEW in file FILE
Very quick way to change a word in a file. I use it all the time to change variable names in my PHP scripts (sed -i 's/$oldvar/$newvar/g' index.php)

SSH connection through host in the middle
Unreachable_host is unavailable from local network, but it's available from reachable_host's network. This command creates a connection to unreachable_host through "hidden" connection to reachable_host.

Picture Renamer

Kill all Zombie processes if they accept it!
Tested on FreeBSD 8.1 and CSH. The scripts works correctly but the Zombies do not die! I hope it will run and function as expected in Linux and others.

delete all trailing whitespace from each line in file

A DESTRUCTIVE command to render a drive unbootable
Overwrites the boot sector. Since this doesn't overwrite any data, you can usually recover by re-creating the partition table exactly the same as before you zeroed it. This can also help sometimes if you install a new drive in a Windows machine which can't read it.

Recursively remove .svn directories

Reduce PDF size

Better git diff, word delimited and colorized
Define a git alias then git dcolor

start a tunnel from some machine's port 80 to your local post 2001
now you can acces the website by going to http://localhost:2001/


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: