Commands tagged Network (129)

  • curl ifconfig.me/ip -> IP Adress curl ifconfig.me/host -> Remote Host curl ifconfig.me/ua ->User Agent curl ifconfig.me/port -> Port thonks to http://ifconfig.me/


    276
    curl ifconfig.me
    aajjk · 2010-04-21 13:10:33 81
  • Waiting for your server to finish rebooting? Issue the command above and you will hear a beep when it comes online. The -i 60 flag tells ping to wait for 60 seconds between ping, putting less strain on your system. Vary it to your need. The -a flag tells ping to include an audible bell in the output when a package is received (that is, when your server comes online).


    119
    ping -i 60 -a IP_address
    haivu · 2009-03-04 06:21:22 27

  • 101
    lsof -i
    hank · 2009-04-25 14:24:04 23
  • Redirect the local port 2000 to the remote port 3000. The same but UDP: nc -u -l -p 2000 -c "nc -u example.org 3000" It may be used to "convert" TCP client to UDP server (or viceversa): nc -l -p 2000 -c "nc -u example.org 3000"


    25
    nc -l -p 2000 -c "nc example.org 3000"
    prayer · 2009-03-01 21:28:39 19
  • this command will send a message to the socket 25 on host 192.168.1.2 in tcp. works on udp and icmp understand only IP address, not hostname. on the other side (192.168.1.2), you can listen to this socket and test if you receive the message. easy to diagnose a firewall problem or not.


    25
    echo "foo" > /dev/tcp/192.168.1.2/25
    mobidyc · 2009-09-12 16:48:05 16
  • Yeah I know it's been up here a million times, but this service is a really clean and nice one. Nothing but your IP address on it. Actually I was to write something like this, and noticed this on appspot... ;) Show Sample Output


    25
    curl ip.appspot.com
    ktoso · 2009-10-31 21:11:10 12
  • Works on any machine with nmap installed. Previous version does not work on machines without "seq". Also works on subnets of any size. Show Sample Output


    21
    nmap -sP 192.168.1.0/24
    sdadh01 · 2010-06-05 14:48:37 9

  • 21
    sudo tcpdump -i wlan0 -n ip | awk '{ print gensub(/(.*)\..*/,"\\1","g",$3), $4, gensub(/(.*)\..*/,"\\1","g",$5) }' | awk -F " > " '{print $1"\n"$2}'
    tweet78 · 2014-04-11 22:41:32 9
  • Where < target > may be a single IP, a hostname or a subnet -sS TCP SYN scanning (also known as half-open, or stealth scanning) -P0 option allows you to switch off ICMP pings. -sV option enables version detection -O flag attempt to identify the remote operating system Other option: -A option enables both OS fingerprinting and version detection -v use -v twice for more verbosity. nmap -sS -P0 -A -v < target >


    18
    nmap -sS -P0 -sV -O <target>
    starchox · 2009-02-18 07:32:03 17
  • Just a simple way without the need of additional tools. Of course, replace eth0 with your IF. Show Sample Output


    15
    while [ /bin/true ]; do OLD=$NEW; NEW=`cat /proc/net/dev | grep eth0 | tr -s ' ' | cut -d' ' -f "3 11"`; echo $NEW $OLD | awk '{printf("\rin: % 9.2g\t\tout: % 9.2g", ($1-$3)/1024, ($2-$4)/1024)}'; sleep 1; done
    hons · 2011-03-22 10:02:23 8
  • works on Linux and Solaris. I think it will work on nearly all *nix-es Show Sample Output


    13
    ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'
    sneaker · 2009-07-31 09:49:17 9
  • Get all the networking related commands for your distro Show Sample Output


    13
    apropos network |more
    shaiss · 2009-09-25 15:05:33 12
  • Curl is not installed by default on many common distros anymore. wget always is :) wget -qO- ifconfig.me/ip


    12
    wget -qO- icanhazip.com
    SuperJediWombat · 2010-06-24 03:49:14 8

  • 11
    curl ifconfig.me
    dpoblador · 2010-10-09 08:12:26 5
  • The report mode of mtr produces a text formated result of the mtr run using the number of ping cycles stated by the command. This text file could then be attached to an email with ease. I use this also without the ">" portion when writing email from within mutt using VI from the command mode with ":r !mtr --report --report-cycles 10 Show Sample Output


    10
    mtr --report --report-cycles 10 www.google.com > google_net_report.txt
    CafeNinja · 2009-04-10 07:57:44 17

  • 9
    curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]*\).*/\1/g'
    kulor · 2009-08-06 11:54:31 10
  • Gets all kind of info, ifconfig.me rocks ... for just the ip addess you can use ifconfig.me or ifconfig.me/ip Show Sample Output


    9
    curl ifconfig.me/all
    pykler · 2012-05-16 18:22:28 8

  • 8
    nc -l -p 2000 < song.mp3
    prayer · 2009-03-02 15:54:21 9
  • On the machine acting like a server, run: iperf -s On the machine acting like a client, run: iperf -c ip.add.re.ss where ip.add.re.ss is the ip or hostname of the server. Show Sample Output


    8
    iperf -s
    forcefsck · 2011-01-24 07:58:38 19
  • Trickle is a voluntary, cooperative bandwidth shaper. it works entirely in userland and is very easy to use. The most simple application is to limit the bandwidth usage of programs.


    7
    trickle -d 60 wget http://very.big/file
    point_to_null · 2010-03-29 06:55:30 5
  • I'd rather this one on Gnome, as I'm used to be listening some music while working. I've even created a bash function which receives ADDRESS as parameter.


    7
    until ping -c1 ADDRESS;do true;done;zenity --warning --text "ADDRESS is back"
    marcusrp · 2011-09-26 18:51:38 7
  • Replace 500ms by the desired delay. To remove it: sudo tc qdisc del dev lo root netem delay 500ms


    7
    sudo tc qdisc add dev lo root netem delay 500ms
    caiosba · 2012-11-05 05:29:51 4
  • It finds, specifically, the connections to the HTTP and HTTPS ports as source ports. You can check for destination ports as well. Show Sample Output


    7
    ss -o state established '( dport = :http or sport = :https )'
    renich · 2019-08-14 17:28:13 294
  • To connect to the shell run: nc server.example.org 2000


    6
    nc -l -p 2000 -e /bin/bash
    prayer · 2009-03-02 15:58:25 9

  • 5
    mii-tool [if]
    raphink · 2009-02-25 23:55:00 5
  •  1 2 3 >  Last ›

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

tail -f a log file over ssh into growl

dump database from postgresql to a file

Lists all usernames in alphabetical order

Keep a copy of the raw Youtube FLV,MP4,etc stored in /tmp/
Certain Flash video players (e.g. Youtube) write their video streams to disk in /tmp/ , but the files are unlinked. i.e. the player creates the file and then immediately deletes the filename (unlinking files in this way makes it hard to find them, and/or ensures their cleanup if the browser or plugin should crash etc.) But as long as the flash plugin's process runs, a file descriptor remains in its /proc/ hierarchy, from which we (and the player) still have access to the file. The method above worked nicely for me when I had 50 tabs open with Youtube videos and didn't want to have to re-download them all with some tool.

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" }

Change the homepage of Firefox
Pros: Works in all Windows computers, most updated and compatible command. Cons: 3 liner Replace fcisolutions.com with your site name.

Copy without overwriting

Fast, built-in pipe-based data sink
This is shorter and actually much faster than >/dev/null (see sample output for timings) Plus, it looks like a disappointed face emoticon.

bash screensaver off

return the latest kernel version from a Satellite / Spacewalk server software channel


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: