Show complete URL in netstat output

netstat -tup -W | column -t
The -W switch of netstat makes it print complete URL of the connections, which otherwise by default is truncated to fit its default column size. Now to compensate for irregular column sizes, pipe the output to column (-t switch of column prints in tabular form). The only downside to this part is that the very first row, the header, goes pear shape.
Sample Output
$ netstat -tup 
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 me:41486        XXX.XXX.XXX.XXX-sta:http ESTABLISHED 1669/chrome         


$ netstat -tup -W | column -t
Proto   Recv-Q    Send-Q       Local             Address                                           Foreign      Address           State  PID/Program  name
tcp     0         0            me:41486  XXX.XXX.XXX.XXX-static.reverse.softlayer.com:http  ESTABLISHED  1669/chrome

6
By: b_t
2014-01-08 22:39:01

1 Alternatives + Submit Alt

  • This takes all of the tab spaces, and uses column to put them into the appropriately sized table. Show Sample Output


    2
    netstat -pnut -W | column -t -s $'\t'
    Nadiar · 2014-05-03 00:48:53 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

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.

Share Your Commands



Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: