Monday, November 26, 2012

Some random shell tips and tricks.

Some random shell tips and tricks. 

Display all established ssh connection. Replace ssh with http / other protocols:

ss -o state established '( dport = :ssh or sport = :ssh )' 
ss -o state established '( dport = :http or sport = :http )'
See http://www.cyberciti.biz/tips/linux-investigate-sockets-network-connections.html

Reboot your wireless or home router from the command line without login using a browser (replace user:pass and ip/url as per your router make and model):
curl -u 'USER:PASS' 'http://192.168.1.154/setup.cgi?todo=reboot'

Count number of open files per user. In this case count for the Apache user:
lsof -u apache | wc -l
lsof -u root | wc -l

Software speech synthesizer i.e. text to speech:
espeak "1 2 3"
espeak "This is a test."

Pass the --reason parameter to nmap command to see the reason why a port is considered to be in the given state such as closed / open and so on:
nmap --reason ip-here
nmap --reason your.example.com

No comments:

Post a Comment