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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
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.
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.
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:
Takes two input video files and an external audio track and encodes them together to an MPEG-4 DivX output video file with the correct size ready for uploading.
I often run some command that takes a while to finish. By putting the say command afterward, I get an audio notification.
Please note that this command (say) only works on Mac OS X and not Linux.
Rips DVD to lossless encoded video file. Reencodes audio to CBR MP3 for correct audio to video syncing. Be sure to have enough free disk space.
This command creates and burns a gapless audio CD with 99 tracks. Each track is a 30 second sine wave, the first is 1 Hz, the second 2 Hz, and so on, up to 99 Hz. This is useful for testing audio systems (how low can your bass go?) and for creating the constant vibrations needed to make non-Newtonian fluids (like cornstarch and water) crawl around.
Note, this temporarily creates 500MB of .cdda files in the current directory. If you don't use the "rm" at the end of the command, you can burn more disks using
cdrdao write cdrdao.toc
Prerequisites: a blank CD-R in /dev/cdrw, sox (http://sox.sourceforge.net/), and cdrdao (http://cdrdao.sourceforge.net/). I'm also assuming a recent version of bash for the brace expansion (which just looks nicer than using seq(1), but isn't necessary).
change the *.avi to whatever you want to match, you can remove it altogether if you want to check all files.
Record audio to an MP3 file via ALSA. Adjust -i argument according to arecord -l output.
Record from a webcam, audio using ALSA encoded as MP3, video as MPEG-4.
There are some pretty good live performances on late night TV. With Mythtv I record David Letterman, Jimmy Fallon, and Conan nightly all in HD from over the air broadcasts. If I find a live performance I like I copy it to my Rockboxed iPod using this command. The Rockbox firmware knows how to downmix 5.1 audio. The command above extracts the audio from the video starting at 58 minutes and 15 seconds. It ends at the end of the file since this was the last performance of the recording. The command creates an ac3 file. I copy the ac3 file to my Rockbox iPod and rock on.
rips the audio and video stream of a movie. The two streams are stored separately.
This assumes that there is a 10.2 sec delay between the video and the audio (delayed).
To extract the original video into a audio and video composites look at the command on extracting audio and video from a movie
Takes an mpeg video and coverts it to a youtube compatible flv file.
The -r 25 sets the frame rate for PAL, for NTSC use 29.97
-vn removes tha video content, the copy option tells ffmpeg to use the same codec for generating the output
The quality ranges between 0 to 9, with the smaller number indicates a higher quality file but bigger too.
Using mplayer to extract audio file from a CD
This will record the capture channel of your soundcard, directly encoded in Ogg Vorbis, in stereo at quality 5 (I'm using this to record live jam sessions from my line input). You can choose which device to capture (eg. line input, microphone or PCM output) with
alsamixer -V capture
You can do the same thing and live encode in MP3 or FLAC if you wish, just check FLAC and LAME man pages.
Do you have an entire album in a unique file and want to split it in individual tracks? If you also have the cue file you can do it!
Packages for Debian-based systems users:
* cuetools shntool
* FLAC (.flac): flac
* WavPack (.wv): wavpack
* Monkey's Audio (.ape): libmac2 monkeys-audio (deb http://www.debian-multimedia.org sid main)
NOTE: "sid" packages are unstable, but I didn't have problems with them. If you prefer, use the "stable" version repository.
To transfer the tags, you can use this (works with .flac, .ogg and .mp3):
cuetag sample.cue split-track*.flac
This will lower the quality of mp3 files, but is necessary to play them on some mobile devices.
Pick a mp3 at random and play it.
Assumes the availability of locate with an updated db and mpg123
Not the most useful command I guess, but all of the really useful ones are taken...
this will increase the volume by 2 decibels on the pcm channel. the argument to -c is for which sound card to use, the arg after set is the channel (PCM, Master, etc.) and what to set by.
amixer -c 0 set PCM 2dB-
decrease volume by 2 decibels
amixer -c 0 set PCM toggle
this is for alsa systems
for mac os (and maybe other UNIX systems) osascript -e 'set Volume *' where * is any number (can have decimal points) between 0 and 10