Check These Out
While the posted solution works, I'm a bit uneasy about the "%d" part. This would be hyper-correct approach:
$ lsof|gawk '$4~/txt/{next};/REG.*\(deleted\)$/{sub(/.$/,"",$4);printf ">/proc/%s/fd/%s\n", $2,$4}'
Oh, and you gotta pipe the result to sh if you want it to actually trim the files. ;)
Btw, this approach also removes false negatives (OP's command skips any deleted files with "txt" in their name).
Based on capsule8 agent examples, not rigorously tested
If you have a client that connects to a server via plain text protocol such as HTTP or FTP, with this command you can monitor the messages that the client sends to the server. Application level text stream will be dumped on the command line as well as saved in a file called proxy.txt.
You have to change 8080 to the local port where you want your client to connect to. Change also 192.168.0.1 to the IP address of the destination server and 80 to the port of the destination server.
Then simply point your client to localhost 8080 (or whatever you changed it to).
The traffic will be redirected to host 192.168.0.1 on port 80 (or whatever you changed them to).
Any requests from the client to the server will be dumped on the console as well as in the file "proxy.txt".
Unfortunately the responses from the server will not be dumped.
list only directories in reverse order
Substitute 'brown' with 'pink' or 'white' according to your taste.
I put this on my headphones when I'm working in an "open concept" office, where there are always three to five conversations going in earshot, or if I'm working somewhere it is "rude" of me to tell a person to turn off their cubicle radio.
Scans the file once to build a list of line numbers that contain non-printable characters
Scans the file again, passing those line numbers to sed as two commands to print the line number and the line itself. Also passes the output through a tr to replace the characters with a ?
Joker wants an email if the Brand X server is down. Set a cron job for every 5 mins with this line and he gets an email when/if a ping takes longer than 3 seconds.
~ is the ssh control character. If you type it after a newline, you can example force close the ssh session.
, ~, then .
If you want more info, type ~? when you are connecting using ssh.
Very useful to kill of any hanging ssh sessions when nothing else works.