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: 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

    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

    flac -cd input.flac |lame -h - output.mp3
    nickleus · 2010-03-05 23:54:21 5
  • 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: says that this will "help the block layer to optimize a few decisions"

    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: Show Sample Output

    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

    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

    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

    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

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

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

tcpdump top 10 talkers
capture 2000 packets and print the top 10 talkers

multiline data block parse and CSV data extraction with perl
extract data in multiline blocks of data with perl pattern matching loop

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

Show IP Address in prompt --> PS1 var
when working with many machines in a computer lab need to know the IP addr is very large, this is a simplistic solution to make things easier

Mostly silent FLAC checking (only errors are displayed)
FLAC's built in integrity checks are far more useful then devising a scheme to use MD5 sum files. This will check all the FLAC in a directory and output only errors. Remove the "s" after the "t" and it will be somewhat verbose in the check.

Set laptop display brightness
Run as root. Path may vary depending on laptop model and video card (this was tested on an Acer laptop with ATI HD3200 video). $ cat /proc/acpi/video/VGA/LCD/brightness to discover the possible values for your display.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Print a great grey scale demo !
Seen here:

a fast way to repeat output a byte
the speed is about 500MB/s on my machine. i think it's fast enough to output not too many bytes. while a C program may output 1GB per sencond on my machine. if the size is not the power of 512,you may change the bs and count in dd.

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'` You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials

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: