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

Commands for viewing, adding, and configuring environment variables under Linux

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

Share

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

This article introduces the knowledge of "commands to view, add and configure environment variables under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. You can view the path value with the export command

[root@localhost u-boot-sh5] # export can view all variables

two。 To view the PATH environment variables separately, you can:

[root@localhost u-boot-sh5] # echo $PATH

3. Add PATH environment variable (temporary), available:

[root@localhost u-boot-sh5] # export PATH=/opt/STM/STLinux-2.3/devkit/sh5/bin:$PATH

4. Permanently add environment variables (affecting the current user)

# vim ~ / .bashrc

Export PATH= "/ opt/STM/STLinux-2.3/devkit/sh5/bin:$PATH"

5. Permanently add environment variables (affecting all users)

# vim / etc/profile

At the end of the document, add:

Export PATH= "/ opt/STM/STLinux-2.3/devkit/sh5/bin:$PATH"

Save, exit, and then run:

# source / etc/profile

Ag:

Java use yum installation do not know where the installation path, want to configure the environment variable how to operate?

View the java installation path

View and use: set java_home under windows

View and use: whereis java under linux

The following is how I view linux

Java: / usr/bin/java / etc/java / usr/lib/java / usr/share/java / usr/share/man/man1/java.1.gz

Usually the first / usr/bin/java = > this is a file, according to which you can find the final installation directory

My final installation directory is / usr/lib/jvm/java

Configure the environment variables after finding the installation directory

Here are the environment variables that configure linux: (remember source .bash _ profile) vi this file / etc/profileexport JAVA_HOME=/usr/lib/jvm/javaexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Add at the end of the .bash _ profile file: export PATH=$JAVA_HOME/bin:$PATH.shell terminal executes the following command: (temporary) export PATH=$JAVA_HOME/bin:$PATH

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

*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