Commands by pcardout (1)

  • convert -resize 750?500 -quality 80% *.jpg These are command-line invocations of ImageMagick functions. The first sizes an image file to 40% of original and saves it to a different name, while the second makes all jpg files in a directory sized to 750x500 pixels. Such a pleasure not to need to point and click to make a bunch of thumbnails -- for example.


    0
    convert panorama_rainbow_2005.jpg -resize 40% panorama_rainbow_compress.jpg
    pcardout · 2009-02-15 08:24:50 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

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

sort the contents of a text file in place.
sorts the contents of a file without the need for a second file to take the sorted output. This was previously entered as `sort -g list.txt -o $_` but as others have pointed out the $_ references the previous command. so this would've worked had that been the second part of a command joined with && like: cat list.txt && sort -g list.txt -o $_ The user below me Robin had the most correct command.

Make vim open in tabs by default (save to .profile)
I always add this to my .profile rc so I can do things like: "vim *.c" and the files are opened in tabs.

Ping sweep without NMAP
Ping sweep without NMAP

Compare a remote file with a local file
Useful for checking if there are differences between local and remote files.

create a new script, automatically populating the shebang line, editing the script, and making it executable.
The first argument is the interpreter for your script, the second argument is the name of the script to create.

Test speaker channels
Useful tool to test if all speaker channels are working properly. speaker-test is part of alsa-utils package

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

Capitalize first letter of each word in a string
I find it useless but definitely simpler than #9230

Create multiple subfolders in one command.


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: