In: Computer Science
1.) create five different files using touch command(filenames can vary according to your choice)
2.) set privileges to be 755 for each file
3.) one of your file will be a shell script which will change the privileges to be 644 for all the files.
Document your output in a word with necessary screen shots
Answer 1:
As you can see in below figure first we have don’t have 5 file like File1.c, File2.c, File3.c, File4.c, File5.c that we confirm using ls command then we create all file using touch command and check it using ls command so all file is created.
touch command mainly used when user don’t have content at the time when create the file. We Can create single as well as multiple file using touch command.
Answer 2:
File permission is checked using command,
ls –l
The file permissions give us following permission:
· First rw means the owner has read and write privileges
· Second r means the owner’s group has read privileges
· Last r means Other users have read privileges
To set privileges to be 755 for each file use command,
chmod -R 755 Filename
When this command execute then it gives read, write, and execute privileges to the owner (7) , read and execute access to owner’s group (5) and read and execute access to everyone else (5). We can check this using command,
ls –l
Answer 3:
Create shell script file which change the privileges to be 644 for all the files.
Create shell script file set.sh using command
vi set.sh
Type the content as shown in below figure and the save file using :wq command.
Run the file with bash command
bash set.sh
Check that file permission is change using command
ls -l
As you can see in the above picture that file permission is changed. It gives read, write privileges to the owner (6) , read access to owner’s group(4) and read access to everyone else (4). We can check this using command.
At any point if you have any difficulty feel free ask me.