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.
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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
mytop is a top like monitor for displaying Mysql server statistic and performance. Part of mytop package ,tested on Debian.
Report memory and swap space utilization statistics e.g. memory free/used, swap free/used
Send signal 0 to the process. The return status ($?) can be used to determine if the process is running. 0 if it is, non-zero otherwise.
You only have to fill in your administrative account and password, and the router FQDN!
I recommand to execute this command not over the internet, because there is no encryption (the username and password will be transmitted in plaintext!)
VARNAMES='ID FORENAME LASTNAME ADDRESS CITY PHONE MOBILE MAIL ...'
cat customer.csv | while read LINE ; do
COUNT=1
for VAR in $VARNAMES ; do
eval "${VAR}=`echo $LINE | /usr/bin/awk {'print $'$COUNT''}`"
let COUNT=COUNT+1
done
done
Maybe you have a CSV-File with addresses, where you have to process each contact (one per line, write each value to own variable). Of course you can define every variable, but this way is more simple and faster (to write).
VARNAMES includes the variable names. Pay attention: the number of names in VARNAMES have to be the same than in the CSV-file the fields. If the CSV is not seperated with ";", you can set the seperator after the awk-binary with -F"_" for example.
Assumes you have ffmpeg and oggenc.
Similar to other scripts here, but this time outputting to Ogg Vorbis.
I added the variable assignment for a nice output name.
This is part of an interactive bash script I have with a few little multimedia tasks in it.
The uuencode utility will encode your file so that it can be sent as an attachment to an email. It is part of the sharutils package in RHEL/CentOS/Fedora.
This converts all m4a files in a dir to flv. You can just swap the m4a bit to anything else ffmpeg supports though, and it'll work.
This is handy for making screenshots of all your videos for referring to in your flv player.
PRIVATEKEY - Of course the full path to the private key \n
HOST - The host where to get the backup \n
SOURCE - The directory you wish to backup \n
DESTINATION - The destination for the backup on your local machine
Important to know: a valid date will return 0, otherwise 1!
Continue with:
killall -CONT -m firefox
Suspends all Firefox Threads. Results in Zero CPU load.
Useful when having 100+ Tabs open and you temporarily need the power elsewhere.
Be careful - might produce RACE CONDITIONS or LOCKUPS in other processes or FF itself.
matching is case sensitive.
It prints myvideo.srt subtitle files in myvideo.avi, saving it in myvideo_subtitled.avi
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.
Based on linkinpark342 suggestion.
Sometimes you have to browse your way through a lot of sub-directories. This command cd to the previous sub-directory in alphabetical order. For example, if you have the directories "lectures/01-intro", "lectures/02-basic", "lectures/03-advanced" and so on, and your PWD is "02-basic", it jumps to "01-intro".