linux查看用户登录信息-w命令

NAME
w - Show who is logged on and what they are doing.

SYNOPSIS
w - [husfV] [user]

DESCRIPTION
w displays information about the users currently on the machine, and their processes. The header shows, in
this order, the current time, how long the system has been running, how many users are currently logged on,
and the system load averages for the past 1, 5, and 15 minutes.

The following entries are displayed for each user: login name, the tty name, the remote host, login time, idle
time, JCPU, PCPU, and the command line of their current process.

The JCPU time is the time used by all processes attached to the tty. It does not include past background jobs,
but does include currently running background jobs.

The PCPU time is the time used by the current process, named in the "what" field.
COMMAND-LINE OPTIONS
-h Don‘t print the header.

-u Ignores the username while figuring out the current process and cpu times. To demonstrate this, do a "su"
and do a "w" and a "w -u".

-s Use the short format. Don‘t print the login time, JCPU or PCPU times.

-f Toggle printing the from (remote hostname) field. The default as released is for the from field to not be
printed, although your system administrator or distribution maintainer may have compiled a version in
which the from field is shown by default.

-V Display version information.

user Show information about the specified user only.
-----------------------------------

[[email protected] opt]# w
 16:14:50 up 4 days, 11:09,  4 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              [email protected]   IDLE   JCPU   PCPU WHAT
root     pts/0    192.168.1.110   14:13    0.00s  0.28s  0.00s w
rusky1   pts/1    192.168.1.110   15:58    8:27   0.03s  0.02s bash
rusky1   pts/2    192.168.1.110   16:00   13:56   0.02s  0.02s -bash
test     pts/3    192.168.1.111  16:04    1:51   0.05s  0.02s vim vi

[[email protected] opt]# w --help
w: invalid option -- ‘-‘
usage: w -hlsufV [user]
    -h    skip header
    -l    long listing (default)
    -s    short listing
    -u    ignore uid of processes
    -f    toggle FROM field (default on)
    -V    display version

[[email protected] opt]# w -h
root     pts/0    192.168.1.110   14:13    0.00s  0.28s  0.00s w -h
rusky1   pts/1    192.168.1.110   15:58    8:46   0.03s  0.02s bash
rusky1   pts/2    192.168.1.110   16:00   14:15   0.02s  0.02s -bash
test     pts/3    192.168.1.222    16:04    2:10   0.05s  0.02s vim vi

[[email protected] opt]# w -l
 16:15:20 up 4 days, 11:10,  3 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              [email protected]   IDLE   JCPU   PCPU WHAT
root     pts/0    192.168.1.110   14:13    0.00s  0.28s  0.00s w -l
rusky1   pts/1    192.168.1.110   15:58    8:57   0.03s  0.02s bash
rusky1   pts/2    192.168.1.110   16:00   14:26   0.02s  0.02s -bash

[[email protected] opt]# w -s
 16:15:29 up 4 days, 11:10,  3 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM               IDLE WHAT
root     pts/0    192.168.1.110    0.00s w -s
rusky1   pts/1    192.168.1.110    9:06  bash
rusky1   pts/2    192.168.1.110   14:35  -bash

[[email protected] opt]# w -u
 16:15:36 up 4 days, 11:10,  3 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              [email protected]   IDLE   JCPU   PCPU WHAT
root     pts/0    192.168.1.110   14:13    0.00s  0.28s  0.00s w -u
rusky1   pts/1    192.168.1.110   15:58    9:13   0.03s  0.02s bash
rusky1   pts/2    192.168.1.110   16:00   14:42   0.02s  0.02s -bash

[[email protected] opt]# w -f
 16:15:47 up 4 days, 11:10,  3 users,  load average: 0.00, 0.00, 0.00
USER     TTY        [email protected]   IDLE   JCPU   PCPU WHAT
root     pts/0     14:13    0.00s  0.28s  0.00s w -f
rusky1   pts/1     15:58    9:24   0.03s  0.02s bash
rusky1   pts/2     16:00   14:53   0.02s  0.02s -bash

[[email protected] opt]# w -V
procps version 3.2.8
时间: 2024-10-11 12:44:50

linux查看用户登录信息-w命令的相关文章

