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:
Well this can come handy , when you don't feel like playing with pid rather if you know
the process name say "firefox",it would kill it.The script given below would kill the process with its name given as first parameter , though not robust enough to notify that process doesn't exist , well if you know what you are doing that's wouldn't be a problem.:)
----
killhim.sh
----
#!/bin/bash
ps -u $USER |grep $1 | awk '{ print $1}'| xargs kill
----
Also useful with iostat, or pretty much anything else you want timestamped.
grep's -c outputs how may matches there are for a given file as "file:N", cut takes the N's and awk does the sum.
Handy when you need to create a list of files to be updated when subversion is not available on the remote host. You can take this tar file, and upload and extract it where you need it. Replace M and N with the revisions specific to yours. Make sure you do this from an updated (svn up) working directory.
awk can clear the screen while displaying output. This is a handy way of seeing how many lines a tail -f has hit or see how many files find has found. On solaris, you may have to use 'nawk' and your machine needs 'tput'
Beeps on mouse's every move. Bear in mind that, at least on Ubuntu, /dev/input/mice can be read only by root.
Basically it creates a typical word list file from any normal text.
Skype has an internal regex which depicts the emoticons it supports. However you cannot simply search the binary file for it. This small 181 character line will do just that, provided skype is running. And of course, only works in linux.
Use this if you don't have access to GNU grep's -B option.
This will extract all of the urls from a firefox session (including urls in a tab's history). The sessionstore.js file is in ~/.mozilla/firefox/{firefox profile}
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
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
What do you do when nmap is not available and you want to see the hosts responding to an icmp echo request ? This one-liner will print all hosts responding with their ipv4 address.
just change the date following the -r flag, and/or the user name in the user== conditional statement, and substitute yms_web with the name of your module
Ever compress a file for the web by replacing all newline characters with nothing so it makes one nice big blob?
It is a great idea, however what about when you want to edit that file? ...Serious pain in the butt.
I ran into this today in that my only copy of a CSS file was "compressed" with no newlines.
I whipped this up and it converted back into nice human readable CSS :-)
It could be nicer, but it does the job.
The variable WIRELESSINTERFACE indicates your wireless interface
This will allow you to mount a CD-ROM on Solaris SPARC 9 or lower. This will not work on Solaris 10 due to void and the volume management daemons.
Really only valuable in a PHP-only project directory. This is using standard linux versions of the tools. On most older BSD variants of sed, use -E instead of -r. Or use: sed 's/\+[[:space:]]\{1,\}//' instead.