Commands by billmakesbooks (1)

What's this?

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.

Share Your Commands


Check These Out

List the binaries installed by a Debian package
This shell function displays a list of binaries contained in an installed package; works on Debian based Linux distributions.

Ultimate current directory usage command
An NCurses version of the famous old 'du' unix command

Broadcast your shell thru UDP on port 5000
Better solution in case of many clients, imo.

A fun thing to do with ram is actually open it up and take a peek. This command will show you all the string (plain text) values in ram

Make sure your script runs with a minimum Bash version
If you use new features of a certain Bash version in your shell script, make sure that it actually runs with the required version.

analyze traffic remotely over ssh w/ wireshark
This captures traffic on a remote machine with tshark, sends the raw pcap data over the ssh link, and displays it in wireshark. Hitting ctrl+C will stop the capture and unfortunately close your wireshark window. This can be worked-around by passing -c # to tshark to only capture a certain # of packets, or redirecting the data through a named pipe rather than piping directly from ssh to wireshark. I recommend filtering as much as you can in the tshark command to conserve bandwidth. tshark can be replaced with tcpdump thusly: $ ssh root@example.com tcpdump -w - 'port !22' | wireshark -k -i -

Who invoked me? / Get parent command
Get the name of the parent command. This might be helpful, if you need to react on that information. E. g. a script called directly via ssh has got sshd as parent, manually invoked the parent process will probably be bash

see the TIME_WAIT and ESTABLISHED nums of the network
see the TIME_WAIT and ESTABLISHED nums of the network

Show LAN IP with ip(8)
$ ip address show | grep eth0 | sed '1d' | awk '{print $2}' does the same, but shows network-prefix.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.


Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: