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:
Yo run the `nohist` command and after that the commands won't get stored in the history file for the current session.
This makes no permanent changes.
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
Similar to entering a command, but will not erase the command from the command line.
Basically a shortcut from entering command, then pushing the up arrow key.
Draw a telephone keyboard, using just a shell built-in command.
seems a useless command ...
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
Use this command to watch apache access logs in real time to see what pages are getting hit.
count all the lines of code in specific directory recursively
in this case only *.php
can be *.*
grep for specific function invocations in this case, wither "emit" or "on" with "leader".
from a svn repo, print a log, with diff, of each commit touching a given file
Count how many times a pattern is present into a file. It can be one or more lines. No overlapping. It means searching for aa on aaa will output 1 not 2.
Count how many times a pattern is present into a stream. It can be one or more lines. No overlapping. It means searching for aa on aaa will output 1 not 2.
Turns out smacie.com has a text file containing every single one of the borat quotes, each one on a newline. This makes it very convenient, as this can be done without any sed-parsing, and uses less bandwitdth!
Note that borate quotes are quite offensive, much more so than "fortunes-off"!
In this case, linux- is the prefix; simply running
would list every package APT knows about.
The default APT config assumes -g, --generate; to use the cache as/is, you could similarly run:
apt-cache --no-generate pkgnames [prefix]
Adding --all-names, like so:
apt-cache --no-generate --all-names pkgnames [prefix]
would print all the packages APT knows about, using the cache as/is, including virtual packages and missing dependencies.
This command was shamelessly stolen from the apt-cache(8) man-page.
This is not exhaustive but after checking /etc/cron* is a good way to see if there are any other jobs any users may have set.
Note: this is a repost from a comment "flatcap" made on http://www.commandlinefu.com/commands/view/3726/print-crontab-entries-for-all-the-users-that-actually-have-a-crontab#comment, for which I am grateful and I take no credit.
This command is similar to the alternate, except with head(1), you can pick as many passwords as you wish to generate by changing the number of lines you wish to preview.
Find biggest files in a directory
This will remove the gpg-pubkey-1aa043b8-53b2e946 from rpm/yum and you'll be prompted to add it back from the given repo.
This will list all the gpg keys that were accepted and installed for yum.