Nethogs groups bandwidth by process. Show Sample Output
connect to it with any network command (including web browser - if you don't mind weird formatting) curl 127.0.0.1:9876 nc 127.0.0.1 9876 Show Sample Output
The curl command retrieve the HTML text containing the IP address. The grep command picks out the IP address from that HTML text. Show Sample Output
-nohttpd don't run mini-httpd if VNC java applet is found -name change the name of the desktop, it's passed to xstartup script via $VNCDESKTOP, run different set of apps acording the name. -depth pixel depth in bits of the desktop, default is 16 -geometry size of the desktop, default is 1024x768
The example command deletes all aliases for network interface 'em0' assuming that the aliases have netmask of 255.255.255.255 and the master IP has some other netmask (such as 255.255.255.0). See here -> http://my.galagzee.com/2009/07/22/deleting-all-network-interface-aliases/ for more on the rationale of this command.
There's been so many ways submitted to get your external IP address that I decided we all need a command that will just go pick a random one from the list and run it. This gets a list of "Get your external IP" commands from commanlinefu.com and selects a random one to run. It will run the command and print out which command it used.
This is not a serious entry, but it was a learning exercise for me writing it. My personal favourite is "curl icanhazip.com". I really don't think we need any other ways to do this, but if more come you can make use of them with this command ;o).
Here's a more useful command that always gets the top voted "External IP" command, but it's not so much fun:
eval $(curl -s http://www.commandlinefu.com/commands/matching/external/ZXh0ZXJuYWw=/sort-by-votes/plaintext|sed -n '/^# Get your external IP address$/{n;p;q}')
Show Sample Output
Shows how many Windows and Linux devices are on your network. May add support for others, but that's all that are on my network right now. Show Sample Output
Ruby version.
Also, a perl version:
perl -e 'printf("%.2x.",rand(255))for(1..5);printf("%.2x\n",rand(255))'
Using netcat, usuallly installed on debian/ubuntu. Also to test against a sample server the following two commands may help echo got milk? | netcat -l -p 25 python -c "import SocketServer; SocketServer.BaseRequestHandler.handle = lambda self: self.request.send('got milk?\n'); SocketServer.TCPServer(('0.0.0.0', 25), SocketServer.BaseRequestHandler).serve_forever()" Show Sample Output
Allows to add more than one ip address to one network device.
First set the variable $hexchars:
hexchars="0123456789ABCDEF"
Change the number in the first for loop if you need less then 1200 mac addresses
Show Sample Output
Doubt it actually generates valid mac addresses but this version doesn't need any external commands so it runs much faster. Much shorter as well. Show Sample Output
Shorter and more straightforward.
Also in perl:
perl -e 'print join(":", map { sprintf "%0.2X",rand(256) }(1..6))."\n"'
To show ipv6 instead, use [[ -6 ]] instead of [[ -4 ]]
ip -o -6 a s | awk -F'[ /]+' '$2!~/lo/{print $4}'
To show only the IP of a specific interface, in case you get more than one result:
ip -o -4 a s eth0 | awk -F'[ /]+' '$2!~/lo/{print $4}'
ip -o -4 a s wlan0 | awk -F'[ /]+' '$2!~/lo/{print $4}'
Show Sample Output
Like many other thing in Linux ,you can see the same thing in different way. Show Sample Output
Request all information about my IP address in json format
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.
commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.
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: