This is used to find externally accessible network interfaces; interfaces that others can connect to us with. By then finding the IP address of these interfaces, we can find addresses that other hosts would use in order to connect to us. Show Sample Output
Given a network interface (eth0 in this example), find its ip address, without CIDR netmask. Show Sample Output
Kills all browser tabs, without killing browser or extensions.
The command lets you know the status of the Caps, Num and Scroll Lock in the terminal. This is useful when the Netbook has no LED indicators Show Sample Output
Add this to your bash profile, then quickly & easily (regex) search for and highlight keywords, with full text output.
I run into regular problems whereby my cable modem from my ISP will simply stop working. To ensure that it is a problem with my cable modem (and not the router in-between my machine and the cable modem), I needed a quick way to test to someplace beyond the cable modem. The place shouldn't be beyond the cable network though. As such, I needed to determine the gateway to which my cable modem was connected. Since my router cannot do this on it's own... I created a single line command that will ping the gateway IP address based upon knowing that my gateway will be my second hop (after my wifi router), tracerouting for 2 hops, pulling the last line of the traceroute output and grep'ing for just the IP address. To stop pinging, use . This works on linux and osx and, with the addition of cygwin tools or the win-gnu project... should work on windows as well. Show Sample Output
This oneliner will check the target location of any shortened URL, showing all the redirections inbetween. It's useful for getting the unshortened URL without opening the short link in the browser, and it also performs a HEAD request instead of a GET for more speed and a bit more privacy. Show Sample Output
Queries whether the monitor is on according to DPMS. If true then turns the monitor off, if false turns it on. The -display option on xset means the command will work from sessions other than the console, such as ssh or a cron'd script. Command should display any errors if there are any problems (eg no X available), otherwise no output if successful.
thanks to GREP_COLOR the output will highlite the first 4 digits. if all files are few MB only, this gives a quick overview of how many powers of 10 bigger than 1MB they really are, a logarithmic scale. same works if files are more than 1GB when you replace the "4" by a "7", I usually use "5" in order to manually decide what files to delete...
Rearrange pdf document coming from a simplex document feed scanner, feeded first with odd pages, then with even pages from the end. Needs pdftk >1.44 w/ shuffle. Similar to http://www.commandlinefu.com/commands/view/7965/pdf-simplex-to-duplex-merge where there are 2 separate documents, odd and even
This is great if you decide to change the name of a variable in multiple .java scripts and want to see a list of where it is used. Once in a text file you can easily sort the info by using find and replace to add /n to every ./ it finds to read your results more clearly. Note: grep will search the current directory. -r stands for recursive which will tell grep to search all directories and subdirectories.
This will display the system memory size in kb. If you want to see the value in mb, you can type: grep MemTotal: /proc/meminfo | awk '{printf("MemTotal: %d MB\n",$2/1024)}' Show Sample Output
grep -v '\(/dev/\|pipe:\|socket:\)' seemingly looks a bit complicated. This can, of course, be replaced by head -1. However, it is not sure whether the filename line will be first on all systems, so I chose the safer way by filtering out what is not needed here. Show Sample Output
When you want to know the duration of all your mp3 files in the current working directory this command will tell you based on exif data. Since it relies on exif data it can be used against other files like movies, ogg vorbis etc. also. Useful when you want to know how long it will take to listen to an album or series of lectures. Show Sample Output
You have a clue... 5 Down: You're looking at it (8) You have some letters... C--SS-O-- You use the terminal... Show Sample Output
merge ifconfig grep awk sed you need to change the interface of ifconfig where ip is up Show Sample Output
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: