Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Linux: 4.1: A file in a system with a block size of 1024 bytes contains 1026 byt

ID: 3790863 • Letter: L

Question

Linux:

4.1: A file in a system with a block size of 1024 bytes contains 1026 bytes. How many bytes of disk space does it occupy?

4.4: Create a file foo. How do you assign all permisisons to the owner and remove all permissions from others using (i) relative assignment and (ii) absolute assignment ? do you need to make any assumptions about foo’s default permissions?

4.9: you tried to copy a file foo from another user’s directory, but you got the error message “Cannot delete file foo” You have write permission in your own directory. What could be the reason, and how do you copy?

4.10: what do you ensure so that no one can see the names of the files you have?

4.13: if the owner doesn’t have write permissions on a file but her group has, can she (i) Edit it, (ii) delete it?

5.2: how will you add /* at the beginning of a line and * at the end?

5.6: in the midst of your work, how can you see the list of users logged in? if you have a number of UNIX commands to execute, which of course of action will you take?

5.13: how will you search for a pattern ‘printf’ and then repeat the search in the opposite direction from that in which the original search was made?

5.16: if the power of the machine was to cut off while a vi is active, how does it affect your work? What salvage operations will you try?

5.18: you made some changed to a read-only file and then found that you cant save the buffer. What course of action will you take without quitting the editor?

Explanation / Answer

4.1 as the block size is 1024,but we have 1026 thus the disk space is 2 blocks i.e 2048.
4.4
Assumption that ur the owner as only the owner has permissions to alter permissions
relative when used with the + or - symbols
$touch foo --this creates empty file
chmod u=rwx foo ---assign all perms to user/owner
chmod o = -rwx ---remove al permission to others.
Absolutemode:
In this mode file permissions are not represented as characters but a three digit octal number.  
$ touch foo
$ chmod 700 foo --this removes all persmission to others and add all to user/owner
4.9
That would be because the way your current permissions are set, no one can move that file.
chmod -R o+rwx foo --this wil help with everyone the ability to read, write and execute on that directory.
4.10
renaming files with prefix dot(.) will hide ur files.
mv foo .foo
5.2
gsed command heps to add
gsed -i '1s/^/* /gm; $s/$/ *//gm' foo
5.3
w command or who command

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote