Question: Operating Systems - Linux Commands Command(s) used 1. With what command can you find out what your current working directory is (i.e., which directory you
Operating Systems - Linux Commands
| Command(s) used | |
| 1. With what command can you find out what your current working directory is (i.e., which directory you are in right now? On the right, indicate the command, and its output. | |
| 2. Note that you should be in your home directory which is not /home, but /home/xyz, with your name instead of xyz. If you are not in your home directory, change into it now. Otherwise, nothing to do in this step. | |
| 3. We will begin with four ways of creating files. Make sure to understand the purpose of each of them, and when they would be used in practice. Firstly, put the content of the manual page of the command cp into a file with the name file1.txt | |
| 4. Redirect the output of the command cat to write the following content into a new file with the name file2.txt: Triple chocolate brownie New York cheesecake Oat fudge bar Nanaimo bar Chocolate chip cookie | |
| 5. NEW use the command on the right to create a new, empty file with the name file3.txt | touch file.txt |
| 6. NEW use the editor nano to create a new file. Use the command on the right to start nano. Type whatever text you like, then press Ctrl-X to leave the editor. When prompted, press Y to save the file, type file4.txt, and press enter to save the file. | nano |
| 7. Create a directory desserts in the current directory. | |
| 8. Go into the directory desserts. | |
| 9. Create a (sub)directory cakes. | |
| 10. Create another subdirectory (of desserts) named pies. | |
| 11. Note that you should still be in the directory desserts. Go up one level in the directory hierarchy (i.e., to your home directory). | |
| 12. Copy file1.txt into a new file file10.txt in the current directory. | |
| 13. Copy file2.txt into the directory desserts. | |
| 14. Move file3.txt into the directory cakes. Hint: command is on the right. | mv file3.txt desserts/cakes/ |
| 15. Move file4.txt into the directory pies. | |
| 16. Go into the directory desserts. | |
| 17. While you are still in the directory desserts, list the content of the directory cakes. Show the command and its output on the right. | |
| 18. Go into the directory pies. | |
| 19. List the content of the directory pies. Show the command and its output on the right. | |
| 20. Go back to the directory desserts. Note: Your command should not contain the word desserts. | |
| 21. List the content of the directory desserts. Show the command and its output on the right. | |
| 22. Go back to your home directory. On the right, write down three different commands to do this. | |
| 23. Delete the directory desserts and all the files and directories it contains. This can be done with a single command, or with a number of commands. Whichever you chose, write it/them down on the right. | |
| 24. In you home directory (where you should still be), list all the files with a name that begins with file. Write down the command and its output on the right. | |
| 25. List all the files with a name that contains the number 2 in the file name. Write down the command and its output on the right. | |
| 26. On the right, write down the output of the command ls file?.txt | |
| 27. What are the current permissions for user, group and other for file1.txt? Write down the command to find out and the result on the right. | |
| 28. Change the permissions of file1.txt so that only the owner can read and write the file, and everybody else (i.e. group and other) can only read the file. | |
| 29. Using pipes, count how many files in your home directory begin with file. Write down the command to find out and the result on the right. | |
| 30. Using pipes, output all the lines in file2.txt that have the word bar in them, sorted alphabetically. Write down the command to find out and the result on the right. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
