Home  >  Article  >  Operation and Maintenance  >  How to log out the user in linux

How to log out the user in linux

(*-*)浩
(*-*)浩Original
2019-11-07 09:27:055600browse

How to log out the user in linux

There are three ways for users to log out:

1, Enter exit at the shell prompt and press Enter to confirm. ​ ​ (Recommended learning: linux operation and maintenance)

2. Enter logout at the shell prompt and press Enter to confirm

3. Press the shortcut key crtl d (this method has the same effect as logout)

How to log out the user in linux

##One of the common Linux commands - exit, switch users exit, su

The exit command is the same as exiting the shell and returns a given value. In the shell script, the current script execution can be terminated. Executing exit can cause the shell to exit with the specified status value.

If the status value parameter is not set, the shell exits with the default value. The status value 0 represents successful execution, and other values ​​represent execution failure.

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

Options:

-c or --command=: After executing the specified command, the original identity will be restored;

-f or --fast: Applicable to csh and tsch, so that the shell does not have to read the startup file;

-l or --login: When changing the identity, the working directory will also be changed at the same time. , and HOME,SHELL,USER,logname. In addition, the PATH variable will also be changed;

-m,-p or --preserve-environment: When changing the identity, do not change the environment variable;

-s or --shell =: Specify the shell to be executed;

--help: Display help;

--version; Display version information.

The above is the detailed content of How to log out the user in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn