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.
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:
Function that searchs a process by its name and shows in the terminal.
* Shows the Header for reference
* Hides the process 'grep' from the list
* Case sensitive
In the field, I needed to script a process to scan a specific vendor devices in the network. With the help of nmap, I got all the devices of that particular vendor, and started a scripted netcat session to download configuration files from a tftp server.
This is the nmap loop (part of the script). You can however, add another pipe with grep to filter the vendor/manufacturer devices only. If want to check the whole script, check in http://pastebin.com/ju7h4Xf4
grep for specific function invocations in this case, wither "emit" or "on" with "leader".
using awk, changed the line given by sucotronic in command #11733 to print the first and second columns
Show the maximum amount of memory that was needed by a process at any time. My use case: Having a long-running computation job on $BIG_COMPUTER and judging whether it will also run on $SMALL_COMPUTER.
VmHWM: Peak resident set size ("high water mark")
List all fonts used by an SVG file. Useful to find out which fonts you need to have installed in order to open/edit an SVG file appropriately.
Command returns valid IP addresses. Append the following regex to additionally filter out NAT and reserved IP addresses
| grep -Ev "^0|\.0[0-9]|^10\.|^127\.|^169\.|^172\.(1[6-9]|2[0-9]|3)|^192.168.|^2(2[4-9]|3[0-9])|^2(4[0-9]|5[0-5])"
Allows you to have a list of the domains on the server.
You must have smartmontools installed for this to work. This also assumes you 512 byte sector sizes, this is pretty standard.
I'm sure there's a more elegant sed version for the tr + grep section.
Google Cloud SDK comes with a package manager `gcloud components` but it needs a bit of `sed` to work. Modify the "^| Not" bit to change the package selection. (The gcloud --format option is currently broken)
Replace the credentials to psql if necessary, and the my-query part with your query.
Sure, it's dirty, but it's quick, it only displays the excuse, and it works.
This command will use grep to read the shortcut (which in the above examle is file.url), and filter out all but the only important line, which contains the website URL, and some extra characters that will need to be removes (for example, URL=http://example.com). The cut command is then used to get rid of the URL= at the beginning. The output is then piped into Firefox, which should interpret the it as a web URL to be opened. Of course, you can replace Firefox with any other broswer. Tested in bash and sh.
polls the pirate bay mirrors list and chooses a random site and opens it for you in firefox
Replace "Oct 2" in the first grep pattern to be the date to view branch work from
Monitoring system in one line :
DISK : disk space
MEM: memory ( mem , swap, Total)
CPU : all information about cpu activity
LOAD : load average