commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
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.
** Replace the ... in URLS with:
Couldn't fit in 256
Created on Ubuntu 9.10 but nothing out of the ordinary, should work anywhere with a little tweaking. 5163 is the number of unique first names you get when combine the male and female first name files from. http://www.census.gov/genealogy/www/data/1990surnames/names_files.html
i wanted to delete all duplicate lines from .bash_history and keep the order of the other lines.
the command cat's the file and adds line numbers, then sorts by the second column. afterwards uniq omits repeated lines, but skips the first field (the line number). then it sorts by the line numbers and at the end cuts the numbers off.
Removes all the at shedules jobs
A way not so simple but functional for print the command for the process that's listening a specific port.
I got the pid from lsof because I think it's more portable but can be used netstat