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

Use the env command of linux to display and define environment variables

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces the use of linux env command display and definition of environmental variables, the text is very detailed, has a certain reference value, interested friends must read!

The env command is used to display environment variables that already exist in the system and to execute instructions in defined environments. This command only uses "-" as a parameter option, hiding the functionality of option "-i". If no options and parameters are set, the current environment variables are displayed directly.

If you use the env command to execute instructions in a new environment, the error message "such file or directory" is displayed because the environment variable "PATH" is not defined. At this point, the user can redefine a new PATH or use an absolute path.

Syntax format: env [parameter]

Common parameters:

-i starts a new empty environment-u removes the specified variable from the current environment

Reference Example

Display system environment variables:

[root@linuxcool ~]# env

Delete the specified variable from the current environment:

[root@linuxcool ~]# env -u LOGNAME

Define specified environment variables:

[root@linuxcool ~]# env LOGNAME=root The above is all the contents of using linux env command to display and define environment variables. Thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

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: 226

*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

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report