120 likes | 216 Views
Lab 2 N avigating the File system. bin. vue. lib. sbin. contrib. local. share. Layout of UNIX’s File Systems. / /. sbin. usr. dev. etc. opt. var. stand. tmp. home. vmunix. user1. group. passwd. profile. user2. mail. news. tmp. vue. man. man. ls. cp. sh. tar. vi.
E N D
bin vue lib sbin contrib local share Layout of UNIX’s File Systems / / sbin usr dev etc opt var stand tmp home vmunix user1 group passwd profile user2 mail news tmp vue man man ls cp sh tar vi
/ home tmp usr bin F1 user1 user2 user3 cp ls vi man F1 F1 F1 memo F1 Path Names • Absolute Pathname – The name of a file or directory with respect to the root (/) directory • Relative Pathname – The name of a file or directory with respect to the user’s present working directory (pwd) 4 2 1 3
pwd: Your Present Working Directory • pwd – Command that tells your present working directory • Example: / $ pwd /home/user3 You are here home user1 user2 user3 F1 F1 F1 memo F1
ls: List the Contents • ls– Command used to list the names of files and directories • Example: / home $ ls f1 f2 memo $ ls –F F1 F2* memo/ $ ls –aF .profile F1 F2* memo/ $ ls memo F1 F2 user1 user2 user3 F1 F1 .profile F1 F2 memo F2 F1
cd: Changing your Current Directory • cd – Command that will allow you to change directory, and move to some other location in the hierarchy • Example: / $ pwd /home/user3 $ cd memo; pwd /home/user3/memo $ cd ../.. ; pwd /home $ cd /tmp; pwd /tmp tmp home F1 user1 user2 user3 F1 F1 .profile F1 F2 memo F2 F1
mkdir: Making Your Own Directories • mkdir– Command that will allow you to make a directory • Example: / $ pwd /home/user3 $ mkdir fruit $ mkdir fruit/apple $ cd fruit $ mkdir grape orange home user1 user2 user3 F1 F1 fruit .profile F1 F2 memo F2 F1 apple grape orange
rmdir: Deleting Directories • rmdir – Command used to remove directories • Example / $ rmdir orange $ cd .. $ rmdir fruit rmdir: fruit not empty home user1 user2 user3 F1 F1 memo .profile F1 F2 fruit F2 F1 apple grape orange $ rmdir fruit/apple fruit/grape fruit
touch: Creating an empty file • Example $ pwd /home/user3/fruit $ touch kiwi $ ls apple grape orange kiwi / home user1 user2 user3 F1 F1 memo .profile F1 F2 fruit F2 F1 grape orange kiwi apple