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 is the use of Linux's su command

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "what is the use of Linux's su command". In daily operation, I believe many people have doubts about the use of Linux's su command. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the question of "what is the use of Linux's su command?" Next, please follow the editor to study!

Linux common command su command is used to switch the current user identity to another user identity. When changing, you must enter the user account number and password to be changed.

Su is used to switch the current user identity to another user identity.

Syntax su (option) (parameter) option-c or-- command=: restores the original identity after executing the specified instruction;-f or-- fast: applicable to csh and tsch, so that shell does not have to read the startup file;-l or-- login: change the working directory and HOME,SHELL,USER,logname at the same time when you change your identity. In addition, the PATH variable will also be changed;-mmawp or-- preserve-environment: do not change the environment variable when you change the identity;-s or-- shell=: specify the shell; to be executed-- help: display help;-- version; displays version information. Parameter user: specifies the target user to switch identities.

The instance changes the account to root and exits and changes back to the original user after executing the ls instruction:

Su-c ls root change the account to root and pass the-f option to the newly executed shell:

Su root-f change your account to test and change your working directory to test's home directory:

Su-test at this point, the study on "what is the use of Linux's su command" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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