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:
some numbers have strange output!
some numbers output nothing!
some numbers will kill your terminal! even logout when running in tty
but i don't know why! can anyone explain it to me?
use it to add a random boolean switch to your script
use it to stagger cronjob or to get a random number
increase the range by replacing 100 with your own max value
This command is useful for searching through a whole folder worth of pdf files.
Creates a git repository in a predefined location.
git gc should be run on all git repositories every 100 commits. This will help do do so if you have many git repositories ;-)
How much memory is chrome sucking?
Well, this is quite useful for testing if your hardware watchdog is working properly.
POSIX compliant arithmetic evaluation.
list all java process info.
Replace the first part of the command above with the appropriate timezone string. Eg: 'Europe/London' or for UTC - 'Etc/UTC'. The appropriate string can be found from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
This is useful when your server is installed by a data centre (managed hardware, VPS, etc) and the timezone is not usually set to the one your prefer.
Shows a list of all installed cows saying a fortune. Also lists the cows names. Pic your favorite cow!
Needs cowsay, fortune and ruby installed. The path only applies to OS X with cowsay installed using homebrew. On Linux it might be /usr/share/cowsay/cows/ or similar. Uses ruby just because.
Anyone can make the command smaller & easier? :)
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.