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.
» 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:
Your IP is resolved by OpenDns Server (like a caller ID telephone, every server knows who is calling ;-)
Change user:password by yours
Be Happy
0-1279 = desktop 1 region = face 1
1280-2559 = face 2 ==>> wmctrl 1280 = wmctrl (1281,...2559) are all the same
for a 1280 monitor resolution
math: argument of wmctrl -o = ( DesiredFace * HorizontalResolution - 1)
Changes the wallpaper for the last IR picture of the sun taken by SOHO satellite.
Lesser size, try
curl http://sohowww.nascom.nasa.gov/data/realtime/eit_195/512/latest.jpg | xli -onroot -fullscreen -xzoom 120 -yzoom 120 -border black stdin
I use inside kalarm(kde), updating every 15 minutes
needs xli , curl
Changes the wallpaper to the last satellite image.
Tha url above shows latin america. Seek the best url for your location
Now I have a usefull background image in my desktop
I use it inside kalarm updating every 15 minutes. May be done with 'watch' instead
It s an option to xplanet ( kde ) and xearth
needs xli , curl
I have a custmer's Geovision DVR installed on a closed proxi (only logme-in reaches it).
I have to check for reliability but logmein hangs and is too slow a process
I made the Geovision software send e-mail every minute to the www.spam.la site.
All this script does is to retrieve the e-mail header from spam.la ( no login!), filtering sender, stopping at the first occurrence of the word "secs" ( the age of the last e-mail ).
The result is the age of the sender's last e-mail, tiny published on top of my screen once a minute.
I can refresh www.spam.la via web browser, but have other things to do.
I use it inside Kalarm ( kde task schedule ) set to 1 minute repeat.
It can be done without kalarm, using Watch outside the script.
Try it out now using my account = geo1 ( change sender by geo1 in this script)
Needs curl , osd-bin
Easy way to find your computers IP in one place, ie, twitter
It suppress the need of dyndns clients and remembering the complex names they give you.
I put it inside KAlarm ( the cron GUI for KDE, ubuntu), to update my ip every 3 minutes.
I did not add the cron statements to keep the code clean.
Strip my code to:
wmctrl -o 0,0 # autorotates to the first face. In fact [0-1279],0
wmctrl - 1280,0 # goes to the second face
wmctrl -o 2560,0 # goes to the third face, and so on.
# Use multiples of the horizontal display resolution.
My example work for 1280x800 display, been 1280 the number of interest.
Tweak the number, try a biiiig one and see your cube spinning...
I put a complex example to show how fun things can be, even for my ademco and paradox alarm central network advisor interface xpto etc. It rotates two faces, print the alarm message, and goes back tho where it was.
Tested on BIGLINUX 4.2, equivalent to ubuntu LTS hardy.
Do not forget to activate 3D efects ( compiz cube )
already described on the other two versions, this one uses ascii characters on game style to display elapsed time.
Variation of the theme, this one blinks in low profile on top level of X, ie, it is visible, indeed small.
Try changing fonts and sizes of osd_cat
Works on real time clock, unix time based, decrementing the actual time from initial time saved in an environment variable exported to child process inside watch
Shows elapsed time from start of script in hh:mm:ss format
Non afected by system slow down due to the use of date.
My firefox overheats my cpu, sometimes above 90 degrees Celsius ( hence the name? )
To keep an eye on temperature, I put this command inside KAlarm ( a kind of cron) to be repeated every minute, for 5 seconds, color red ( default for osd_cat).
Its pretty, ultra small, displays a micro 2 lines text on every desktop and over everything and do not steal focus or interrupt any task. I get the information passively, in the low profile bottom of the screen.
Of course you can use it inside a terminal. Just do it:
watch -n 60 'acpi -t | osd_cat -p bottom'
Usefull as a light blink to remember events, mails, intrusions, etc... yet another output
Since nobody ever uses the scroll lock function...
Usefull to interface a linux system with some hardware, for example, opto interfacing the keyboard led to a relay to remotely reset, etc. ( a simple LDR glued over the LED will do the trick )
xset led 3 turns on the third led, ie, Scroll lock
xset -led 3 turns it off
xset led 1 turns on Numerical Lock led ( doesn t work on all computer )
xset led 2 turns on Caps Lock led ( idem )
Using it as a reset watchdog, the relay expected light pulses. Shall the computer hangs, the relay releases and reset the machine ( discharge of a capacitor ) ;-)
This time I added a print to reemaining energy, every minute, time stamped.
The example shown here is complete and point to large discrepancies as time passes, converging to accuracy near the end.
Fully recharge your computer battery and start this script.
It will create or clean the file named battery.txt, print a start on it and every minute it will append a time stamp to it.
Batteries last few hours, and each hour will have 60 lines of time stamping. Really good for assuring the system was tested in real life with no surprises.
The last time stamp inside the battery.txt file is of interest. It is the time the computer went off, as the battery was dead!
Turn on your computer after that, on AC power of course, and open battery.txt. Read the first and last time stamps and now you really know if you can trust your computer sensors.
If you want a simple line of text inside the battery.txt file, use this:
watch -n 60 'date > battery.txt'
The time of death will be printed inside
Found it on snipt, pok3, is it yours?
I put my user = m33600, the password and the status was my robot message:
Settima robot message: ALARM ZONE 3 (sent via command line).
Now bots may have their identity on twitter...
w3m is a commanline web browser, full of options, I used -dump_head for less unnecessary page download.
With awk, I can retrieve dynamic changes in webpages in this very econnomical fashion
evento.sh needed for awk syntax
the aplay command makes a camera sound. It takes a picture of who looked at the display
#!/bin/bash
# evento.sh: deteta evento e fala
awk '{print}' | espeak -v pt -stdin
awk '/e/{print "emergencia"}' | espeak -v pt -stdin
aplay -q /home/mm/bash/camera.wav # -q inibe verbose do comand aplay
exit 0
Speaks whatever comes in via stdin (-v pt = portuguese, default = englisg)
..speech part of keyboard event talker. Made to accomplish a simple alarm central based on a cheap keyboard circuit. This way I have one zone per direct keypress. Depends on keypress.sh. It speaks out loud wich zone (key) has been pressed ( faulted ). Here is keypress.sh :
#!/bin/bash
# keypress.sh: Detect a user keypress ("hot keys").
echo
old_tty_settings=$(stty -g) # Save old settings (why?).
stty -icanon
Keypress=$(head -c1) # or $(dd bs=1 count=1 2> /dev/null)
# on non-GNU systems
aplay -q /home/mm/bash/beep-1.wav
echo
echo "Chamada quarto \""$Keypress"\"."
echo
stty "$old_tty_settings" # Restore old settings.
# Thanks, Stephane Chazelas.
exit 0