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:
queries local memcached for stats, calculates hit/get ratio and prints it out.
If you have some textfile with an unknown encoding you can use this list to find out
I know there are a lot of random password generators out there, but I wanted something that put out something besides hex. Set count equal to the number of bytes you want.
Easily list all users
only works for freeBSD where ports are installed in /usr/ports
credit to http://wiki.freebsd.org/PortsTasks
This command does a tally of concurrent active connections from single IPs and prints out those IPs that have the most active concurrent connections. VERY useful in determining the source of a DoS or DDoS attack.
This will tell you who has the most Apache connections by IP (replace IPHERE with the actual IP you wish to check). Or if you wish, remove | grep -c IPHERE for the full list.
List top 20 IP from which TCP connection is in SYN_RECV state.
Useful on web servers to detect a syn flood attack.
Replace SYN_ with ESTA to find established connections
usefull in case of abuser/DoS attacks.
checking files in current and sub directories, finding out the files containing "sampleString" and removing the containing lines from the file.
* Beware that The command will update the original file [no backup].
The command can be extended if play with 'find' command together,
e.g. it is possible to execute on certain type of files: *.xml, *.txt... (find -name "*.xml" | grep....)
if anybody knows a better solution on that, please drop a comment. thx.
Create a tgz archive of all the files containing local changes relative to a subversion repository.
Add the '-q' option to only include files under version control:
svn st -q | cut -c 8- | sed 's/^/\"/;s/$/\"/' | xargs tar -czvf ../backup.tgz
Useful if you are not able to commit yet but want to create a quick backup of your work. Of course if you find yourself needing this it's probably a sign you should be using a branch, patches or distributed version control (git, mercurial, etc..)
Use the aliased command 'nsl'
Greps IRC logs for phrases and lists users who said them.