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:
Every 20 minutes test if host with IP 192.168.0.14 is 'dead' or not reachable.
The line should be put in your crontab file.
Every 20 minutes ping host with IP address 192.168.0.14. If it's not 'alive' or not reachable, then display something eye-catching (here xeyes) on the desktop.
Hint for newbies: edit crontab with
crontab -e
Quick and dirty one-liner to get the average ping(1) time from a server.
I'd rather this one on Gnome, as I'm used to be listening some music while working. I've even created a bash function which receives ADDRESS as parameter.
In case sed and awk are not available you may use this to remove the last character from a string with "rev" and "cut".
works best in a shell script run at startup. It will ping localhost once and output to null, after it does that, acpi is called for temperature in fahrenheit and piped through to another loop that feeds notify-send for a tooltip. After waiting five minutes, it will start over.
If you're very busy and don't want to wait for a ping response, use it.
This command will be waiting for a successful ping response, to play a sound file to warn you that the target host is available.
8.8.8.8 and 8.8.4.4 are two Google public DNS.
As their address is really simple, it's easy to use this command to test if Internet is reachable.
Beware of large corporate networks however, that may use this address on router's loopbacks interfaces.
Does one ping to a URL or host, and echo out just the response time. I use this on, with MRTG to monitor the connections to various hosts.
Continue to execute the command in background even though quitting the shell.
This is like ping -a, but it does the opposite. It alerts you if the network is down, not up. Note that the beep will be from the speaker on the server, not from your terminal.
Once a second, this script checks if the Internet is accessible and beeps if it is not. I define the Net as being "UP", if I can ping Google's public DNS server (8.8.8.8), but of course you could pick a different static IP address. I redirect the beep to /dev/console so that I can run this in the background from /etc/rc.local. Of course, doing that requires that the script is run by a UID or GID that has write permissions to /dev/console (usually only root).
Question: I am not sure if the -W1 flag works under BSD. I have only tested this under GNU/Linux using ping from iputils. If anybody knows how portable -W is, please post a comment.
For some reason the 2&>1 does not work for me, but the shorter stdout/stderr redirection >& works perfectly (Ubuntu 10.04).
# first install arp-scan if not have it
arp-scan 10.1.1.0/24 .... show ip+mac in localnet
awk '/00:1b:11:dc:a9:65/ {print $1}' .... get ip associated with MAC
` backtick make do command substitution passing ip to command ping
This command only check the network connection from given eth. This is very useful if you are using more then one interface in your server or laptop.