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

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Download all PDFs from an authenificated website
Replace *** with the appropiate values

Alias for lazy tmux create/reattach
If a tmux session is already running attach it, otherwise create a new one. Useful if you often forget about running tmuxes (or just don't care)

Install a LAMP server in a Debian based distribution
The execution of this command will install a LAMP server (Linux, Apache, MySQL and PHP) in a Debian based distribution. For example, in Ubuntu.

find text in a file
this will find text in the directory you specify and give you line where it appears.

locating packages held back, such as with "aptitude hold "
locating packages held back, such as with "aptitude hold "

Readd all files is missing from svn repo
When working on a big proeject with SVN, you create quite much files, for now! Can just sit here and type svn add for all of them! svn status will return a list of all of file which get ?(not add), "M"(Modified), "D"(Deleted)! This code just grep "?" flag, then add it into SVN again!

back ssh from firewalled hosts
host B (you) redirects a modem port (62220) to his local ssh. host A is a remote machine (the ones that issues the ssh cmd). once connected port 5497 is in listening mode on host B. host B just do a ssh 127.0.0.1 -p 5497 -l user and reaches the remote host'ssh. This can be used also for vnc and so on.

Get your external IP address ( 10 characters long )
Shortest url to a external IP-service, 10 characters.

execute your commands and avoid history records
$ secret_command;export HISTCONTROL= This will make "secret_command" not appear in "history" list.


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: