Check These Out
Ever need to know why Apache is bogging down *right now*? Hate scanning Apache's Extended server-status for the longest running requests? Me, too. That's why I use this one liner to quickly find suspect web scripts that might need review.
Assuming the Extended server-status is reachable at the target URL desired, this one-liner parses the output through elinks (rendering the HTML) and shows a list of active requests sorted by longest running request at the bottom of the list. I include the following fields (as noted in the header line):
Seconds: How long the request is alive
PID: Process ID of the request handler
State: State of the request, limited to what I think are the relevant ones (GCRK_.)
IP: Remote Host IP making the request
Domain: Virtual Host target (HTTP/1.1 Host: header). Important for Virtual Hosting servers
TYPE: HTTP verb
URL: requested URL being served.
Putting this in a script that runs when triggered by high load average can be quite revealing. Can also capture "forgotten" scripts being exploited such as "formmail.pl", etc.
This will create, in the current directory, a file called 'pk.pem' containing an unencrypted 2048-bit RSA private key and a file called 'cert.pem' containing a certificate signed by 'pk.pem'. The private key file will have mode 600.
!!ATTENTION!! ==> this command will overwrite both files if present.
This command will show an random command. this is useful if you want to explore various random commands.
Instead of opening your browser, googling "whatismyip"...
Also useful for scripts.
dig can be found in the dnsutils package.
Convert JSON to YAML.
Note that you'll need to have PyYaml installed.
Very useful if you keep switching between the same two branches all the time.
Sorts by latest modified files by looking to current directory and all subdirectories
It will create a backup of the filename. The advantage is that if you list the folder the backups will be sorted by date. The command works on any unix in bash.