Commands by inductiveload (1)

  • Convert an SVG to PNG and then crush the filesize brutally with pngcrush. Good for icons and website junk that you want to keep small, expecially before base64 encoding. Uses inkscape, not imagemagick, as IM doesn't always handle gradients well. This way also seems to sometime save some file size (eg. 619 with Inkscape compared to 695 with IM). IM can do general images: img2png(){ png="${1%.*}.png"; convert -background none "$1" "$png" && pngcrush -brute -rem alla -rem text "$png" "$" && mv "$" "$png"; }

    svg2png(){ png="${1%.*}.png"; inkscape --export-png="$png" --without-gui "$1" && pngcrush -brute -rem alla -rem text "$png" "$" && mv "$" "$png";}
    inductiveload · 2013-05-08 15:21:52 0

What's this? 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

Repeatedly purge orphaned packages on Debian-like Linuxes
Upgraded Debian/Ubuntu/etc. systems may have a number of "orphaned" packages which are just taking up space, which can be found with the "deborphan" command. While you could just do "dpkg --purge $(deborphan)", the act of purging orphans will often create more orphans. This command will get them all in one shot.

Quick and dirty convert to flash
This converts any media ffmpeg handles to flash. It would actually convert anything to anything, it's based on the file extension. It doesn't do ANY quality control, sizing, etc, it just does what it thinks is best. I needed an flv for testing, and this spits one out easily.

rotate the compiz cube via command line
0-1279 = desktop 1 region = face 1 1280-2559 = face 2 ==>> wmctrl 1280 = wmctrl (1281,...2559) are all the same for a 1280 monitor resolution math: argument of wmctrl -o = ( DesiredFace * HorizontalResolution - 1)

Delete all local git branches that have been merged
This checks if the branch has been merged with master and then will delete the ones that have been. Keeps your local git repo nice and clean from all the branches.

full path listing in /directory/path/* of javascript files.
file listing in /directory/path/* of specific files such as javascript(js) .

list files recursively by size

Get technical and tag information about a video or audio file
MediaInfo supplies technical and tag information about a video or audio file. (sudo apt install mediainfo)

autossh + ssh + screen = super rad perma-sessions
Only useful for really flakey connections (but im stuck with one for now). Though if youre in this situation ive found this to be a good way to run autossh and it does a pretty good job of detecting when the session is down and restarting. Combined with the -t and screen commands this pops you back into your working session lickety split w/ as few headaches as possible. And if autossh is a bit slow at detecting the downed ssh connection, just run this in another tab/terminal window to notify autossh that it should drop it and start over. Basically for when polling is too slow. kill -SIGUSR1 `pgrep autossh`

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Recursively grep for string and format output for vi(m)
This is a big time saver for me. I often grep source code and need to edit the findings. A single highlight of the mouse and middle mouse click (in gnome terminal) and I'm editing the exact line I just found. The color highlighting helps interpret the data.

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.


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: