Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Five common commands to get Linux host information

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "5 common commands to get Linux host information". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Here is an example of Ubuntu 13.04 operating system.

1. Command to view or change Linux hostname

The code is as follows:

$ hostname

mylinuxbook-Inspiron-1525

From the command results you can see that my Ubuntu hostname is mylinuxbook-Inspiron-1525. You may notice that host names also usually appear at the command prompt, so many times it might be easier to use them shorter.

Change it with the following command:

The code is as follows:

$ sudo hostname mylinuxbook

Note that changing the host name requires root privileges, so I used sudo above to elevate privileges. If you execute the above command, you can immediately open a new terminal, where you will see your new hostname and you will see the command prompt for the new name.

However, the hostname modified by this command is a temporary feature and will not exist once you restart your server. If you need to permanently change the hostname, you need to modify the/etc/hostname file.

2. host command

This command allows you to view the IP information of the host,

The code is as follows:

$ host google.com

google.com has address 74.125.236.72

google.com has address 74.125.236.78

google.com has address 74.125.236.73

google.com has address 74.125.236.71

google.com has address 74.125.236.65

google.com has address 74.125.236.69

google.com has address 74.125.236.66

google.com has address 74.125.236.64

google.com has address 74.125.236.67

google.com has address 74.125.236.68

google.com has address 74.125.236.70

google.com has IPv6 address 2404:6800:4007:801::1004

google.com mail is handled by 10 aspmx.l.google.com.

google.com mail is handled by 20 alt1.aspmx.l.google.com.

google.com mail is handled by 30 alt2.aspmx.l.google.com.

google.com mail is handled by 40 alt3.aspmx.l.google.com.

google.com mail is handled by 50 alt4.aspmx.l.google.com.

From the command results we can see the host IP (IPV4 and IPV6) and mail server related information.

If you also want to view DNS records, you can use the-a parameter

The code is as follows:

$ host -a google.com

Trying "google.com"

;; ->>HEADERHEADERHEADERHEADERHEADER

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report