11 network commands that must be known under Linux

Source: Internet
Author: User
Tags curl require socket traceroute command

This article collects the time-tested commands and collects several newer commands. Most commands can be performed on the graphics desktop, and even Linux users with no experience of terminal use often execute commands to use Ping or other network diagnostics tools.

1.curl & wget

Using the Curl or wget command, you can download the file 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.

The code is as follows:

Curl-o website.com/file wget Website.com/file

2.ping

Ping sends the Echo_request package to the address you specify. This makes it easy to make sure that your computer and the Internet or a designated IP address are not. Use the-c switch to specify the number of Echo_request packets to send.

The code is as follows:

Ping-c 4 google.com

3.tracepath & Traceroute

The Tracepath command is similar to the traceroute command feature, but does not require root permissions. and Ubuntu pre-installed This command, the traceroute command is not pre-installed. Tracepath traces the network path to the specified destination address and gives each hop (hop) on the path. If your network has problems or is slow, tracepath can find out where the network is broken or slow.

The code is as follows:

Tracepath example.com

4.mtr

The MTR command synthesizes a ping command and a Tracepath command. MTR will continue to contract and show the time it takes for each ping to be bounced. Any problems in the process are also displayed, and in the following example, you can see that there are more than 20% dropped packets in the 6th hop.

The code is as follows:

MTR howtogeek.com

Type Q or CTRL + C to exit the command.

5.host

The host command is used to make DNS queries. If the command argument is a domain name, the command outputs the associated IP, and if the command parameter is IP, the command outputs the associated domain name.

The code is as follows:

Host Howtogeek.com host 208.43.115.82

6.whois

The WHOIS command outputs a WHOIS record for the specified site and can see more information such as who registers and holds the site.

The code is as follows:

Whois example.com

7.ifplugstatus

The Ifplugstatus command can tell you if a network cable is plugged into the Web interface. This command is not pre-installed and is installed using the following command:

sudo apt-get install Ifplugd

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

The code is as follows:

Ifplugstatus ifplugstatus eth0

The command output "link beat detected" (heartbeat detected) indicates that a network cable is plugged in, and if not, "unplugged" (not inserted) is output.

8.ifconfig

Ifconfig options for outputting network interface configuration, tuning, and Debug. You can quickly view information about an IP address and other network interfaces. Type ifconfig to view the status of all enabled network interfaces, including their names. You can specify the name of the network interface to display only the information for this interface.

The code is as follows:

Ifconfig ifconfig eth0

7.ifdown & Ifup

The Ifdown and Ifup commands are the same functions that run ifconfig up,ifconfig down. The name of a given network interface can only disable or enable this interface. Root permissions are required, so sudo is required to run on Ubuntu.

The code is as follows:

sudo ifdown eth0 sudo ifup eth0

Running these 2 commands on a Linux desktop system is likely to output an error message. The Linux desktop manages your network interface by using the network Manager (NetworkManager). However, these 2 commands are still available on the server edition where Network Manager is not installed.

If you do want to configure Network manager on the command line, use the NMCLI command.

10.dhclient

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

The code is as follows:

sudo dhclient-r sudo dhclient

11.netstat

The netstat command displays a wide range of statistics about the network interface, including open sockets and routing tables. No option to run the command to display the open socket.

This command also has many functions. For example, the NETSTAT-P command can display a program that corresponds to an open socket.

NETSTAT-S displays detailed statistical information for all ports.

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.