In certain cases you mighy need to monitor the server load caused by certain process. For example HTTP, while stress testing apache using ab (apache benchmark) you may want to monitor the server status,load, # of spawned HTTP processes, # of established connections, # of connections in close wait state, apache memory footprint etc. Show Sample Output
Fast and easy way to find all established tcp connections without using the netstat command.
IP addresses and number of connections connected to port 80. Show Sample Output
This takes all of the tab spaces, and uses column to put them into the appropriately sized table. Show Sample Output
Useful for containers and environments where you need to know if a port is currently in listen mode but you have not easy way or privileges to install net-tools like netstat or ss. "0A" is the code for listen state. The IP hex is reverse order and all in hex format. Show Sample Output
This is to fetch the Gateway Ip Address of a machine. Use the below format to put the value in a variable if you wish to find the gateway ip in a script
GATEWAY=$(netstat -nr | awk 'BEGIN {while ($3!="0.0.0.0") getline; print $2}')
Counts TCP states from Netstat and displays in an ordered list. Show Sample Output
This command is primarily going to work on linux boxes. and needs to be changed, for example IP=10\.194\.194\.2 PORT=389
Gets the application's name that's listening from the port 8080 through IPv6 Show Sample Output
Not really better - just different ;) There's probably a really simple solution out there somewhere... Show Sample Output
Useful for checking the number and state of TCP connections. Show Sample Output
Check open TCP and UDP ports Show Sample Output
Lists all opened sockets (not only listeners), no DNS resolution (so it's fast), the process id and the user holding the socket. Previous samples were limiting to TCP too, this also lists UDP listeners. Show Sample Output
Command is properly working on HP-UX 11.31 Show Sample Output
if you don't do --numeric-ports, netstat will try to resolve them to names Show Sample Output
Easy to remenber. Fot TCP only use: netstat -plant Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: