Tuesday, 14 April 2009

Useful Linux Commands and Tools

To list the kernel routing table
$ netstat -nr

To get the information about USB buses in the system and devices connected to them
$ lsusb

To get a listing of open ports with associated processes
$ sudo lsof -i
or
$ sudo netstat -lptu

Using netcat to setup a server
$ nc -l -p [port]

Using netcat as a proxy
$ nc -l -p [listening-port] | nc [host:port] | nc -l -p [output-port]
Any request sent via the listening port will be directed to the host defined in the second stage of the pipe and the results can be gathered from the output port.

3 comments:

Denis Weerasiri said...

I think I'm the first Sri Lankan visitor to your Blog. ;)

Chamith said...

You are welcome. :-)

Riadh Khsib said...

Thx! useful commands :)