`
诗意的栖居
  • 浏览: 268712 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

Linux who am i

 
阅读更多
在linux下竟然还有这么一条指令,以前一直不知道。这指令相似的还有who/whoami,都是用来显示“你是谁”的。

whoami显示当前用户名,比如root,而who am i则是显示登录用户名,即使你当前通过sudo su切换到了管理员root模式,还是只显示登录用户名。下面是一个例子:

root@ubuntu:/home/test/STL/Ch9# who
test      tty7         2010-10-06 18:02 (:0)
test        pts/0        2010-10-06 19:24 (:0.0)
root@ubuntu:/home/test/STL/Ch9# who am i
test        pts/0        2010-10-06 19:24 (:0.0)
root@ubuntu:/home/test/STL/Ch9# whoami
root
root@ubuntu:/home/test/STL/Ch9# exit
exit
test@ubuntu:~/STL/Ch9$ who
test       tty7         2010-10-06 18:02 (:0)
test       pts/0        2010-10-06 19:24 (:0.0)
test@ubuntu:~/STL/Ch9$ who am i
test       pts/0        2010-10-06 19:24 (:0.0)
test@ubuntu:~/STL/Ch9$ whoami
test
分享到:
评论

相关推荐

    浅谈linux中的whoami与 who指令

    who -m的作用和who am i的作用是一样的 who am i显示的是实际用户的用户名,即用户登陆的时候的用户ID。此命令相当于who -m whoami显示的是有效用户ID ,是当前操作用户的用户名 命令实践: [test@test~]$ whoami ...

    Linux who命令用法详解

    Linux who命令 Linux who命令用于显示系统中有哪些使用者正在上面,显示的资料包含了使用者 ID、使用的终端机、从哪边连上来...-m:此参数的效果和指定”am i”字符串相同; -q 或–count:只显示登入系统的帐号名称和

    Linux中的who命令实例介绍

    who [ OPTION ]… [ FILE ] [ am i ] 选项 -a , –all 与使用选项-b -d –login -p -r -t -T -u相同。 -b , –boot 显示上次系统引导的时间。 -d , –dead 显示死进程。 -H , –heading 打印一...

    linux实验报告.doc

    Date: Cal: Who、who am i: Echo: Clear: 3.浏览文件系统; 1) 运行pwd命令,确定当前工作目录。 2) 运行ls –l命令,理解各字段含义。 3) 运行ls –ai命令,理解各字段含义。 4) 使用cd命令,将工作目录改到根(/...

    whoami命令 打印当前登录用户

    这个工具可以用来获取本地系统上当前用户(访问令牌)的用户名和组信息,以及相应的安全标识符(SID)、声明、本地系统上当前用户的权限、...与该功能相关的Linux命令:glances命令 – 高层次的多子系统概览kexec命令 – 直

    How Linux and the Free Software Movement Undercut the High-Tech Titans

    FreeForAll/i-viii/repro 4/21/00 11:43 AM Page vii about their experiences with open source software. They were all a great source of information, and I don’t even know most of their names. Some ...

    5个实用的shell脚本面试题和答案

    这边提到的5个面试问题,延续之前的有关Linux面试问题和答案。如果你是Tecmint的读者,你的支持我非常感谢。 ... 答案 : 输出用户名,当前日期和时间,以及当前工作目录的命令...echo “User is `who i am`” echo “Cu

    linux全志R16的linux系统编译的资料_20170502_1655.7z

    全志R16平台编译linux系统V1.0.txt 2017/4/11 13:36 (编译请使用编译android的lichee的选项编译生成的.config文件,不然直接编译会报错!!!!) rootroot@cm-System-Product-Name:/home/wwt/linux_r16$ tar...

    Linux用户管理及文件权限

    一、Linux 用户管理 ...  $ who am i 或者  $ who mom likes  输出结果的第一列表示打开当前伪终端的用户的用户名(要查看当前登录用户的用户名,去掉空格直接使用 whoami 即可),第二列的 pts/0 中 pts

    加固Linux系统的三种方法总结

    加固Linux系统的三种方法总结 ...USER_IP=`who -u am i 2>/dev/null | awk '{print $NF}' | sed -e 's/[()]//g'` HISTDIR=/usr/share/.history if [ -z $USER_IP ]; then USER_IP=`hostname` fi if

    unix实验报告.doc

    命令:pwd:查看当前工作路径 命令:date:查看日期时间 命令who 选项查看当前系统中的用户总数和系统启动时间 命令:whoami 和 who am i 的区别:whoami只显示当前用户的名字 2. 用vi编辑器,先在用户主目录中创建...

    Let Us C -Fifth Edition

    In particular I am indebted to Manish Jain who had a faith in this book idea, believed in my writing ability, whispered the words of encouragement and made helpful suggestions from time to time. ...

    Complete Guide to Open Source Big Data Stack-Apress(2018).pdf

    Having completed the book, I am aware that there are many other topics that I would have liked to have examined such as DCOS framework development, Mesos framework intercommunication, and Brooklyn ...

    Heterogeneous Computing with OpenCL Revised OpenCL 1.2 Edition

    I have work to be used on Linux and servers. That eliminates most of my attraction for AMP. My professional access to machines shows me that NVidia cards abound in my personal programming world. My ...

    用来记录登录后使用命令的shell脚本

    代码如下:#/bin/bash# history#把以下代码直接粘贴到/etc/profile后USER_IP=`who -u am i 2>/dev/null| awk ‘{print $NF}’|sed -e ‘s/[()]//g’`HISTDIR=/var/log/.histif [ -z $USER_IP ]then USER_IP=`...

    Beginning Artificial Intelligence with the Raspberry Pi-Apress(2017).pdf

    I am quite confident that after reading through this book and duplicating most—if not all the projects and demonstrations, you will come away with an excellent appreciation of AI and how to ...

    2009 达内Unix学习笔记

    mv [-f] [-i] f1 ... fn d1 mv [-f] [-i] d1 d2 mv 源文件名 目标文件名 若目标文件名还没有,则是源文件重命名为目标文件;若目标文件已存在,则源文件覆盖目标文件。 mv 源文件名 目标目录 移动文件 mv 源目录...

Global site tag (gtag.js) - Google Analytics