Commands by nickleus (9)


  • 5
    for f in *;do flac -cd $f |lame -b 192 - $f.mp3;done
    nickleus · 2010-10-19 07:55:11 3
  • i have a large video file, 500+ MB, so i cant upload it to flickr, so to reduce the size i split it into 2 files. the command shows the splitting for the first file, from 0-4 minutes. ss is start time and t is duration (how long you want the output file to be). credit goes to philc: http://ubuntuforums.org/showthread.php?t=480343 NOTE: when i made the second half of the video, i got a *lot* of lines like this: frame= 0 fps= 0 q=0.0 size= 0kB time=10000000000.00 bitrate= 0.0kbit just be patient, it is working =) Show Sample Output


    2
    ffmpeg -i 100_0029.MOV -ss 00:00:00 -t 00:04:00 100_0029_1.MOV
    nickleus · 2010-08-08 23:43:28 3
  • if you haven't already done so, install lame and flac: sudo apt-get install lame flac Show Sample Output


    2
    flac -cd input.flac |lame -h - output.mp3
    nickleus · 2010-03-05 23:54:21 4
  • if you still get a permissions error using sudo, then nano the file: sudo nano -w /sys/block/sdb/queue/rotational and change 1 to 0 this thread: http://www.ocztechnologyforum.com/forum/showpost.php?p=369836&postcount=15 says that this will "help the block layer to optimize a few decisions"


    5
    sudo echo 0 > /sys/block/sdb/queue/rotational
    nickleus · 2009-11-27 12:16:17 10
  • The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. in ubuntu to get the iostat program do this: sudo apt-get install sysstat i found this command here: http://www.ocztechnologyforum.com/forum/showthread.php?t=54379 Show Sample Output


    3
    iostat -m -d /dev/sda1
    nickleus · 2009-11-27 12:00:48 5
  • why would you want to convert mp3's to ogg? 1 reason is because ardour doesn't support mp3 files because of legal issues. this is really the only reason you would do this, unless you have really bad hearing and also want smaller file sizes, because converting from one lossy format to another isn't a good idea. Show Sample Output


    -1
    mp32ogg file.mp3
    nickleus · 2009-11-16 20:22:48 5
  • cd to the folder containing the wav files and convert them all to ogg format. in my sample output i use the -a and -l flags to set the author and album title. to get the oggenc program in ubuntu linux run: sudo apt-get install oggenc Show Sample Output


    2
    oggenc *.wav
    nickleus · 2009-11-11 14:26:01 6
  • cd to the folder containing the wav files, then convert them all to flac. yeah baby! in ubuntu, to get the flac program just: sudo apt-get install flac flac file input formats are wav, aiff, raw, flac, oga and ogg Show Sample Output


    3
    flac --best *.wav
    nickleus · 2009-11-11 14:17:24 9
  • search ubuntu's remote package source repositories for a specific program to see which package contains it Show Sample Output


    7
    apt-file find bin/programname
    nickleus · 2009-11-10 10:21:45 6

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

Replicate a directory structure dropping the files

diff files while disregarding indentation and trailing white space
**NOTE** Tekhne's alternative is much more succinct and its output conforms to the files actual contents rather than with white space removed My command on the other hand uses bash process substitution (and "Minimal" Perl), instead of files, to first remove leading and trailing white space from lines, before diff'ing the streams. Very useful when differences in indentation, such as in programming source code files, may be irrelevant

find out how many days since given date
You can also do this for seconds, minutes, hours, etc... Can't use dates before the epoch, though.

Graphically show percent of mount space used
Automatically drops mount points that have non-numeric sizes (e.g. /proc). Tested in bash on Linux and AIX.

Adequately order the page numbers to print a booklet
Useful if you don't have at hand the ability to automatically create a booklet, but still want to. F is the number of pages to print. It *must* be a multiple of 4; append extra blank pages if needed. In evince, these are the steps to print it, adapted from https://help.gnome.org/users/evince/stable/duplex-npage.html.en : 1) Click File ▸ Print. 2) Choose the General tab. Under Range, choose Pages. Type the numbers of the pages in this order (this is what this one-liner does for you): n, 1, 2, n-1, n-2, 3, 4, n-3, n-4, 5, 6, n-5, n-6, 7, 8, n-7, n-8, 9, 10, n-9, n-10, 11, 12, n-11... ...until you have typed n-number of pages. 3) Choose the Page Setup tab. - Assuming a duplex printer: Under Layout, in the Two-side menu, select Short Edge (Flip). - If you can only print on one side, you have to print twice, one for the odd pages and one for the even pages. In the Pages per side option, select 2. In the Page ordering menu, select Left to right. 4) Click Print.

Sort files by date
Show you the list of files of current directory sorted by date youngest to oldest, remove the 'r' if you want it in the otherway.

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

reverse-i-search: Search through your command line history
"What it actually shows is going to be dependent on the commands you've previously entered. When you do this, bash looks for the last command that you entered that contains the substring "ls", in my case that was "lsof ...". If the command that bash finds is what you're looking for, just hit Enter to execute it. You can also edit the command to suit your current needs before executing it (use the left and right arrow keys to move through it). If you're looking for a different command, hit Ctrl+R again to find a matching command further back in the command history. You can also continue to type a longer substring to refine the search, since searching is incremental. Note that the substring you enter is searched for throughout the command, not just at the beginning of the command." - http://www.linuxjournal.com/content/using-bash-history-more-efficiently

Get the list of local files that changed since their last upload in an S3 bucket
Can be useful to granulary flush files in a CDN after they've been changed in the S3 bucket.

print DateTimeOriginal from EXIF data for all files in folder
see output from `identify -verbose` for other keywords to filter for (e.g. date:create, exif:DateTime, EXIF:ExifOffset).


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: