Create two directories called PHONE and CALL in your home directory. (5 points)
ID: 649349 • Letter: C
Question
Create two directories called PHONE and CALL in your home directory. (5 points) 2. Create an empty file named MESSAGE.CAL in your home directory. (5 points) 3. Create a subdirectory in the PHONE directory called BOOK. (5 points) 4. Copy the MESSAGE.CAL file into the BOOK directory. (5 points) 5. Move into the BOOK directory. What command shows your current working directory? (5 points) 6. Hide the MESSAGE.CAL file in your home directory. (5 points) 7. Rename the MESSAGE.CAL file in the BOOK directory to MESSAGE.BAK. (5 points) 8. Change the permissions on the MESSAGE.BAK file to the following : (5 points) User = read, write Group = read Other = read 9. Move the MESSAGE.BAK file to the CALL directory. (5 points) 10. Remove the PHONE directory and all of its contents. (5 points) 11. Using nano or vim, create a text file containing the following text. Name the file MEMO.EXM (list all steps taken to create the file.) (5 points) 12. Search your home directory and all subdirectories for any file that contains the word "exam", no matter what the case. (5 points) 13. Find all files in your home directory that contains the string "MO" in the filename. (5 points) 14. Gzip the MEMO.EXM file. (5 points) 15. Find the total disk usage of your home directory. (5 points) 16. Create a new user named Test. (5 points) 17. View the crontab entry for the new user Test. (5 points) 18. View the current processes that are running on the system and pipe the results through less. (5 points) 19. Change the owner of the MEMO.EXM.gz file to Test. (5 points) 20. Decompress the MEMO.EXM.gz file. (5 points)
Explanation / Answer
===================================================================================1. Create two directories called PHONE and CALL in your home directory. (5 points)
Ans:
Step1 => Goto home folder by giving command
=> cd /home/<username>
Ex: /home/smith
Step2 => mkdir PHONE
Step3 => mkdir CALL
Step3 =>To verify the directories created , Use ls command
=>ls
===================================================================================2. Create an empty file named MESSAGE.CAL in your home directory. (5 points)
Ans:
You can create file using following commands
Option1:
Using touch command
=>touch MESSAGE.CAL
Option2:
=>cat > MESSAGE.CAL
===================================================================================3. Create a subdirectory in the PHONE directory called BOOK. (5 points)
Ans:
------------------------------------------------------------
Option1:
------------------------------------------------------------
Currently you are in home directory. i.e /home/smith
Step1 => Goto PHONE directory
=>cd PHONE
Step2 => Create your sub directory
=>mkdir BOOK
------------------------------------------------------------
Option2:
------------------------------------------------------------
Direclty call this command from home directory itself
=> mkdir PHONE/BOOK
===================================================================================4. Copy the MESSAGE.CAL file into the BOOK directory. (5 points)
Ans:
Your current directory location is. /home/smith/PHONE
Step1 => Switch to home direcoty using cd .. command
=> cd ..
Step2 => Your current direcoty /home/smith
=> Enter below copy command
=> cp MESSAGE.CAL PHONE/BOOK
===================================================================================5. Move into the BOOK directory. What command shows your current working directory? (5 points)
Ans:
Step1 => Goto PHONE Directory
=>cd PHONE
And then to BOOK
=>cd BOOK
You can also directly goto BooK using
=>cd PHONE/BOOK
Step2: To see current working directoty the command used is.
PWD stands for Present Working Directory
=>PWD
output is:
/home/smith/PHONE/BOOK
===================================================================================6. Hide the MESSAGE.CAL file in your home directory. (5 points)
Ans:
To hide a file you just need to add . at the begining of file name
And the command is.
=> mv MESSAGE.CAL .MESSAGE.CAL
(Where prefix . stands for hidden file)
===================================================================================7. Rename the MESSAGE.CAL file in the BOOK directory to MESSAGE.BAK. (5 points)
Ans:
For renaming also you can use mv command.
=> mv MESSAGE.CAL MESSAGE.BAK
===================================================================================8. Change the permissions on the MESSAGE.BAK file to the following : (5 points)
User = read, write
Group = read
Other = read
Ans:
You have to use chmod command.
=> chmod 644 MESSAGE.BAK
7 for read ,write and execute
6 for read ,write
5 for read and execute
4 for read only
...
===================================================================================9. Move the MESSAGE.BAK file to the CALL directory. (5 points)
Ans:
The command used is. You are in /home/smith/PHONE/BOOK folder
=> mv MESSAGE.BAK /home/<username>/CALL
Ex: mv MESSAGE.BAK /home/smith/CALL (here smith is my user name)
===================================================================================10. Remove the PHONE directory and all of its contents. (5 points)
Ans:
Goto your current folder. /home/smith
And then call the rm -rf (rf stands for remove forcely all the files) command
=> rm -rf PHONE
===================================================================================11. Using nano or vim, create a text file containing the following text. Name the file MEMO.EXM (list all steps taken to create the file.) (5 points)
Ans:
Step1:
=>vim MEMO.EXM
(will open vim editor)
Step2:
Press i to add content.
Ex: You added Hello world to file
Once you finish adding content
Step3:
Press ESC then w the q
to save the content
===================================================================================12. Search your home directory and all subdirectories for any file that contains the word "exam", no matter what the case. (5 points)
Ans: The command is using grep.
=>grep -r "exam" /home
===================================================================================13. Find all files in your home directory that contains the string "MO" in the filename. (5 points)
Ans: Command using find.
=> find -name "*MO*"
===================================================================================14. Gzip the MEMO.EXM file. (5 points)
Ans:
Command is
=> gzip -c MEMO.EXM > MEMO.gz
===================================================================================15. Find the total disk usage of your home directory. (5 points)
Ans:
=> du -sh /home/<username>
==================================================================================
16. Create a new user named Test. (5 points)
Ans:
Command: useradd <username>
=>useradd Test
===================================================================================17. View the crontab entry for the new user Test. (5 points)
Ans:
crontab -l <username>
=> crontab -l Test
===================================================================================
18. View the current processes that are running on the system and pipe the results through less. (5 points)
Ans:
=>ps -A | less
===================================================================================
19. Change the owner of the MEMO.EXM.gz file to Test. (5 points)
Ans:
=>crown Test MEMO.EXM.gz
===================================================================================
20. Decompress the MEMO.EXM.gz file. (5 points)
Ans:
=> gunzip MEMO.EXM
===================================================================================
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.