ubuntu基本命令篇15系统管理time命令中Real,User,Sys概念

15.系统管理
环境变量        env     linux运行过程过程中内存中需要一些特定到参数,environment
系统日期        date    日期
运行时间        time    测试命令执行到时间。比如 time ls 会记录ls执行时间。
历史命令     history  查看之前都执行过哪些命令
系统信息        dmesg      显示系统信息
日志文件        /var/log
系统运行时间    uptime 
系统用户        w,who,whoami 
登录信息        last    记录最近多少条登录信息

设置环境变量
export DISPLAY=localhost:0.0 就将DISPLAY这个环境变量到值设定为“localhost:0.0“了。

time gcalctool         打开计算机并计时
计时结果如下:
real    0m8.183s    真实运行时间为8.183秒,程序存活的时间,
user    0m0.684s    user占用,
sys    0m0.028s     系统占用  

Real,User和Sys具体解释如下:

原文地址:

http://stackoverflow.com/questions/556405/what-do-real-user-and-sys-mean-in-the-output-of-time1


Real, User and Sys process time statistics
One of these things is not like the other. Real refers to actual elapsed time; User and Sys refer to CPU time used only by the process.
    *Real is wall clock time - time from start to finish of the call. This is all elapsed time including time slices used by other processes and time the process spends blocked (for example if it is waiting for I/O to complete).
    *User is the amount of CPU time spent in user-mode code (outside the kernel) within the process. This is only actual CPU time used in executing the process. Other processes and time the process spends blocked do not count towards this figure.
    *Sys is the amount of CPU time spent in the kernel within the process. This means executing CPU time spent in system calls within the kernel, as opposed to library code, which is still running in user-space. Like 'user', this is only CPU time used by the process. See below for a brief description of kernel mode (also known as 'supervisor' mode) and the system call mechanism.
      User+Sys will tell you how much actual CPU time your process used.

翻译如下:
    * Real 是时钟时间-程序从开始至结束的总时间。他包括期间其他进程所占用的时间片和进程被阻塞的时间(如IO等待的时间)
    * User 被测试程序在用户模式下所花的CPU时间。他是进程执行的正真的CPU时间。其他进程调度的时间片以及阻塞(如IO)的时间不包含在内。
    * Sys 是进程在内核中所花费的CPU时间。他表示进程在内核调用中所花的CPU时间,而程序的库调用仍然运行在用户空间下。
      User+Sys表示程序所执行的CPU时间(不包括IO以及其他进程的CPU时间).


history 列出最近使用的命令。
history -c 清除历史命令到记录 ,-c表示clear
dmesg = cat /var/log/dmesg

cat /var/log/messages  系统信息。比如如果你在messages中找到有许多登录失败到信息,就表示有人在猜你到root密码,企图登录你到电脑。

last 显示系统登录成功到信息
messages中显示一些登录失败到信息。

作者:xwdreamer
欢迎任何形式的转载,但请务必注明出处。
分享到:
原文地址:https://www.cnblogs.com/xwdreamer/p/2297109.html