Chapter 6, Environment Variables 1. Start a new bash shell/terminal session. 2. In your home directory which should be /home/, make a new directory called week4. 3. Within directory week4, create a symbolic link to /bin/bash called bash, e.g., trangbash. Use ls -l to verify the link. 4. Within directory week4, create another file (using touch) called testfile. Use ls -l to see the default permissions. 5. From your home directory, echo $PATH to see your current path. Set PATH to include the directory week4. echo $PATH again to verify the change. 6. From your home directory, execute bash by typing bash, e.g., trangbash. NB. If you accomplished step 5 incorrectly, that won’t work. Examine your PATH variable and try again. 7. Type ps to verify bash is running. 8. Type exit to exit bash. (NB. Be careful--if it’s not running, you’ll exit bash and your terminal session, and will have to start over.) 9. From ~, try to edit testfile (in the week4 folder, created in step 2). As above, I recommend using nano. Try to add a line or two of text (keep it short), then save the file: [ctrl]-o, [enter], and [ctrl]-x to exit. 10. Repeat step 9, but type sudo before the command. Your password will be required. Add a line or two. [ctrl-o] enter, [ctrl]-x. Verify that your edit persisted using cat. 11. Delete the file testfile. If on another distribution, and permission is denied, use sudo to get it done. ls ~/test to verify deletion. 12. Copy *all* of the terminal session below, using the terminal’s Edit/Select All, Edit/Copy, and then paste into the document.
The terminal Session of your Question (I can not send document file because there is no option for attaching document files. But All your answer are pasted here.)
For creating Soft Link of /bin/bash we need sudo permission. so use sudo before ln command.
For view the path we have used the $PATH environment variable.
For Setting the path we are using EXPORT Command. So that we can use the link as command from any location.
Example : export $PATH=$PATH:your Current path
ls -l :- is used to long list of files or directory i.e permission for files or directory
Code
itreradmin@c-207-c067:~$ clear
itreradmin@c-207-c067:~$ mkdir week4
itreradmin@c-207-c067:~$ cd week4/
itreradmin@c-207-c067:~/week4$ sudo ln -s /bin/bash trangbash
[sudo] password for itreradmin:
itreradmin@c-207-c067:~/week4$ ls -l
total 0
lrwxrwxrwx 1 root root 9 Feb 10 19:08 trangbash -> /bin/bash
itreradmin@c-207-c067:~/week4$ touch testfile
itreradmin@c-207-c067:~/week4$ ls -l
total 0
-rw-r--r-- 1 itreradmin itreradmin 0 Feb 10 19:08 testfile
lrwxrwxrwx 1 root root 9 Feb 10 19:08 trangbash -> /bin/bash
itreradmin@c-207-c067:~/week4$ cd
itreradmin@c-207-c067:~$ pwd
/home/itreradmin
itreradmin@c-207-c067:~$ echo $PATH
/home/itreradmin/anaconda3/condabin:/usr/lib/oracle/12.2/client64/bin:/usr/lib/oracle/12.2/client64/bin:/home/itreradmin/.local/bin:/home/itreradmin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
itreradmin@c-207-c067:~$ export PATH=$PATH:/home/itreradmin/week4/
itreradmin@c-207-c067:~$ echo $PATH
/home/itreradmin/anaconda3/condabin:/usr/lib/oracle/12.2/client64/bin:/usr/lib/oracle/12.2/client64/bin:/home/itreradmin/.local/bin:/home/itreradmin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/itreradmin/week4/
itreradmin@c-207-c067:~$ trangbash
itreradmin@c-207-c067:~$ ps
PID TTY TIME CMD
12410 pts/0 00:00:00 bash
12447 pts/0 00:00:00 trangbash
12458 pts/0 00:00:00 ps
itreradmin@c-207-c067:~$ exit
exit
itreradmin@c-207-c067:~$ nano ~/week4/testfile
itreradmin@c-207-c067:~$ sudo nano ~/week4/testfile
itreradmin@c-207-c067:~$ cat ~/week4/testfile
Prakash
Chandra
Bhoi
ITER
itreradmin@c-207-c067:~$ rm ~/week4/testfile
itreradmin@c-207-c067:~$ ls ~/week4/
trangbash
itreradmin@c-207-c067:~$
Screen Shorts of Terminal Session


Chapter 6, Environment Variables 1. Start a new bash shell/terminal session. 2. In your home directory...