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:
I use this one-liner to search my sourcecode to find out where tags are named and since there's no easy way in XCode to see what values have already been used.
Rename all files in current directory by names from text file 'zzz'
Display all pid less the 300 processes info
set CDIR for it to work right..
This one has a better performance, as it is a one pass count with awk. For this script it might not matter, but for others it is a good optiomization.
top 10 of access log
Opens all files in the index (modified plus not added yet) in tabs in vim.
This solution is similar to  except that it does not have any dependency on GNU Parallel. Also, it tries to minimize the impact on the running system (using ionice and nice).
make usable on OSX with filenames containing spaces. note: will still break if filenames contain newlines... possible, but who does that?!
Why use many different utilities all piped together, when you only need two?
Output contains also garbage (text parts from netstat's output) but it's good enough for quick check who's overloading your server.
I have found that base64 encoded webshells and the like contain lots of data but hardly any newlines due to the formatting of their payloads. Checking the "width" will not catch everything, but then again, this is a fuzzy problem that relies on broad generalizations and heuristics that are never going to be perfect.
What I have done is set an arbitrary threshold (200 for example) and compare the values that are produced by this script, only displaying those above the threshold. One webshell I tested this on scored 5000+ so I know it works for at least one piece of malware.