linux下添加环境变量

例子:

使用命令将这个目录:“/home/geeksongs/.local/bin”添加进环境变量

命令行如下:

export PATH=/home/geeksongs/.local/bin:$PATH

查看是否添加成功:

geeksongs@DESKTOP-V7FKNMA:~$ echo $PATH

输出:

/home/geeksongs/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/Intel/WiFi/bin/:/mnt/c/Program Files/Common Files/Intel/WirelessCommon/:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Users/THINK/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Python 3.8:/mnt/c/Users/THINK/AppData/Local/Programs/Python/Python38:/mnt/c/Users/THINK/AppData/Local/Programs/Python/Python38/Scripts:/mnt/c/Users/THINK/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/THINK/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin

里面具有这个环境变量,第一个就是我们刚刚添加的文件夹目录,则环境变量添加成功!!