惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
罗磊的独立博客
小众软件
小众软件
I
InfoQ
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
MyScale Blog
MyScale Blog
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
H
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
P
Proofpoint News Feed
博客园 - 司徒正美
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
Jina AI
Jina AI
N
Netflix TechBlog - Medium

博客园 - Michael Zhang

MacBook Home End SLES Install cucumber soapui test web services S/4 HANA Solution Manager Linux下创建新用户 2008 R2中的无线连接 wireless 不实用,还小有点意思-IE6 UI测试中的小发现 [转载]一个回收站小工具---RecycleBin Gotcha 尝试改变Survey完成后的默认行为(JavaScript) SharePoint开发中的小点滴 Document Library的URL 添加新的站点栏目类型(New Custom Field (Column) Type) 完全控制SharePoint站点菜单(Get full control of SharePoint ActionMenus) Part 1 从WSS 3.0到MOSS 2007 WSS文档库备份及复制 如何备份sharepoint中的文档库? Document Library中Server Menu问题(New和Upload菜单消失) 站点迁移 从单机到服务器场 从上海到大连 又出现两个问题 关于Alert和WebDAV Sharepoint 2007 Forms认证与File Not Found错误
su with hyphen and without - su带横杠和不带横杠
Michael Zhang · 2016-10-12 · via 博客园 - Michael Zhang

The difference between "-" and "no hyphen" is that the latter keeps your existing environment (variables, etc); the former creates a new environment (with the settings of the actual user, not your own).

带横杠的会创建一个全新的环境,使用的是真实用户的设置。 不带横杠的还保留了之前用户的设置,例如当前目录,环境变量等等。

https://wiki.archlinux.org/index.php/Su

The hyphen has two effects:

1) switches from the current directory to the home directory of the new user (e.g., to /root in the case of the root user) by logging in as that user

2) changes the environmental variables to those of the new user as dictated by their ~/.bashrc. That is, if the first argument to su is a hyphen, the current directory and environment will be changed to what would be expected if the new user had actually logged on to a new session (rather than just taking over an existing session).