How to add multiple paths in environment variable in Linux

The path($PATH) variable is used to pass important pieces of information like the location of a file to Linux programs when they are running. So how c

How to Create Ubuntu Live USB in Windows
Linux Commands – Working with Directories

The path($PATH) variable is used to pass important pieces of information like the location of a file to Linux programs when they are running. So how can you add multiple locations to the path ($PATH) environment variable at the same time?

These are the steps you need to follow to add multiple paths to environment variable

  • 1) make a list of all file locations that needed to be added to the path environment variable

example: let’s say you have to add the following six folder locations to the path variable.

1./usr/bin:
2./bin:
3 /usr/local/sbin
4./usr/sbin
5./sbin
6 /home/myuser/bin

  • 2) Go to terminal and type this command
export PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/myuser/bin

Note: here all the folder locations above are separated with a colon(:) character.

  1. 3)use the next command to export the variables
export PATH

or you can combine the two command and just use the command below

export PATH=${PATH}:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/myuser/bin

 

COMMENTS

WORDPRESS: 0
DISQUS: