Check for listening services

netstat -tuapen | grep LISTEN

0
By: mered
2013-05-18 20:40:38

These Might Interest You

  • This command show listening sockets TCP and UDP. Useful for stop unwanted services from linux. Show Sample Output


    1
    netstat -t -u -l
    prasad · 2014-01-23 05:01:46 1
  • bit of a contrived example and playing to my OCD but nice for quick scripted output of listening ports which is sorted by port, ip address and protocol. Show Sample Output


    0
    sudo netstat -plntu --inet | sort -t: -k2,2n | sort --stable -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | sort -s -t" " -k1,1
    thechile · 2013-08-13 09:21:26 0
  • Disable service, then if still listening restart inetd to unbind it. Use update-rc.d for disabling other types of services.


    0
    update-inetd --disable foobar && /etc/init.d/inetutils-inetd restart
    gwd · 2012-06-10 08:06:52 0
  • Useful to see what ports are taken by running services. Show Sample Output


    0
    netstat -ltn | awk -n '/tcp /{ split($4, x, ":"); print(x[2]); }' | sort -n
    felix_hummel · 2016-11-01 18:48:14 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: