Monday, February 28, 2011

lsof is magical

Here is a link, which is kind of primer for lsof, since it has examples.

Here are some examples I have come across which are interesting and cool.

kill -9 `lsof -t -c sshd +f -- /dev/md2`
I want to kill all process which connects to my sshd, and are accessing raid /dev/md2. ensures no one is connected via ssh and is using the drive. I can then safely shut down sshd.


lsof -t -c java -a -u -a +f -- /dev/md2
this is a combination of
-c command
-a and
-u userid
-a and (another and)
+f file accessing raid disk.


lsof +f -- /var/log
everything accessing

you send a HUP to all process accessing /var/log, generally daemons accessing logs
kill -HUP `lsof +f -- /var/log`


lsof -i| grep LISTEN
all that your host is listening (-i is for tcp connections)

who is connected on port 6014
lsof -i:6014

lsof -i:22 -a -u
all those connected to port 22 and having remember if you do not specify -a, it becomes an or and that would mean any thing accessed by

# lsof -i:22 -a -u *uid* | wc -l
14

# lsof -i:22 -u *uid* | wc -l
1228

remeber -t is for terse, it understands, that you only are interested in the process id.

# lsof -t -i:22 -u *uid* | wc -l
100

even thoud *uid* user was accessing tons of files etc. he is running 100 process which are the handles to all those activity.

enjoy!




Friday, February 25, 2011

Finally scoll lock on mac (Mac book pro scroll lock)

I have often pressed the coveted emacs key stroke ctrl-x-s when running vi (dumb me). Unfortunately Mac terminal hangs from there.



Many thanks to Malcom's comment I was able to get it.




On real terminals Scroll Lock sends Control-S to pause text and Control-Q to resume. Try typing Control-S, then Control-Q.


Saturday, February 19, 2011

Worst Indian Bank (is it ICICI)


I do have some experience with a few banks - viz
Indian Bank
Allahabad Bank
State Bank of India
ICICI Bank
Deutsche Bank
Standard Chartered Bank
HDFC Bank
Union Bank of India
UCO Bank


Of all the interactions I have had wether it be loan/credit card/salary account/ etc I felt ICICI is the worst. The customer service is so pathetic that I decided to pen it here. Have any of you lately tried to put a complain? if not then do not even try, its virtually impossible.

I just wish like 'CIBIL', there should be a database of the banks how they operate. The highest complains etc. This central organization should be accessible to general public via multiple means.

I pray ICICI listens to the vows of its customers.


Ok Here comes again a shocker after 3 months :)

Adding a beneficiary and it says oops..


Thursday, February 17, 2011

Collection of links collected on monitoring/investigating memory on linux boxes

http://ktown.kde.org/~seli/memory/analysis.html
http://www.berthels.co.uk/exmap/doc.html
http://valgrind.org/docs/manual/QuickStart.html
http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html



http://stackoverflow.com/about
http://blekko.com/

List directories via 'ls -d' - surprised me

List directories via 'ls -d' - surprised me This was one of those feelings where I was left surprised with the humble linux comm...