20 useful commands for Linux experts

Source: Internet
Author: User

20 useful commands for Linux experts 41. Command: ifconfig is used to configure the network interface information of the resident kernel. Set the network adapter information when the system starts. Later, it is usually used only during debugging or when the system needs to be adjusted. Check the active network adapter 01 [avishek @ tecmint ~] $ Ifconfig02 03eth0 Link encap: Ethernet HWaddr 40: 2C: F4: EA: CF: 0E 04 inet addr: 192.168.1.3 Bcast: 192.168.1.255 Mask: commandid 0000005 inet6 addr: fe80: 422c: f4ff: feea: cf0e/64 Scope: Link06 up broadcast running multicast mtu: 1500 Metric: 107 RX packets: 163843 errors: 0 dropped: 0 overruns: 0 frame: 008 TX packets: 124990 errors: 0 dropped: 0 overruns: 0 carrier: 009 collisions: 0 txqueuelen: 100010 RX bytes: 1543898 32 (147.2 MiB) TX bytes: 65085817 (62.0 MiB) 11 Interrupt: 20 Memory: f7100000-f712000012 13lo Link encap: Local Loopback 14 inet addr: 127.0.0.1 Mask: 255.0.0.015 inet6 addr ::: 1/128 Scope: Host16 up loopback running mtu: 16436 Metric: 117 RX packets: 78 errors: 0 dropped: 0 overruns: 0 frame: 018 TX packets: 78 errors: 0 dropped: 0 overruns: 0 carrier: 019 collisions: 0 txqueuelen: 020 RX bytes: 4186 (4.0 KiB) TX byte S: 4186 (4.0 KiB) check that all network adapter "-a" parameters are used to display the details of all network adapters, including those that are disabled. 01 [avishek @ tecmint ~] $ Ifconfig-a02 03eth0 Link encap: Ethernet HWaddr 40: 2C: F4: EA: CF: 0E 04 inet addr: 192.168.1.3 Bcast: 192.168.1.255 Mask: commandid 0000005 inet6 addr: fe80: 422c: f4ff: feea: cf0e/64 Scope: Link06 up broadcast running multicast mtu: 1500 Metric: 107 RX packets: 163843 errors: 0 dropped: 0 overruns: 0 frame: 008 TX packets: 124990 errors: 0 dropped: 0 overruns: 0 carrier: 009 collisions: 0 txqueuelen: 100010 RX bytes: 1543 89832 (147.2 MiB) TX bytes: 65085817 (62.0 MiB) 11 Interrupt: 20 Memory: f7100000-f712000012 13lo Link encap: Local Loopback 14 inet addr: 127.0.0.1 Mask: 255.0.0.015 inet6 addr ::: 1/128 Scope: Host16 up loopback running mtu: 16436 Metric: 117 RX packets: 78 errors: 0 dropped: 0 overruns: 0 frame: 018 TX packets: 78 errors: 0 dropped: 0 overruns: 0 carrier: 019 collisions: 0 txqueuelen: 020 RX bytes: 4186 (4.0 KiB) TX B Ytes: 4186 (4.0 KiB) 21 22virbr0 Link encap: Ethernet HWaddr 0e: 30: a3: 3a: bf: 03 23 inet addr: 192.168.122.1 Bcast: 192.168.122.255 Mask: 255.255.255.024 up broadcast multicast mtu: 1500 Metric: 125 RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 026 TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 027 collisions: 0 txqueuelen: 028 RX bytes: 0 (0.0 B) TX bytes: 0 (0.0 B) disable network adapter 1 [avishek @ tecmint ~] $ Ifconfig eth0 down enable network adapter 1 [avishek @ tecmint ~] $ Ifconfig eth0 up specify the IP address to the network adapter and set the IP address "192.168.1.12" for the network adapter eth0. 1 [avishek @ tecmint ~] $ Ifconfig eth0 192.168.1.12 change the subnet mask of the network adapter eth0 1 [avishek @ tecmint ~] $ Ifconfig eth0 netmask 255.255.255. Change the broadcast address of the network adapter eth0 1 [avishek @ tecmint ~] $ Ifconfig eth0 broadcast 192.168.1.255 specifies the IP address, subnet mask, and broadcast address 1 for the network adapter eth0 [avishek @ tecmint ~] $ Ifconfig eth0 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255 Note: If you set a wireless network card, you can use the "iwconfig" command ". for more examples and usage of ifconfig commands, read "15 useful ifconfig commands ". 42. command: The netstat command displays network-related information, such as network connections, route tables, interface statistics, disguised connections, and multicast member identities .... list all Network Ports 01 [avishek @ tecmint ~] $ Netstat-a02 03 Active UNIX domain sockets (servers and established) 04 Proto RefCnt Flags Type State I-Node Path05unix 2 [ACC] STREAM LISTENING 741379/run/user/user1/keyring-I5cn1c/gpg06unix 2 [ACC] STREAM LISTENING 8965/var/run/acpid. socket07unix 2 [ACC] stream listening 18584/tmp /. x11-unix/X008unix 2 [ACC] stream listening 741385/run/user/user1/keyring-I5cn1c/ssh09unix 2 [ACC] STREA M listening 741387/run/user/user1/keyring-I5cn1c/pkcs1110unix 2 [ACC] stream listening 20242 @/tmp/dbus-ghtTjuPN4611unix 2 [ACC] stream listening 13332/var/run/samba/winbindd_privileged /pipe12unix 2 [ACC] stream listening 13331/tmp /. winbindd/pipe13unix 2 [ACC] stream listening 11030/var/run/mysqld. sock14unix 2 [ACC] stream listening 19308/tmp/ssh-qnZadSgJAbqd/agent.322115unix 2 [ACC] stream listening 436781/tmp/HotShots16unix 2 [ACC] stream listening 46110/run/user/ravisaive/pulse/native17unix 2 [ACC] stream listening 19310/tmp/gpg-zfE9YT/ s. gpg-agent18 .... show all tcp-related ports 01 [avishek @ tecmint ~] $ Netstat-at02 03 Active Internet connections (servers and established) 04 Proto Recv-Q Send-Q Local Address Foreign Address State 05tcp 0 0 localhost: mysql *: * LISTEN 06tcp 0 *: 5901 *: * LISTEN 07tcp 0 *: 5902 *: * LISTEN 08tcp 0 *: x11-1 *: * LISTEN 09tcp 0 *: x11-2 *: * LISTEN 10tcp 0 0 *: 5938 *: * LISTEN 11tcp 0 0 localhost: 5940 *: * LISTEN 12tcp 0 0 ravisaive-OptiPl: domain *: * LISTEN 13tcp 0 0 ra Visaive-OptiPl: domain *: * LISTEN 14tcp 0 localhost: ipp *: * LISTEN 15tcp 0 0 ravisaive-OptiPle: 48270 ec2-23-21-236-70.c: http ESTABLISHED16tcp 0 0 ravisaive-OptiPle: 48272 ec2-23-21-236-70.c: http TIME_WAIT 17tcp 0 0 ravisaive-OptiPle: 48421 bom03s01-in-f22.1: https ESTABLISHED18tcp 0 0 ravisaive-OptiPle: 48269 ec2-23-21-236-70.c: http ESTABLISHED19tcp 0 0 ravisaive-OptiPle: 39084 channel-ecmp-06-f: https Established20... display the statistics of all connections 01 [avishek @ tecmint ~] $ Netstat-s02 03Ip: 04 4994239 total packets received05 0 forwarded06 0 incoming packets discarded07 4165741 incoming packets delivered08 3248924 requests sent out09 8 outgoing packets dropped10Icmp: 11 29460 ICMP messages received12 566 input ICMP message failed.13 ICMP input histogram: 14 destination unreachable: 9815 redirects: 2936216 2918 ICMP messages sent17 0 ICMP messages failed18 ICMP output Histogram: 19 destination unreachable: 291820 IcmpMsg: 21 InType3: 9822 InType5: 2936223 OutType3: rule: 25 94533 active connections 23 passive connection openings27 5870 failed connection attempts28 7194 connection resets received29 .... okay! For some reason, if you do not want to parse the host, port, and user name output by netstat. 1 [avishek @ tecmint ~] $ Netstat-an: you may need to obtain the dynamic information of netstat continuous output, and stop it by passing the interrupt output command (ctrl + c. 1 [avishek @ tecmint ~] $ Netstat-c

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.