Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Universal configuration monitoring and system of record for IT.
Hide

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:

Hide

News

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

Convert PDF to JPG

Terminal - Convert PDF to JPG
for file in `ls *.pdf`; do convert -verbose -colorspace RGB -resize 800 -interlace none -density 300 -quality 80 $file `echo $file | sed 's/\.pdf$/\.jpg/'`; done
2009-02-15 23:27:43
User: brettalton
Functions: file sed
28
Convert PDF to JPG

(relies on 'imagemagick')

This command will convert all .pdf files in a directory into a 800px (wide or height, whichever is smaller) image (with the aspect ratio kept) .jpg.

If the file is named 'example1.pdf' it will be named 'example1.jpg' when it is complete.

This is a VERY worthwhile command! People pay hundreds of dollars for this in the Windows world.

My .jpg files average between 150kB to 300kB, but your's may differ.

Alternatives

There are 4 alternatives - vote for the best!

Terminal - Alternatives
for file in *.pdf; do convert -verbose -colorspace RGB -resize 800 -interlace none -density 300 -quality 80 "$file" "${file//.pdf/.jpg}"; done
2014-06-19 15:52:42
User: malathion
Functions: file
Tags: pdf convert
3

Without the bashisms and unnecessary sed dependency. Substitutions quoted so that filenames with whitespace will be handled correctly.

Know a better way?

If you can do better, submit your command here.

What others think

that ls is unnecessary. should be:

for file in *.pdf

also, you're file rename should at the end of the command should be:

{file} ${file%%pdf}jpg

all in all:

for file in *.pdf; do convert -verbose -colorspace RGB -resize 800 -interlace none -density 300 -quality 80 $file ${file%%pdf}jpg; done

Comment by hso 413 weeks and 2 days ago

it works good except when you have files with blank spaces in it

Comment by enricogalli 259 weeks and 6 days ago

hso command works. Brettalton's fails if there is space in the file name.

Comment by andreas 250 weeks and 6 days ago

hso and brettalton's commands fails if there is space in the filename.

This works with spaces in filenames:

for file in *.pdf; do convert -verbose -colorspace RGB -resize 800 -interlace none -density 300 -quality 80 "$file" "${file%%pdf}"jpg; done
Comment by egeoffray 206 weeks ago

Finding excellent X-mas present methods for brother or perhaps man actually has to be fun. After a little creative imagined, you'll prepare yourself to be able to shock your guy having a honestly strange The holiday season provide this trip. In the beginning, we're going to absolutely discuss the typical provides on your close friend or even partner pertaining to X-mas occasion. Man generally choose to seem stylish so a fresh sweatshirt through his favored name of clothes is bound to be described as a attack, as well as a most up-to-date motion picture or even dvd consoles that they loves are sometimes uncomplicated gifts that you can find out.Making using the solutions to ideas with this reality document assist you with the electronic cameras. Even when you have a high-end photographic camera really does certainly necessarily indicate you expect in order to at the same time look into superb endeavors. Make use of most of these principles just before aiming to distribute your current photos or perhaps turn out together released, and find all set to the text involving aid from loved ones along with acquaintances, involving particularly a great task you are doing!Tote bags are among essentially the most extremely versatile bags accessible. The actual Handbags household is not necessarily protected from in which overview. The actual Hand bags Obvious Carrier has gone out decide on for the the fall. The actual outstanding aspect of take bags is the application they might be intended for. You can sock aside many career report files, their particular Mac laptop as well as fashionable sweater for the wintry nights. They offer a doubly fashionable strategy to possessing your pc program all-around then your essential mobile computer bags presented on all those main system retailers.Skinny associations are generally the majority of preferred instantly on account of the slim meet up with, white tee shirt and skinny the particular "mad men" type which includes crowded the men style business. If you do not want to used funds on the novelty that can are not permanent after that this can be the great connect in your case. Kenneth Cole associations are around every corner inside gold as well as black and are fairly correctly http://www.hermesbeltsbirkinkellybag.co.uk/ costed.In your Oughout.Azines., incomes duty is a wonderful offer added underhanded. This doesn't search until you happen to be standing around the actual take a look at only when it's just included with your time and money price.As could, Momâ& acirc; EUR(TM )ersus Day time will definitely turn up. We should buy several presents for our mother, home in addition to buddies. Presently I do believe Electric outlet bags is efficient always be to be a current, mainly because, It's extremely chosen over each and every fashion lovers, and all of items on the website a popular brand, amazing model, many kinds to decide on, greatest high-quality, most of these reasons help to make bags inhospitable inside present moment.With the start Dec, men and women explain"Satisfied The holiday season! Jesus may be the reason behind the season! Enthusiasm was birthed on Holiday. This particular kid birthed on Christmas each of our unceasing wish came to be the child connected with God, with which The almighty invested much admiration in addition to capacity to make sure we're able to possibly be fulfilled in their living. Trade this offers the item will show you are generally desire to others. Currently do you want to get some sort of X-mas items, We have some tips I wish to give you. Shopping on the web is often a terrific idea for those that do not intend to head out to the purchasing race proper just before as well as on Christmas Eve. With a great variety of giving gifts concepts as well as gifts to select from in all of the pace ranges, on-line shopping is an outstanding substitute this particular The holiday season.Contrast very reduced costs car insurance policy plan with Sc can be at the moment an easy and easy come up with a big difference a number of thanks to sign up for the internet along i will profusion associated with internet sites that let you critique car an insurance plan costs from several diverse insurance firms. Nevertheless, just packing directly into precisely in one assessment web url of your website with no an authentic method for obtaining the least expensive probable variety is actually alternatively pointless.

Comment by stephanieg915 1 day ago

Your point of view

You must be signed in to comment.