0% found this document useful (0 votes)
21 views10 pages

Lab 05

This document summarizes file and directory operations covered in an operating systems lab, including: 1. Details file and directory permissions and how to change them using the chmod command in either octal or symbolic formats. 2. Explains how to examine file contents, find files, search files for text patterns, sort files, compress files and make backups, and access removable media. 3. Provides examples of modifying permissions on individual files and recursively on directories using chmod.

Uploaded by

Educationist
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views10 pages

Lab 05

This document summarizes file and directory operations covered in an operating systems lab, including: 1. Details file and directory permissions and how to change them using the chmod command in either octal or symbolic formats. 2. Explains how to examine file contents, find files, search files for text patterns, sort files, compress files and make backups, and access removable media. 3. Provides examples of modifying permissions on individual files and recursively on directories using chmod.

Uploaded by

Educationist
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Operating Systems Lab 05

File and Directory Operations


This lecture covers:
• File and directory permissions in more detail and how these
can be changed.
• Ways to examine the contents of files.
• How to find files when you don't know their exact location.
• Ways of searching files for text patterns.
• How to sort files.
• Tools for compressing files and making backups.
• Accessing floppy disks and other removable media.
File and Directory Permissions

• Three types of permission


– Read (r)
– Write (w)
– Execute (x)

• Three categories of users


– User/owner (u)
– Group (g)
– Others (o)
File and Directory Permissions
Permission File Directory
Read (r) User can look at the User can list the files in
contents of the file the directory
Write (w) User can create new
User can modify the files and remove existing
contents of the file files in the directory
Execute (x) User can change into
the directory, but
cannot list the files
User can use the unless (s)he has read
filename as a UNIX permission. User can
command read files if (s)he has
read permission on
them.
Modify Permissions
• File and directory permissions can only be modified by their
owners, or by the superuser (root), by using
the chmod system utility.

• chmod (change [file or directory] mode)


  $ chmod options files

• Chmod options [accepts in two forms]


1. Using Octal digits.
2. Using symbols.
1. Modify Permissions Using Octal Digit
• Permissions may be specified as a
sequence of 3 octal digits [0-7]

Permission Digit
• Example:
--- 0
chmod 600 private.txt --x 1
-w- 2
-wx 3
sets the permissions on private.txt to 
r-- 4
rw------- (i.e. only the owner can read r-x 5
and write to the file). rw- 6
rwx 7
2. Modify Permissions Using Symbol
• Permissions may be specified Symbol Meaning
symbolically, using the symbols. u User
g Group
•     $ chmod ug=rw,o-rw,a-x *.txt o Other
a All
r Read
• sets the permissions on all files
w Write
ending in *.txt to rw-rw---- (i.e. the
owner and users in the file's group x Execute
can read and write to the file, while + Add
the general public do not have any permission
sort of access). -
Take away
permission
Assign
=
permission
• chmod also supports a -R option which can be used to
recursively modify file permissions, e.g.

•     $ chmod -R go+r play

• will grant group and other read rights to the


directory play and all of the files and directories within play. 
 
Modify Permissions Using Octal Digit
Modify Permissions Using Symbol

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy