Unix File System

Unix File System

UNIX FILE SYSTEM In Unix, everything from which data can be taken or to which data can be sent, even I/O devices, is a file. For example, all devices exist in /dev/ directory as files. Directories are also considered to be files. Major Directory files: 1. bin: UNIX commands and installed executable programs 2. dev: all peripheral devices 3. etc: administrative files including user account lists (passwords are encrypted) 4. home: user home directories 5. use: user home directories and user accessible programs in /usr/bin 6. sbin: super-user (administrator) commands 7. var: frequently changed files, such as email boxes Pathnames: absolute pathname = full pathname = absolute file name = full file name Gives the location of the file in relation to the root of the file system e.g., /bin /dev /etc /home /usr /home/jill/mydoc/abs.txt relative pathname . represents the current directory .. represents the parent of the current directory e.g., ./../jill/mydoc/abs.txt Commands: 1. Listing Files (“ls”): list files in the current directory; ls –a: list all, including hidden files; ls –a | more: display the list page by page on the screen; ls –l: produce long list containing more information for each file. e.g., ls, ls –a, ls –a | more ./../, ls –al | more ./../ 2. Copy (“cp”), Move (“mv”), and Rename (“rn”) a file 3. Redirection (“>”): Output of a program is sent to a file. Example: ls –al > myfiles.txt 4. Appending (“>>”): add the output of a program to the end of a file, keeping the original contents of the file. Exmple: ls >> myfiles.txt 5. Link (“ln”): a pointer file pointing to another file (alias). Example: ln existing- file new-pointer-file (e.g., ln ./../mydoc.txt ./mydocPointer.txt) 6. Create a directory file (“mkdir dir-name”). Example: mkdir ./mynewdir 7. Remove a directory file (“rmdir dir-name”). Example: rmdir ./mynewdir Reading File Information: When you do “ls –al”, each line representing a file consists of the following data: 1. First-letter: file type: “d” is a directory file and “-“ is an ordinary file 2. 9 letters: Access privileges Three letters for the owner Three for all users in the owners user group Three for all the other users r: read access is permitted w: write access is permitted x: executing the file is permitted Example: rwx r-- ---: Owner can read, write, and execute Any user in the owner’s user group can read Public has no access privileges 3. The number of links (pointer files) to this file 4. Owner user ID 5. Owner’s user group ID 6. File size in bytes 7. Last Modified Date & Time 8. File Name Changing File Information: 1. chown userID file-name: change the ownership 2. chgrp groupID file-name: change the group of the file 3. chmod u+w file-name: give the owner write permission chmod g+x file-name chmod a+r file-name: give the public read permission chmod u=rw file-name: clear and set the owner’s access privileges to “rw-“ chmod u=rwx, go=r file-name etc Quiz 2: Try all the commands in this note. Submit a report showing the actual results of the commands displayed on the screen. .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us