Linux_5 command for obtaining Linux host information when the Linux System Administrator takes over a new server, if there is no good handover document, the host information we can get depends on ourselves. A lot of information can be obtained directly from the host through commands. Below we will share with you five commands for obtaining Linux host information. (Note: I'm using Ubuntu 13.04) 1. View or change the Linux host name command $ hostnamemylinuxbook-Inspiron-1525 from the command result you can see that my Ubuntu host name is a mylinuxbook-Inspiron-1525. You may notice that the host name usually appears at the command prompt, so it is more convenient to shorten the host name. Run the following command to change the Host Name: $ sudo hostname mylinuxbook. Note that the root permission is required to change the host name. Therefore, I used the sudo command to improve the permission. If you run the preceding command, you can open a new terminal and check your new host name in the terminal, the command prompt with the new name is displayed. However, the host name modified using this command is a temporary function. Once you restart your server, this name will not exist. If you need to permanently modify the host name, you need to modify the/etc/hostname file. 2. host Command. This command allows you to view the IP address of the host, $ host google.comgoogle.com has address 74.125.236.64google.com has address 74. 125.236.68google.com has address 74.125.236.70google.com has IPv6 address 2404: 6800: 4007 :: 1004google.com mail is handled by 10 aspmx.l.google.com.google.com mail is handled by 20 minutes mail is handled by 30 minutes mail is handled by 40 minutes mail is handled by 50 alt4.aspmx.l.google.com. from the command running result, we can see the IP address of the host. (IPV4 and IPV6) and information related to the email server. If you want to view DNS records, you can use the-a parameter $ host-a google. comTrying "google.com";-> HEADER <-opcode: QUERY, status: NOERROR, id: 34210; flags: qr rd ra; QUERY: 1, ANSWER: 21, AUTHORITY: 0, ADDITIONAL: 0; question section:; google.com. in any; answer section: google.com. 211 in aaaa 2404: 6800: 4007: 800: 1009google.com. 299 in mx 10 aspmx.l.google.com.google.com. 299 in mx 50 alt4.aspmx.l.google.com. google. co M. 299 in mx 20 alt1.aspmx.l.google.com.google.com. 299 in mx 30 alt2.aspmx.l.google.com.google.com. 299 in mx 40 alt3.aspmx.l.google.com.google.com. 267 in a container 267 in a 74.125.236.165google.com. 267 in a 74.125.236.166google.com. 267 in a 74.125.236.167google.com. 267 in a container 267 in a container 267 in a container 267 I N a 74.125.236.169google.com. 267 in a container 267 in a 74.125.236.161google.com. 267 in a 74.125.236.160google.com. 136467 in ns ns3.google.com.google.com. 136467 in ns ns1.google.com.google.com. 136467 in ns ns4.google.com.google.com. 136467 in ns ns2.google.com. received 412 bytes from 127.0.1.1 #53 in 30 MS if you need to view Domain Name Server or SOA information, you can use the-C parameter $ host-C google. comNameserver 216.23 9.38.10: google.com has SOA record ns1.google.com. dns-admin.google.com. 2013061800 7200 1800 1209600 300 Nameserver 216.239.34.10: google.com has SOA record ns1.google.com. dns-admin.google.com. 2013061800 7200 1800 1209600 300 Nameserver 216.239.36.10: google.com has SOA record ns1.google.com. dns-admin.google.com. 2013061800 7200 1800 1209600 300 Nameserver 216.239.32.10: google.com has SOA record Ns1.google.com. dns-admin.google.com. 2013061800 7200 1800 1209600 300 or you can use the-d or-v parameter to output details $ host-v google. comTrying "google.com";-> HEADER <-opcode: QUERY, status: NOERROR, id: 52674; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0; question section:; google.com. in a; answer section: google.com. 77 in a 74.125.236.40google.com. 77 in a 74.125.236.38google.com. 7 7 in a running 77 in a running 77 in a running 77 in a 74.125.236.41google.com. 77 in a running 77 in a running 77 in a running 77 in a running 77 in a 74.125.236.39 running ed 204 bytes from 127.0.1.1 #53 in 33 msTrying "google.com ";; -> HEADER <-opcode: QUERY, status: NOERROR, id: 31473; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0; question section:; google.com. in aaaa; answer section: google.com. 28 in aaaa 2404: 6800: 4007: 800: 1002 encoded ed 56 bytes from 127.0.1.1 #53 in 28 msTrying "google.com";-> HEADER <-opcode: QUERY, status: NOERROR, id: 2871; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0; question section:; google. co M. in mx; answer section: google.com. 13 in mx 40 alt3.aspmx.l.google.com.google.com. 13 in mx 50 alt4.aspmx.l.google.com.google.com. 13 in mx 10 aspmx.l.google.com.google.com. 13 in mx 20 alt1.aspmx.l.google.com.google.com. 13 in mx 30 alt2.aspmx.l.google.com. received 136 bytes from 127.0.1.1 #53 in 29 MS this command gives you a lot of host information. 3. The arch command allows you to obtain the processor System Architecture Information of the system. $ Archx86_64 from the command execution result, my host is a 64-bit x86 series processor. 4. the arch above the uname command can only obtain simple information about the system. If you want more information, you need to use the uname command, the uname command can obtain information such as the operating system name, kernel name, kernel version, host name, and network node. Use the-o parameter to view the operating system name $ uname-oGNU/Linux use the-s parameter to view the kernel name $ uname-sLinux use the-m parameter to view the system architecture information, the result of this parameter is the same as the above arch $ uname-mx86_64. You can also try the following command: $ uname-n linuxuser-laptop $ uname-r 2.6.32-21-generic $ uname-v # 33-Ubuntu SMP Fri Apr 18 08:09:38 UTC 2011 5. the dig command dig is a DNS viewing tool. You can use this command to view the host address of the Domain Name Server $ dig google.com; <> DiG 9.2-P1 <> google.com ;; global options: + cmd; Got answer:;-> HEADER <-opcode: QUERY, status: NOERROR, id: 40090; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 1; OPT pseudo SECTION:; EDNS: version: 0, flags:; udp: 4096; question section:; google.com. in a; answer section: google.com. 227 in a 74.125.236.33google.com. 227 in a 74.125.236.38google.com. 227 in a memory 227 in a memory 227 in a memory 227 in a memory 227 in a memory 227 in a memory 227 in a memory 227 in a memory. 227 in a 74.125.236.36 ;; query time: 30 msec; SERVER: 127.0.1.1 #53 (127.0.1.1); WHEN: Sat Jun 22 15:38:58 2013; msg size rcvd: 215