Use bc for decimals...
Kills all process that belongs to the user that runs it - excluding bash, sshd (so putty/ssh session will be spared). The bit that says grep -vE "..." can be extended to include ps line patterns that you want to spare. If no process can be found on the hitlist, it will print # NOTHING TO KILL. Otherwise, it will print # KILL EM ALL, with the cull list.
This works only with GNU date. In solaris the command: date +%s doesn't work. You can try using the following instead: nawk 'BEGIN {print srand()}' should give the same output as date +%s under Solaris. Show Sample Output
a simple command in order to make iptables rules permanent, run @ sudo!
Watch any command (pipes ok, quotes be careful) and keep history in a file. Good for watching and recording any kind of status or error condition, file creations, etc. The choice of "who" as CMD was just to show an obvious usage. Uses plenty of shell tricks that can be disassembled for simpler stuff. It's deliberately not perfect, but it is generic, and can be customized for your own uses. Had to shorten a little to meet 255 chars. Better than "watch" how? It keeps a date log of what is going on, and tee'd output is plain-text. Show Sample Output
The same command, but with a base64 filter, more forgiving for special characters than tr. Show Sample Output
usage: where COMMIT for instance: where 1178c5950d321a8c5cd8294cd67535157e296554 where HEAD~5 Show Sample Output
Of course, a fifo is required for piloting the fade out of another song, but with a few bash function, we can mix music in bash like : crossfadeIn > mplayerfifo1 & crossfadeOut > mplayerfifo2 loop 0 10 > mplayer fifo1 etc etc
host -i `echo $SSH_CLIENT | cut -f 1 -d \ ` | sed 's/.* domain name pointer \(.*\)\./\1/'
to reverse lookup and get the hostname.
i use this after ripping internet radio streams to number the files as they originally played (even though streamripper can do this with -q). to number other types of files, or all files, just change the *mp3. to rename directories only you could use ... ls -lt | grep ^d | cut -d ":" -f2 | cut -d " " -f2- | while read ... Show Sample Output
"sort_csn" is a function to sort a comma separated list of numbers. Define the the function with this: sort_csn () { echo "${1}" | sed -e "s/,/\n/g"| sort -nu | awk '{printf("%s,",$0)} END {printf("\n")}' | sed -e "s/,$//"; } Use the function like this: sort_csn 443,22,80,8200,1533,21,1723,1352,25 21,22,25,80,443,1352,1533,1723,8200 One example where this is useful is when port scanning with nmap and getting a list of open ports in random order. If you use Nessus, you may need to create a scan policy for that set of specific ports and it is clearer to read with the port numbers in ascending order (left to right). Caveat: no spaces in the comma separated list (just number1,number2,number3,etc). A variation of this to sort a comma separated list of strings: sort_css () { echo "${1}" | sed -e "s/,/\n/g"| sort -u | awk '{printf("%s,",$0)} END {printf("\n")}' | sed -e "s/,$//"; } usage: sort_css apples,pears,grapes,melons,oranges apples,grapes,melons,oranges,pears Show Sample Output
Used curl instead of wget (minor change) Used the full-url instead of the shortened one (in case is.gd goes down/empties their cache) turned the tail | awk bit into a single awk command. Show Sample Output
just an alternative to #7818 Show Sample Output
http://en.wikipedia.org/wiki/Pascal%27s_triangle This one's for bartonski. Enjoy. 132 characters. I'm sure we can do better. Note: after row 64 we overflow integer maths. Show Sample Output
Simplified the series to a polynomial and send it to bc
Does the same but without a pipe and a new shell.
The following syntax will scan a range of IP addresses. At the point of a ARP response being received it will show a reply message. www.fir3net.com Show Sample Output
Same result with simpler regular expression.. Show Sample Output
a simple interactive tool to convert Simplified Chinese (typed by pinyin) to Traditional Chinese Show Sample Output
umph is parsing video links from Youtube playlists ( http://code.google.com/p/umph/ )
cclive is downloading videos from Youtube ( http://cclive.sourceforge.net/ )
Example:
yt-pl2mp3 7AB74822FE7D03E8
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: