Environment / Path Variables

Aus virengos.org wiki
Zur Navigation springen Zur Suche springen

Basics

[1]

  • print all environment variables
printenv
  • The PATH is an environment variable. It is a colon delimited list of directories that your shell searches through when you enter a command
  • How do I add a new path to $PATH variable under Linux?
  • List the current PATH
echo "$PATH"
  • List the PATH variables formatted as a list
echo $PATH | tr ":" "\n" | nl
  • Modify the PATH
export PATH=$PATH:/home/damb/Downloads
export PATH=$PATH:/path/to/dir1:/path/to/dir2
  • Make the changes persistent

Add manually to the profile file and use the source command

. ~/.profile
source ~/.profile
  • Globally for all users

[2]

Print shared object dependencies

  • prints the shared objects (shared libraries) required by each program or shared object specified on the command line
$ ldd /bin/ls 

Manage multiple libraries versions

[3]

$ export LD_LIBRARY_PATH:/opt/salome/lib/
$ export LD_LIBRARY_PATH=/usr/lib/oldstuff:/opt/IBM/AgentController/lib