Professional Documents
Culture Documents
10. Stay where you a:e, and list the contents of /bin and /sbin.
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 ).
genmffid:r-
80
8.9. solution: working with directories
l. Display your crxrent directory.
grd
3. Now change to your home directory using only three key presses.
1s
Is -1
10. Stay where you are, and list the contents of /bin and /sbin.
Is /bin /sbin
mkdir -/testdir
15. Change to the /etc directory, stay here and create a directory newdir in your home
directory.
81
working with directories
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
rmdir testdir
18. If fime permits (or if you are waiting for otler students to finish this practice), use and
understand pushd and popd. Use the man page of bash to find information about these
commands.
manbash * opens the manual
/puehd * searehes for pushd
n # next (do t,hi.s trro/t.hree times)
The Bash shell has two built-in commands called pushd and popd. Both commands work
with a common stack ofprevious directories. Pushd adds a directory to the stack and changes
to a new current directory, popd removes a directory from the stack and sets the current
directory.
paulodebianl : / et cS cd,/bia
paul@debian7: /bi-ng purbd ,/l.J.b
/Llb /biyr
paul@debian7: /1ibg l,ucbd /proc
/proc /ltb lbtrr
paul@debian? : /procg popd
/Lib /bLn
pauledebi.an? : /libg popd
/bLn
82