20 commands useful for Linux advanced users __linux

Source: Internet
Author: User
Tags nslookup rsync
Original http://www.cnblogs.com/jjdiaries/p/3352215.html

41. Order: Ifconfig

The Ifconfig command is used to configure network interface information. such as configuring the IP address of the network interface, the default gateway address, etc. so that the machine can connect to the Internet.

Display current network interface information

viidiot@ubuntu:~$ ifconfig

Eth0 Link encap:ethernet hwaddr 00:0c:29:b3:de:1c

inet addr:192.168.1.141 bcast:192.168.1.255 mask:255.255.255.0

Inet6 ADDR:FE80::20C:29FF:FEB3:DE1C/64 Scope:link

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:8673 errors:0 dropped:0 overruns:0 frame:0

TX packets:6397 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:10167651 (10.1 MB) TX bytes:417860 (417.8 KB)

Interrupt:19 Base address:0x2024

Lo Link encap:local Loopback

inet addr:127.0.0.1 mask:255.0.0.0

Inet6 addr::: 1/128 scope:host

Up loopback RUNNING mtu:16436 metric:1

RX packets:66 errors:0 dropped:0 overruns:0 frame:0

TX packets:66 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:10954 (10.9 kb) TX bytes:10954 (10.9 kb)

Turn off the Eth0 network interface

viidiot@ubuntu:~$ sudo ifconfig eth0 down

Open a network interface named Eth0

viidiot@ubuntu:~$ sudo ifconfig eth0 up

Set the IP address of the network interface

viidiot@ubuntu:~$ sudo ifconfig eth0 192.169.1.113

Set the IP address, mask, broadcast address of the network interface

viidiot@ubuntu:~$ sudo ifconfig eth0 192.169.1.113 netmask 255.255.255.0 broadcast 192.168.1.255

After setting the IP address and mask, we can check the network's connectivity through the flat command.

viidiot@ubuntu:~$ Ping www.baidu.com

Connect:network is unreachable

You can find that you are still unable to connect to the network because we have not configured the route for the network.

"Attach" Use the route command to set the default gateway

After using Ifconfig to set the network interface IP address, the mask can be used to set the default gateway address using the route command, which adds a default routing rule for our network.

viidiot@ubuntu:~$ sudo route add default GW 192.168.1.1

And then ping to test the network's connectivity.

viidiot@ubuntu:~$ Ping www.baidu.com

PING www.a.shifen.com (115.239.210.27) bytes of data.

Bytes from 115.239.210.27:icmp_req=1 ttl=128 time=44.1 ms

Bytes from 115.239.210.27:icmp_req=2 ttl=128 time=52.8 ms

Bytes from 115.239.210.27:icmp_req=3 ttl=128 time=42.8 ms

Bytes from 115.239.210.27:icmp_req=4 ttl=128 time=49.0 ms

Bytes from 115.239.210.27:icmp_req=5 ttl=128 time=42.5 ms

Bytes from 115.239.210.27:icmp_req=6 ttl=128 time=47.1 ms

Now can unicom network, good, hehe.

42. Order: Netstat

The Netstat command can be used to view various network-related information such as network connectivity status, system routing tables, network interface statistics, and so on.

List all network port information

viidiot@ubuntu:~ $netstat-A

List all TCP connection information

viidiot@ubuntu:~ $netstat-at

Display packet statistics for all ports

viidiot@ubuntu:~ $netstat-S

To view port network dynamic information, simply use the command-c parameter

viidiot@ubuntu:~ $netstat-C

43. Order: Nslookup

Nslookup is used to view information about the trust of a network host, such as IP address, service port, and so on.

viidiot@ubuntu:~$ nslookup www.baidu.com

server:192.168.1.1

address:192.168.1.1#53

Non-authoritative Answer:

www.baidu.com canonical name = www.a.shifen.com.

Name:www.a.shifen.com

address:115.239.210.27

Name:www.a.shifen.com

address:115.239.210.26

44. Order: Dig

The Dig command is used to resolve server-related information such as host addresses to DNS domain names. This command, I have not been used, awkward. The command uses the following method, can discover dig to obtain very detailed host related information.

viidiot@ubuntu:~$ Dig www.baidu.com

; <<>> DiG 9.7.1-p2 <<>> www.baidu.com

;; Global options: +cmd

;; Got Answer:

;; ->>header<<-opcode:query, Status:noerror, id:10771

;; Flags:qr Rd RA; Query:1, Answer:3, Authority:4, Additional:4

;; Question section:

; www.baidu.com. In A

;; ANSWER section:

Www.baidu.com. 5 in CNAME www.a.shifen.com.

Www.a.shifen.com. 5 in a 115.239.210.27

Www.a.shifen.com. 5 in a 115.239.210.26

;; Authority section:

A.shifen.com. 5 in NS ns2.a.shifen.com.

A.shifen.com. 5 in NS ns3.a.shifen.com.

A.shifen.com. 5 in NS ns4.a.shifen.com.

A.shifen.com. 5 in NS ns1.a.shifen.com.

;; ADDITIONAL section:

