11 network commands that must be known in Linux

Source: Internet
Author: User
Tags traceroute command
This article collects proven and reliable commands and several new ones. Most commands can be executed on the graphic desktop. Even Linux users who have little experience in using the terminal often execute commands to use ping or other network diagnostic tools.

This article collects proven and reliable commands and several new ones. Most commands can be executed on the graphic desktop. Even Linux users who have little experience in using the terminal often execute commands to use ping or other network diagnostic tools.

1. curl & wget

Use the curl or wget command to download files without leaving the terminal. If you use curl, type curl-O followed by a file path. Wget does not require any options. The downloaded file is in the current directory.

Curl-O website.com/file wget website.com/file


2. ping

Ping to send the ECHO_REQUEST packet to your specified address. In this way, you can easily check whether your computer and Internet or a specified IP address are accessible. Use the-c switch to specify the number of ECHO_REQUEST packets sent.

Ping-c 4 google.com



3. tracepath & traceroute

The tracepath command is similar to the traceroute command, but does not require the root permission. The traceroute command is not pre-installed in Ubuntu. Tracepath traces the network path of the specified destination address and provides each hop on the path ). If your network is faulty or slow, tracepath can find out where the network is broken or slow.

Tracepath example.com




4. mtr

The mtr command combines the ping command with the tracepath command. Mtr continuously sends packets and displays the time used for each hop ping. Any problems during the process will also be displayed. in the following example, we can see that more than 6th packets are lost in 20% hops.

Mtr howtogeek.com





Type q or CTRL + C to exit the command.

5. host

The host command is used for DNS query. If the command parameter is a domain name, the command outputs the associated IP address. if the command parameter is an IP address, the command outputs the associated domain name.

Host howtogeek.com host 208.43.115.82



6. whois

The whois command outputs the whois record of the specified site to view more information such as who registered and held the site.



Whois example.com




7. ifplugstatus

The ifplugstatus command tells you whether a network cable is inserted on the network interface. This command is not pre-installed in Ubuntu. use the following command to install it:

Sudo apt-get install ifplugd

This command can view the status of all network interfaces, or specify the status of network interfaces:


Ifplugstatus eth0



The command output "Link beat detected" (The connection heartbeat is detected) indicates that a network cable is inserted. if not, the command output "unplugged" (not inserted ).

8. ifconfig

Ifconfig is used to output various options for network interface configuration, optimization, and debug. You can quickly View IP addresses and other network interfaces. Type ifconfig to view the status of all enabled network interfaces, including their names. You can specify the name of a network interface to display only information about this interface.

Ifconfig eth0

7. ifdown & ifup

The ifdown and ifup commands have the same function as running ifconfig up and ifconfig down. You can only disable or enable a specified network interface. Root permission is required, so sudo is required for running on Ubuntu.

Sudo ifdown eth0 sudo ifup eth0



If you run these two commands on a Linux desktop system, an error message may be output. Linux desktop uses the network manager to manage your network interfaces. However, these two commands are still available on the server version that does not have the network manager installed.

If you want to configure the network manager on the command line, use the nmcli command.

10. dhclient

The dhclient command can release the IP address of your computer and obtain a new IP address from the DHCP server. The root permission is required, so sudo is required on Ubuntu. No option to run the command to obtain a new IP address, or specify the-r switch to release the current IP address.

Sudo dhclient-r sudo dhclient

11. netstat

The netstat command displays a lot of statistics about network interfaces, including opened sockets and route tables. No option to run the command to display the opened socket.

This command also has many functions. For example, the netstat-p command can display the program corresponding to the opened socket.

Netstat-s displays the detailed statistics of all ports.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.