Commands by brettalton (5)

  • (relies on 'imagemagick') Convert all .png files to .gif. This can also go the other way if you reverse the file extensions in the command, e.g.: for file in *.gif; do convert "$file" "$(basename $file .gif).png"; done If the file is named 'example1.png' it will be named 'example1.gif' when it is complete.


    4
    for file in *.png; do convert "$file" "$(basename $file .png).gif"; done
    brettalton · 2009-02-15 23:39:08 15
  • (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. Show Sample Output


    29
    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
    brettalton · 2009-02-15 23:27:43 20
  • .daa is a non-standard disk image format that can not be read by any other program. This is how you can extract the files though. PowerISO binary for Linux: http://www.poweriso.com/poweriso-1.3.tar.gz "This is a free utility for linux which can extract, list, and convert image files (including ISO, BIN, DAA, and other formats). Type " poweriso -? " for detailed usage information. File Size: 278KB"


    -2
    ./poweriso extract $USER/file.daa / -od $USER/file_extracted
    brettalton · 2009-02-15 23:19:40 9
  • In July 2008, there was an uproar over Foxconn motherboards feeding Linux installs incorrect ACPI information (http://ubuntu-virginia.ubuntuforums.org/showthread.php?t=869249). Foxconn has gladly corrected their mistake, but make sure it's not happening on your motherboard! After running the command, just view the 'dsdt.dsl' in any editor you like. Show Sample Output


    -1
    sudo aptitude -y install iasl && sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.dat && iasl -d dsdt.dat
    brettalton · 2009-02-15 23:13:50 13
  • Use mencoder to concatenate (join) multiple video files together. Show Sample Output


    9
    mencoder -forceidx -ovc copy -oac copy -o output.avi video1.avi video2.avi
    brettalton · 2009-02-15 23:05:32 13

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

rename anime fansubs
renames Anime Episodes to files, that can be parsed by sonarr & co

Google verbatim search on your terminal
Put it in your ~/.bashrc usage: google word1 word2 word3... google '"this search gets quoted"'

Optimize Xsane PDFs
Xsane produces PDFs that are too large - particularly multipage PDFs. This command compresses them. If you do not use A4, remove the -sPAPERSIZE flag.

Customer Friendly free
makes more sense to customers XD

Run a command as root, with a delay
$ sleep 1h ; sudo command or $ sudo sleep 1h ; sudo command won't work, because by the time the delay is up, sudo will want your password again.

Detect illegal access to kernel space, potentially useful for Meltdown detection
Based on capsule8 agent examples, not rigorously tested

Find all files under a certain directory /home that have a certain suffix at the end of the file name. Show the file and rename them to remove the suffix.

Ultimate current directory usage command
Based on the MrMerry one, just add some visuals to differentiate files and directories

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

easily strace all your apache *child* processes
Like the original version except it does not include the parent apache process or the grep process and adds "sudo" so it can be run by user.


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: