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:
Get a list of all the unique hostnames from the apache configuration files. Handy to see what sites are running on a server. A slightly shorter version.
Get a list of all the unique hostnames from the apache configuration files. Handy to see what sites are running on a server.
A command to find out what the day ends in. Can be edited slightly to find out what "any" output ends in.
NB: I haven't tested with weird and wonderful output.
Prints a log of phonecalls placed from/to an asterisk server, formated into an easily readable table.
You can use partial number/queue matches, or use .* to match everything.
Gets the IP addresses of all interfaces except loopback. Cuts out all of the extra text.
Shorter than the other options, and much easier to type.
'ifconfig | grep cast' is enough to get the IP address, but it doesn't strip the rest of the junk out.
get a list of currently running oracle dbs (identified by the pmon process)
show the executable that spawned the process and
show the ORACLE_HOME relative to the environment within which the process is running
tailored to AIX (sed on linux behaves...differently)
suggestions for a better way...please.
This will kill a specific process you don't know the PID of, when pidof and pgrep are not available, for example on OS X. var1 is created so that the whitespace can be trimmed before passing off to kill.
Better use iproute2 !
This is a dirty raw way to simply list ELF objects in a folder.
The output is ready to be parsed i.e to the stripper or what else needs a path to an ELF object.
If you need to randomize the lines in a file, but have an old sort commands that doesn't support the -R option, this could be helpful. It's easy enough to remember so that you can create it as a script and use that.
It ain't real fast. It ain't safe. It ain't super random. Do not use it on untrusted data. It requires bash for the $RANDOM variable to work.
HP UX doesn't have a -a switch in the ifconfig command.
This line emulates the same result shown in Solaris, AIX or Linux
If a directory name contains space xargs will do the wrong thing. Parallel https://savannah.nongnu.org/projects/parallel/ deals better with that.
xargs deals badly with special characters (such as space, ' and "). In this case if you have a file called '12" record'.
Parallel https://savannah.nongnu.org/projects/parallel/ does not have this problem.
Both solutions work bad if the number of files is more than the allowed line length of the shell.
This version makes uses of Bash shell expansion, so it might not work in all other shells.
Somewhat shorter version.