Lab 2: Navigating the Linux File System Objective: In this lab, you will navigate the Linux file system. You will learn how to use the navigation tools provided by Linux to locate files and folders. This lab covers the following commands: mkdir touch cpl pwd Is my FIN Before you start the lab exercise, it is important to understand the Linux file system organization. Like the legacy operating system, the files on a Linux system are arranged in what is called a hierarchical directory structure. This means that they are organized in a tree-like pattern of directories (called folders in other systems), which may contain files and other directories. The first directory in the file system is called the root directory. The root directory contains files and subdirectories, which contain more files and subdirectories and so on and so on. Studentfeceservers / The bin folder contains commands that can be run by any user such as the cd command, Is, mkdir etc The boot folder contains everything required by the boot process. The dev folder contains details about all the devices on the system. The etc folder is generally, where all the system configuration files are stored. The home folder is generally where all the user folders are stored and for the average user is the The lib and lib64 folders contain all the kernel and shared libraries. The media folder is where mounted media such as USB drives are located The opt folder is used by some software packages as a place to store the binaries. The proc folder is a system folder used by the kernel. The sys folder contains a folder structure to provide system information The tmp folder is a temporary folder Note: The chmod and chown commands are used to manipulating permissions. chmod is used to manipulate permissions. Permissions can be specified using either "long" format or a numeric mode (all permission bits together are called the file's mode). The long format takes a string of permission values (.worx) together with a plus or minus sign. For example, to prevent any user from changing the file foobar we would do as follows to disable write permission, then verify that the change has taken place: Schmod -w foobar Sis -1 foobar ---xr-xr-x I john users 81 May 26 10:43 foobar To enable write access again, replace the minus sign with a plus sign (chmod +w foobar) Steps 1. Make a directory called labo2 in the student directory you just entered 2. Copy the file/etc/hosts to the labo2 directory you just created 3. Change the current directory to lab02. 4. Change the name of the file hosts to oldhosts 5. Create an empty file with name filel using the command fouch. Write down the file size and created date and time below using is command. S touch file1 6. Write contents to the empty file you created earlier with the following command $ echo "Welcome to Operating System ECCE4254 - Lab2"> filel 7. Write down the commands to display the contents of the filel. 8. Copy the contents of a filel to file2 9. Rename a file as file 3. 10. What difference you note in the above cp and my command? 11. List the content of the directory lab02. 12. Remove all files in directory labo2. 13. Remove the directory labo2. Create a file with name foobar in your student directory and add the contents using following commands. Stouch foobar S echo "file permission practice exercise"> foobar 14. How can you set the permission string to user read/write, group read, others read using chmod in long format of file foobar? 15. How can you revoke group write permissions on a file foobar without changing any other permissions 16. (c) How can you grant user and group execute permissions without changing any other permissions of file foobar? 17. What do the following numeric file modes represent: () 666 () 770 key) 640 (d) 444 18. What command-line argument to chmod allows you to alter the permissions of an entire directory tree? 19. What does execute (x) permission mean on directories? 20. A user wants to set the permissions of a directory tree rooted in home so that the user and group can list, read and write (but not execute) files, but nobody else has any access. Which of the following commands is most appropriate? Why? (a) chmod R 660 home (b) chmod R 770 home (c) chmod Ru+rw.g+rw.o-rwx home