mobile itt solutions...created date 1/14/2015 6:31:15 pm

3
working with directories 8.8. practice: working with directories 1. Display your current directory. 2. Change to the ietc directory. 3. Now change to yourhome directorlrui@ 4. Change to the /boot/grub directoqy ruing o'lh, eleven key pressos, 5. Go to the parent directory of the current directory. 6. Go to the root directory. 7. List the contents of the root directory. 8. List a long listing of the root directory- 9. Stay where you are, and list the contents of letc. 10. Stay where you a:e, and list the contents of /bin and /sbin. 11. Stay where you are, and list the contents of -. 12. List all the files (including hidden files) in your home directory. 13. List the files in /boot in a human readable format. 14. Create a directory testdir in your home directory. 15. Change to the /etc directory, stay here and create a directory newdir in your home directory. 16. Create in one command the directories -ldnll&r2/dn3 (dir3 is a subdirectory from dir2, and dir2 is a subdirectory from dirl ). 17. Remove the directory testdir. genmffid:r- 80

Upload: others

Post on 11-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mobile ITT Solutions...Created Date 1/14/2015 6:31:15 PM

working with directories

8.8. practice: working with directories1. Display your current directory.

2. Change to the ietc directory.

3. Now change to yourhome directorlrui@4. Change to the /boot/grub directoqy ruing o'lh, eleven key pressos,

5. Go to the parent directory of the current directory.

6. Go to the root directory.

7. List the contents of the root directory.

8. List a long listing of the root directory-

9. Stay where you are, and list the contents of letc.

10. Stay where you a:e, and list the contents of /bin and /sbin.

11. Stay where you are, and list the contents of -.

12. List all the files (including hidden files) in your home directory.

13. List the files in /boot in a human readable format.

14. Create a directory testdir in your home directory.

15. Change to the /etc directory, stay here and create a directory newdir in your homedirectory.

16. Create in one command the directories -ldnll&r2/dn3 (dir3 is a subdirectory from dir2,and dir2 is a subdirectory from dirl ).

17. Remove the directory testdir.

genmffid:r-

80

Page 2: Mobile ITT Solutions...Created Date 1/14/2015 6:31:15 PM

8.9. solution: working with directoriesl. Display your crxrent directory.

grd

2. Change to the /etc directory.

cd /etc

3. Now change to your home directory using only three key presses.

cd (and the enter key)

4. Change to the /booVgrub directory using only eleven key presses.

cd /boot/grub (use the t.ab key)

5. Go to the parent directory of the current directory.

cd - . (with space between cd and . . )

6. Go to the root directory.

cd/

7. List the contents of the root directory.

1s

8. List a long listing of the root directory.

Is -1

9. Stay where you are, and list the contents of /etc.

Is /etc

10. Stay where you are, and list the contents of /bin and /sbin.

Is /bin /sbin

11. Stay where you are, and list the contents of -.1s-

12. List all the files (including hidden files) in your home directory.

ls -aI -

13. List the files in /boot in a human readable format.

LE -Ih /boot

14. Create a directory testdir in your home directory.

mkdir -/testdir

15. Change to the /etc directory, stay here and create a directory newdir in your homedirectory.

81

Page 3: Mobile ITT Solutions...Created Date 1/14/2015 6:31:15 PM

working with directories

cd letc ; rnkdir -/newdir

16. Create in one coilrmand the directories-/dnl/dir2ldir3 (dir3 is a subdirectory from dir2,and dir2 is a subdirectory from dirl ).

nrkdir -p -/d,irt/ dir2 / dir3

17. Remove the directory testdir.

rmdir testdir

18. If fime permits (or if you are waiting for otler students to finish this practice), use andunderstand pushd and popd. Use the man page of bash to find information about thesecommands.

man bash * opens the manual/puehd * searehes for pushdn # next (do t,hi.s trro/t.hree times)

The Bash shell has two built-in commands called pushd and popd. Both commands workwith a common stack ofprevious directories. Pushd adds a directory to the stack and changesto a new current directory, popd removes a directory from the stack and sets the currentdirectory.

paulodebianl : / et cS cd,/biapaul@debian7: /bi-ng purbd ,/l.J.b/Llb /biyrpaul@debian7 : /1ibg l,ucbd /proc/proc /ltb lbtrrpaul@debian? : /procg popd/Lib /bLnpauledebi.an? : /libg popd/bLn

82