linux查看用户登录信息2-who命令

who命令与w命令相似,但要比w命令显示更加详细的信息.[[email protected] opt]# man who WHO(1) User Commands WHO(1) NAME who - show who is logged on SYNOPSIS who [OPTION]... [ FILE | ARG1 ARG2 ] DESCRIPTION Print information about users who are currently logged in. -a, --all s

查看用户登录信息并统计登陆的次数

一.查看用户登录信息的命令 1.    w                查看当前系统上登录的所有用户的信息 2.    who            查看该shell终端下登录用户的详细信息 3.    whoami      查看本shell终端下登陆的用户 4.    last            查看历史的所有登录信息 [[email protected]_server workspace]# w  14:59:23 up 19 days,  5:35,  1 user,  load 

Linux查看用户的7个命令

在Linux系统里,我们会经常用Linux查看用户的命令,在这里我们一些命令进行了总结,总共有7个,并做了详细的解释,以便让大家更深入的理解,接下来让我们一起来看看这些命令和具体应用. 一.Linux查看用户命令w命令 该命令用于显示登录到系统的用户情况,w命令功能强大,它不但可以显示有谁登录到系统,还可以显示出这些用户当前正在进行的工作,并且统计数据相对who命令来说更加详细和科学. w命令的显示项目按以下顺序排列:当前时间,系统启动到现在的时间,登录用户的数目,系统在最近1秒.5秒和15秒的

(九)Linux查看用户登录的命令

用户登录查看命令 w 含义:就这么简单,一个字母w就是一个命令.查看登录用户信息. 输出的结果的含义: USER       登录的用户名 TTY        登录终端 FROM      从哪个IP地址登录 [email protected]    登录时间 IDLE       用户闲置时间 JCPU      指的是和该终端连接的所有进程占用的时间,这个时间里并不包括过去的后台 作业时间,但却包括当前正在运行的后台作业所占用的时间 PCPU      当前进程所占用的时间 WHAT   

Linux 查看用户登录记录

有关用户登录的信息记录在 utmp(/var/run/utmp).wtmp(/var/log/wtmp).btmp(/var/log/btmp) 和 lastlog(/var/log/lastlog) 等文件. who.w 和 users 等命令通过 utmp(/var/run/utmp) 文件查询当前登录用户的信息.last 和 ac 命令通过 wtmp(/var/log/wtmp) 文件查询当前与过去登录系统的用户的信息.lastb 命令通过 btmp(/var/log/btmp) 文件查询

Linux普通用户登录后,命令行提示:-bash-4.1$ ,原因分析及解决

原文 有时候在使用用户登陆Linux系统时会发现,命令行提示符成了:-bash-4.1$,不显示用户名,路径信息. 原因:用户家目录里面与环境变量有关的文件被删除所导致的 也就是这俩文件:.bash_profile .bashrc 这两个文件被删除了,导致了这个错误 解决方法:从/etc/skel把丢失的文件 复制回来就可以了 -bash-4.1$ cp /etc/skel/.bash* ~ -bash-4.1$ logout ##复制回来后,登出用户,然后在登陆用户查看是否已经解决 [[ema

SAP 如何查看用户登录信息

1.首先进入事务代码 SM19  配置审计参数文件 2.选择客户端,用户名,并且勾选过滤激活之后点击细节配置,进入如下界面: 配置完成之后,点击保存. 3.并且可以进入SM20界面,选择要查看的客户端和账号之后,点击重新读取审计日志查看信息

用户登录日志与命令执行记录

编辑这个文件,用来设置登录前告警信息[[email protected] etc]# cat /etc/login.warn !!!! Welcome to KernelTalks test server !!!!This server is meant for testing Linux commands and tools. If you arenot associated with kerneltalks.com and not authorized please dis-connecti

centos中查看用户和用户组的命令

用户列表文件:/etc/passwd 用户组列表文件:/etc/group 查看系统中有哪些用户:cut -d : -f 1 /etc/passwd 查看可以登录系统的用户:cat /etc/passwd | grep -v /sbin/nologin | cut -d : -f 1 查看用户操作:w命令(需要root权限) 查看某一用户:w 用户名 查看登录用户:who 查看用户登录历史记录:last