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:
sends notification msg within repeated intervals of time to notify-send ;)
Just for fun.
Change YOUR TEXT HERE to the text you want.
On figlet -f banner, you can change it to any figlet font you have installed.
One variant for Star Wars fans could be this:
while [ 1 ]; do clear; echo 'Star Wars' | figlet -f starwars -t | while IFS="\n" read l; do echo "$l"; sleep 0.01; done; done
NOTICE: You need to install figlet.
On Ubuntu, this command is:
sudo apt-get install figlet
On Debian, this command is:
aptitude install figlet
Mutes the speakers after an hour, in case you fall asleep watching a video...
I used curl instead of lynx.
No need for a colon, and one less semicolon too. Also untested.
There is no need for variables. I also added sleep to reduce cpu usage, however I didn't test it.
Of course, a fifo is required for piloting the fade out of another song, but with a few bash function, we can mix music in bash like :
crossfadeIn > mplayerfifo1 & crossfadeOut > mplayerfifo2
loop 0 10 > mplayer fifo1
can also be invoked as 'exipick -zi | exim -dM' if you do not need/want the delay between flushes.
I often use it to find recently added ou removed device, or using find in /dev, or anything similar.
Just run the command, plug the device, and wait to see him and only him
Adjust "sleep X" to your needs.
*NOTE: First sleep is required because bash doesn't have a "post-test" syntax (do XXX while).
Is a simple script for video streaming a movie
restart a buggy script when it dies. works great for "git svn fetch", which leaks memory like a sieve and eventually dies...making you restart it.
use this comand to see which switch port your network interface is using.
but remind, there is no network traffic for 10 minutes or how long you run the comand.
if you start the comand via ssh, port will come up again after the "for loop" has endet
This is useful if you'd like to see the output of a script while you edit it. Each time you save the file the command is executed. I thought for sure something like this already exists - and it probably does. I'm on an older system and tend to be missing some useful things.
ontouchdo yourscript 'clear; yourscript somefiletoparse'
Edit yourscript in a separate window and see new results each time you save.
ontouchdo crufty.html 'clear; xmllint --noout crufty.html 2>&1 | head'
Keep editing krufty.html until the xmllint window is empty.
Note: Mac/bsd users should use stat -f%m. If you don't have stat, you can use perl -e '$f=shift; @s=stat($f); print "$s\n";' $1
Cycles continuously through a string printing each character with a random delay less than 1 second. First parameter is min, 2nd is max. Example: 1 3 means sleep random .1 to .3. Experiment with different values. The 3rd parameter is the string. The sleep will help with battery life/power consumption.
cycle 1 3 $(openssl rand 100 | xxd -p)
Fans of "The Shining" might get a kick out of this:
cycle 1 4 ' All work and no play makes Jack a dull boy.'
This will turn it in an infinite loop and also shows random words from a file, so it won't be the same each time and also not just a number.
Create a progress dialog with custom title and text using zenity.
using seq inside a subshell instead of a bash sequence to create increments.
Not as taxing on the CPU.
Dialog's gauge widget accepts progress updates on stdin. This version runs dialog once and updates it every second.
There's no need to use timeout which causes screen flicker since it restarts dialog for each update.
ls largedir |rd
lynx -dump largewebsite.com |rd
rd < largelogfile