Assignment 2 - Linux Environment Variable
Name: Aketi Thanuja Batch: Sept 8
1.State the command for the following.
a.view current environment variables
Ans: Syntax: 1. $ printenv
2. $ env
b.display the PATH evirnment variable value
Ans: Syntax: $ printenv PATH
c.update PATH to include the path to your home directory
Ans: Syntax: $ export PATH=”$HOME/bin:$PATH”
$ nano ~/ .bashrc – we will set the PATH variable in this
file.
We can save this file and load the new PATH into the current shell session
using source command i.e.,
$ source ~/ .bashrc
Now we can check whether the directory is successfully added by using
$ echo $PATH
2.How will you make the environment changes applicable to all users?
Which script is to be modified?
Ans: To make permanent changes to the environment variables for all new
accounts, go to your /etc/skel files, such as . bashrc , and change the ones
that are already there or enter the new ones. When you create new users,
these /etc/skel files will be copied to the new user’s home directory.
3.I have installed an application named “myapp”. After installation, if I
invoke the application, it fails with error as “Command myapp not
found”. How will you fix this?
Ans: 1. Install the package related to it.
2. Add a new path
3. Copy the file to an existing path location
4. Include the path