Ns1.a.shifen.com. 5 in a 61.135.165.224

Ns2.a.shifen.com. 5 in a 180.149.133.241

Ns3.a.shifen.com. 5 in a 61.135.162.215

Ns4.a.shifen.com. 5 in a 115.239.210.176

;; Query time:222 msec

;; server:192.168.1.1#53 (192.168.1.1)

;; When:mon Sep 30 15:11:36 2013

;; MSG SIZE rcvd:226

45. Order: Uptime

The Uptime command can provide the system's startup time, current load conditions, and the number of current users of the system.

viidiot@ubuntu:~$ Uptime

15:15:07 up 8:46, 2 users, load average:0.36, 0.44, 0.44

46. Order: Wall

The Wall command is commonly used by system administrators to send information to users who log on to the system (the user is required to have the MESG permission set to Yes for the user to receive information). For example, the system needs to reboot, the administrator must notify the current user login, ready, I want to restart the system, you should do why, in short, must have psychological preparation, will be restarted oh ...

[Avishek@tecmint ~]$ Wall "We'll be going down for maintenance to one hour sharply at 03:30 pm"

Broadcast message from Root@localhost.localdomain (pts/0) (Sat June 29 14:44:02 2013):

We are going down for maintenance to one hour sharply at 03:30 pm

47. Order: Msg

The MSG command allows you to decide whether to allow other users to send you messages through the Write command.

48. Command: Write

You can send text messages directly to another Linux machine by using the Write command.

49. Order: Talk

The enhanced version of the Write command.

50. Command: W

W command Cool bar, only one character. It is the uptime order and the WHO command of the half-breed. The allowed effect is as follows, see no, equivalent to running a uptime command, and then running a who command.

viidiot@ubuntu:~$ W

15:32:34 up 9:03, 2 users, load average:0.27, 0.36, 0.36

USER TTY from login@ IDLE jcpu pcpu WHAT

Viidiot tty7:0 23sep13 7days 10:45 1.17s gnome-session

Viidiot pts/0:0.0 14:21 1.00s 1.93s 0.21s W

51. Order: Rename

Rename the file shortcuts.

52. Command: Top

Displays CPU process information.

viidiot@ubuntu:~$ Top

top-15:36:39 up 9:07, 2 users, load average:1.04, 0.56, 0.42

tasks:137 Total, 2 running, 135 sleeping, 0 stopped, 0 zombie

Cpu (s): 7.9%us, 9.6%sy, 0.0%ni, 82.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

mem:1025232k Total, 772468k used, 252764k free, 150000k buffers

swap:916476k Total, 0k used, 916476k free, 415288k cached

PID USER PR NI virt RES SHR S%cpu%mem time+ COMMAND

1674 Root 0 163m 21m 7956 R 13.6 2.2 10:53.65 Xorg

6900 Viidiot 0 94076 13m 10m S 4.3 1.4 0:28.08 gnome-terminal

7593 Viidiot 0 2624 1124 840 R 0.7 0.1 Top

1551 Root 0 26336 4124 3376 S 0.3 0.4 1:16.39 VMTOOLSD

1967 Viidiot 0 96212 22m 17m S 0.3 2.2 2:02.38 VMTOOLSD

53. Order: MKFS.EXT4

This command creates a new Ext4 file system on the specified device, and if the command is followed by a faulty device, the entire device is erased and formatted, so it is not recommended to run the command unless you know what you are doing.

Vi/emac/nano command

VI (visual), EMAC, and Nano are some of the most commonly used editors in Linux. They are often used to edit text, but I like Vim, is the VI of the enhanced version.

55. Order: Rsync

rsync copy file, parameter-p to open progress bar. This allows you to see the file's replication progress. It's cool, not just windows, but Linux can do it at the command line.

56. Command: Free

The free command displays the current system's resource usage, such as memory, switch, and so on.

viidiot@ubuntu:~$ Free

Total used free shared buffers Cached

mem:1025232 772840 252392 0 150016 415292

-/+ buffers/cache:207532 817700

swap:916476 0 916476

Mysqldump Order

Database backup. The role that this command represents can be understood from the name. The mysqldump command dumps (backs up) all or a certain portion of the data in a database to a given file. For example:

[Avishek@tecmint ~]$ mysqldump-u root-p–all-databases >/home/server/desktop/backupfile.sql

MKPASSWD command

According to the specified length, produce a very cool random password, hehe.

[Avishek@tecmint ~]$ mkpasswd-l 20

W0pr7aqkk&hmbmqdrlmk

Command:paste.

Merges two or more text files and merges by rows. Example. If the contents of the File1 are:

1

2

3

The contents of File2 are:

A

B

C

D

The result of the merge is:

1 A

2 b

3 C

D

60. Order: Lsof

Lsof is the abbreviation for "List open files (opened in list)" To display all files currently open by the system. It is useful to find out which processes are using a particular file, or to open all files for a single process. Some useful 10 examples of LSOF commands that you might be interested in.

Translator: Zhang Runqin (ah stay) reprint please retain author, link < one-dimensional space www.minzhulou.com >

The original text from www.tecmint.com, there are deletions.

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.