Check These Out
You can use this on your session login.
Creates a line seperator that will be the width of your window.
$8~osstat, $2~pid, $11~cmd
Can be run as a script `ftrace` if my_command is substrituted with "$@"
It is useful when running a command that fails and you have the feeling it is accessing a file you are not aware of.
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 causes cp to detect and omit large blocks of nulls. Sparse files are useful for implying a lot of disk space without actually having to write it all out.
http://en.wikipedia.org/wiki/Sparse_file
You can use it in a pipe too:
$ dd if=/dev/zero bs=1M count=5 |cp --sparse=always /dev/stdin SPARSE_FILE
This command takes a 1280x1024 p picture from the webcam.
If prefer it smaller, try changing the -s parameter: qqvga is the tiniest, vga is 640x480, svga is 800x600 and so on.
Get your smile on and press enter! :)
Shorter version using --tag
no grep, no perl, no pipe.
even better in zsh/bash4:
$ for i in **/*oldname*; do "mv $i ${i/oldname/newname/}"; done
No find, no grep, no perl, no pipe