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

What are the various commands to view system time in Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail what are the commands for viewing system time in Linux. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

1 、 date

This is the most classic command for the system to view the time, and it is also the command that is often used to define the time in the script.

2. Uptime [root@localhost ~] # uptime 16:51:24 up 13:02, 1 user, load average: 0.00,0.01,0.05

The first data of this command is the current time of the system, the second is the running time of the system, and the third is the average of the system load in the past 1 minute, 5 minutes and 15 minutes after the number of logged in users of the system.

3 、 w

[modps@gd-mopps02 ~] $w

17:19:01 up 1983 days, 13:05, 2 users, load average: 26.45, 27.76, 27.72

USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT

Gdmm81 pts/0 10.153.97.38 14:09 23.00s 0.36s 0.01s sshd: gdmm81 [priv]

Dwtangmi pts/3 10.153.97.56 17:18 0.00s 0.07s 0.01s sshd: dwtangmingqi [priv]

The W command note is to look at the currently logged-in users of the system, what each user is doing, and the impact of all active loads on the computer. This command combines the results of uptime, who, and ps-a

Of course, there are other options for this command. You can study the ways to use it sometime.

W commands the first column, which is the same as uptime.

The second column of the w command is the current logged in user of the system

User: login user name

TTY: the terminal number assigned by the system after login

From: remote hostname, that is, where you logged in

When will login@: log in

IDLE: user idle time. This is a timer, and once the user performs any action, the change timer is reset.

JCPU: all processes connected to the terminal take time. Including the time occupied by currently running background jobs

PCPU: time spent by the current process

WHAT: the command line of the currently running process

Http://www.runoob.com/linux/linux-comm-w.html

Comparison between the use of w command and other commands

Https://blog.csdn.net/hsd2012/article/details/54292581

4 、 top

The top command is one of the basic commands for real-time monitoring the process of the system, and the top command is monitored in a cycle of 3 seconds.

There are also options for top commands.

5. Who [modps@gd-mopps02] $whogdmm81 pts/0 2019-01-18 14:09 (10.153.97.38) dwtangmingqi pts/3 2019-01-18 17:18 (10.153.97.56)

The who command is somewhat similar to the w command, and my command contains more information.

6 、 last

Last lists users who have recently logged in to the system

[root@localhost ~] # last root-F | head-1 | awk'{print $4, 5, 6, 7, 8} 'Fri Jan 18 14:55:52 2019

-have time to study.-what's the use of F?

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

Linux on a variety of commands to view the system time is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Development

Wechat

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

12
Report