How do you change File Access Permissions?
Every file has following attributes:
owner's user ID ( 16 bit integer )
owner's group ID ( 16 bit integer )
File access mode word
owner's user ID ( 16 bit integer )
owner's group ID ( 16 bit integer )
File access mode word
'r w x -r w x- r w x'
(user permission-group permission-others permission)
r-read, w-write, x-execute
To change the access mode, we use chmod(filename,mode).
Example 1:
To change mode of myfile to 'rw-rw-r–' (ie. read, write permission for user - read,write permission for group - only read permission for others) we give the args as:
chmod(myfile,0664) .
Each operation is represented by discrete values
r-read, w-write, x-execute
To change the access mode, we use chmod(filename,mode).
Example 1:
To change mode of myfile to 'rw-rw-r–' (ie. read, write permission for user - read,write permission for group - only read permission for others) we give the args as:
chmod(myfile,0664) .
Each operation is represented by discrete values
'r' is 4
'w' is 2
'x' is 1
Therefore, for 'rw' the value is 6(4+2).
'w' is 2
'x' is 1
Therefore, for 'rw' the value is 6(4+2).
Example 2:
To change mode of myfile to 'rwxr–r–' we give the args as:
chmod(myfile,0744).To change mode of myfile to 'rwxr–r–' we give the args as:
How do you find out what’s your shell?
- echo $SHELL
What’s the command to find out today’s date?
- date
What’s the command to find out users on the system?
- who
How do you find out the current directory you’re in?
- pwd
How do you remove a file?
- rm
Can anyone explain me the following command? I came across this in one of the shell acripts. sed -e '/^$/d' -e 's/^[ ][ ]*/ /' A)This sed command contains two edits: '/^$/d' this deletes all blank lines 's/^[][]*/ /' for each line, replace all leading spaces with one space. |
No comments:
Post a Comment