Linux / Unix: Please help as much as you can. Thanks. (1) Write commands for the
ID: 3854363 • Letter: L
Question
Linux / Unix: Please help as much as you can. Thanks.
(1) Write commands for the following for vi (4 points)
a. to escape to a shell to execute the command "uname -a" from vi session
b. to import the contents of "ls -l" into your vi edit session
(2) Write find commands for the following (you must write one command and not a list of
commands. Your current directory is / and you are not allowed to change directory)
a. Find files with inode number "89" from "/tmp" directory.
b. Find all files that have been touched in the past 4 days from your current directory (you are in /)
(3) Using "chmod" (4 points) One command only - NOT a list of commands
a. Set the permission of your file "project" in your current directory readable
by group,other and user.
Do not use numbers
b. Add permissions to your file "homework" to be readable executable by group and others.
Do not use numbers
c. Redo a. using numbers for permissions
d. (unrelated to a b and c) How will you change permission of all files from your home
directory to 777 ? (ie the whole subtree of your home directory)
Explanation / Answer
(1) vi
a. $( uname -a )
It will display the output of uname command with all parameters
b. :r ! ls -l
The standard output of that command will be captured and inserted into your file, starting on a new line after the line where the cursor is located. The vi command will run the ls -l program for the current directory and insert the output listing into your file.
(2) find
a. find /tmp -inum 89
here, it implies find in tmp directory files with inode number 89
b. find -type f -mtime -4
Find all the files (type should be only file) that are modified in last 4days
(3) chmod
a. chmod =r project
Here =r will set read permission for all types and will remove any other permission set prior.
b. chmod g+r+x,o+r+x homework
Here, g stands for group and o for others. Add permission using + symbol.
c. chmod 444 project
4 implies read permission only. 3 time 4 implies read permission for user, group and others.
d. chmod -R 777 /home
-R makes it recursive
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.