Commands tagged Network (127)

  • curl -> IP Adress curl -> Remote Host curl ->User Agent curl -> Port thonks to

    aajjk · 2010-04-21 13:10:33 6
  • 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).

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

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

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

    echo "foo" > /dev/tcp/
    mobidyc · 2009-09-12 16:48:05 3
  • 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

    ktoso · 2009-10-31 21:11:10 1
  • 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

    nmap -sP
    sdadh01 · 2010-06-05 14:48:37 2

  • 20
    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 0
  • 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 >

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

    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 3
  • works on Linux and Solaris. I think it will work on nearly all *nix-es Show Sample Output

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

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

    wget -qO-
    SuperJediWombat · 2010-06-24 03:49:14 1

  • 11
    dpoblador · 2010-10-09 08:12:26 0
  • 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

    mtr --report --report-cycles 10 > google_net_report.txt
    CafeNinja · 2009-04-10 07:57:44 0

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

    pykler · 2012-05-16 18:22:28 0

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

    iperf -s
    forcefsck · 2011-01-24 07:58:38 0
  • 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.

    trickle -d 60 wget http://very.big/file
    point_to_null · 2010-03-29 06:55:30 0
  • 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.

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

    sudo tc qdisc add dev lo root netem delay 500ms
    caiosba · 2012-11-05 05:29:51 0
  • To connect to the shell run: nc 2000

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

  • 5
    mii-tool [if]
    raphink · 2009-02-25 23:55:00 0

  • 5
    watch -n 2 -d '/sbin/ifconfig eth0'
    totti · 2011-08-16 10:29:34 0
  •  1 2 3 >  Last ›

What's this? 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

Android PNG screenshot
Works with *rooted* Android devices. 400x800 are the screen dimensions of a typical handheld smartphone.

Rename files in batch

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'` You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials

Wait for file to stop changing
This loop will finish if a file hasn't changed in the last 10 seconds. . It checks the file's modification timestamp against the clock. If 10 seconds have elapsed without any change to the file, then the loop ends. . This script will give a false positive if there's a 10 second delay between updates, e.g. due to network congestion . How does it work? 'date +%s' gives the current time in seconds 'stat -c %Y' gives the file's last modification time in seconds '$(( ))' is bash's way of doing maths '[ X -lt 10 ]' tests the result is Less Than 10 otherwise sleep for 1 second and repeat . Note: Clever as this script is, inotify is smarter.

Check if a machine is online
PING parameters c 1 limits to 1 pinging attempt q makes the command quiet (or silent mode) /dev/null 2>&1 is to remove the display && echo ONLINE is executed if previous command is successful (return value 0) || echo OFFLINE is executed otherwise (return value of 1 if unreachable or 2 if you're offline yourself). I personally use this command as an alias with a predefined machine name but there are at least 2 improvements that may be done. Asking for the machine name or IP Escaping the output so that it displays ONLINE in green and OFFLINE in red (for instance).

Set laptop display brightness
Run as root. Path may vary depending on laptop model and video card (this was tested on an Acer laptop with ATI HD3200 video). $ cat /proc/acpi/video/VGA/LCD/brightness to discover the possible values for your display.

Delete all files found in directory A from directory B
This command is useful if you accidentally untar or unzip an archive in a directory and you want to automatically remove the files. Just untar the files again in a subdirectory and then run the above command e.g. $ for file in ~/Desktop/temp/*; do rm ~/Desktop/`basename $file`; done

Pulls total current memory usage, including SWAP being used, by all active processes.

Set laptop display brightness
Run as root. Path may vary depending on laptop model and video card (this was tested on an Acer laptop with ATI HD3200 video). $ cat /proc/acpi/video/VGA/LCD/brightness to discover the possible values for your display.

reset Mageia urpmi media sources to network only
On Mageia (and Mandriva) Linux, this command will clear your existing urpmi configuration and configure it to use only network sources. It can be useful after you have installed from CD/DVD and don't want to continually be prompted to insert CD/DVD each time you install a package. acknowledgement: blino

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.


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: