working with directories
1. Display
your current directory.
ANS:pwd
2. Change
to the /etc directory.
ANS:cd
/etc
3. Now
change to your home directory using only three key presses.
ANS:cd
(and the enter key)
4. Change
to the /boot/grub directory using only eleven key presses.
ANS:cd
/boot/grub (use the tab key)
5. Go to
the parent directory of the current directory.
ANS:cd ..
(with space between cd and ..)
6. Go to
the root directory.
ANS:cd /
7. List
the contents of the root directory.
ANS:ls
8. List a
long listing of the root directory.
ANS:ls –l
9. Stay
where you are, and list the contents of /etc.
ANS:ls
/etc
10. Stay
where you are, and list the contents of /bin and /sbin.
ANS:ls
/bin /sbin
11. Stay
where you are, and list the contents of ~.
ANS:ls ~
12. List
all the files (including hidden files) in your home directory.
ANS:ls -al
~
13. List
the files in /boot in a human readable format.
ANS:ls -lh
/boot
14. Create
a directory testdir in your home directory.
ANS:mkdir
~/testdir
15. Change
to the /etc directory, stay here and create a directory newdir in your home
directory.
ANS:cd
/etc ; mkdir ~/newdir
16. Create
in one command the directories ~/dir1/dir2/dir3 (dir3 is a subdirectory
from dir2,
and dir2 is a subdirectory from dir1 ).
ANS:mkdir
-p ~/dir1/dir2/dir3
17. Remove
the directory testdir.
ANS:rmdir
testdir
No comments:
Post a Comment