Commands matching netstat (162)


  • -3
    netstat -ie
    minigeek · 2012-08-07 01:57:49 3
  • The -p parameter tell the netstat to display the PID and name of the program to which each socket belongs or in digestible terms list the program using the net.Hope you know what pipe symbol means! Presently we wish to only moniter tcp connections so we ask grep to scan for string tcp, now from the op of grep tcp we further scan for regular expression /[a-z]*. Wonder what that means ? If we look at the op of netstat -p we can see that the name of the application is preceded by a / ( try netstat -p ) so,now i assume application name contains only characters a to z (usually this is the case) hope now it makes some sense.Regular expression /[a-z]* means to scan a string that start with a / and contains zero or more characters from the range a-z !!. Foof .. is t Show Sample Output


    -4
    while true; do netstat -p |grep "tcp"|grep --color=always "/[a-z]*";sleep 1;done
    buffer · 2009-07-16 04:52:49 7

  • -4
    while sleep 1; do date; (netstat -a -n | grep 80) ; done
    hute37 · 2011-05-16 07:56:56 5
  • netstat has two lines of headers: Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State Added a filter in the awk command to remove them


    -4
    netstat -ntu | awk ' $5 ~ /^[0-9]/ {print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
    letterj · 2011-07-04 20:23:21 8
  • Ok so it's rellay useless line and I sorry for that, furthermore that's nothing optimized at all... At the beginning I didn't managed by using netstat -p to print out which process was handling that open port 4444, I realize at the end I was not root and security restrictions applied ;p It's nevertheless a (good ?) way to see how ps(tree) works, as it acts exactly the same way by reading in /proc So for a specific port, this line returns the calling command line of every thread that handle the associated socket


    -5
    p=$(netstat -nate 2>/dev/null | awk '/LISTEN/ {gsub (/.*:/, "", $4); if ($4 == "4444") {print $8}}'); for i in $(ls /proc/|grep "^[1-9]"); do [[ $(ls -l /proc/$i/fd/|grep socket|sed -e 's|.*\[\(.*\)\]|\1|'|grep $p) ]] && cat /proc/$i/cmdline && echo; done
    j0rn · 2009-04-30 12:39:48 628
  • Just find out the daemon with $ netstat -atulpe. Then type in his name and he gets the SIGTERM.


    -5
    kill_daemon() { echo "Daemon?"; read dm; kill -15 $(netstat -atulpe | grep $dm | cut -d '/' -f1 | awk '{print $9}') }; alias kd='kill_daemon
    P17 · 2009-05-26 20:39:56 7
  • HP UX doesn't have a -a switch in the ifconfig command. This line emulates the same result shown in Solaris, AIX or Linux Show Sample Output


    -5
    for i in `netstat -rn |grep lan |cut -c55-60 |sort |uniq`; do ifconfig $i; done
    Kaio · 2010-01-28 17:35:20 5

  • -5
    netstat -nlput
    techie · 2013-05-09 08:15:04 5

  • -6
    netstat -an | grep -i listen
    lfcipriani · 2009-03-27 13:19:29 9
  • Affiche des infos detaillees sur vos connexions reseaux. Port en ?coute, protocole, paquets, adresses, ustilisateur, PID etc...


    -8
    netstat -taupe
    farwarx · 2009-05-25 12:46:38 5

  • -8
    netstat -luntp
    lunarblu · 2010-04-14 19:54:17 18
  • عرض الاتصالات لبورت ٢٢


    -16
    netstat -antp | grep 22
    WhiteHatsCom · 2010-08-05 15:53:41 9
  • ‹ First  < 5 6 7

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


Check These Out

Change/Modify timestamp

Rename files in batch

List your installed Chromium extensions (with url to each page)
Gives you a list for all installed chrome (chromium) extensions with URL to the page of the extension. With this you can easy add a new Bookmark folder called "extensions" add every URL to that folder, so it will be synced and you can access the names from every computer you are logged in. ------------------------------------------------------------------------------------------------------------------ Only tested with chromium, for chrome you maybe have to change the find $PATH.

no # comments, blank lines, white space. # can start in any column
The shortest and most complete comment/blank line remover... Any line where the first non-whitespace character is # (ie, indented # comments), and all null and blank lines are removed. Use the alias as a filter: $ noc /etc/hosts or $ grep server /etc/hosts | noc Change to nawk depending awk versions.

find and reduce 8x parallel the size of JPG images without loosing quality via jpegoptim

Sort dotted quads
Sort a list of IPV4 addresses in numerical order. Great as a filter, or within vim using !}

convert .bin / .cue into .iso image
bchunk [-v] [-p] [-r] [-w] [-s]

Multiplication table
The multiplication table for math study

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }


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: