228 CHAPTER 14 UNDERSTANDING LINUX FILES AND (Web site optimization)
228 CHAPTER 14 UNDERSTANDING LINUX FILES AND USERS Because nothing is specified before the +x, the shell assumes that the changes to be applied to the file are for the current user only. To change the owner of a file, use the chown command. For security reasons this must be prefaced with the sudo command, which is to say that chown (and chgrp, to change the group), require superuser powers. For example, to set the owner of myfile as frank, type this command: sudo chown frank myfile You can also change the owner and the group of a file using chown. Simply type each separated by a period: sudo chown frank.mygroup myfile This will change myfile so that its owner is frank and its group is mygroup. To change the group of a file, you can use the chgrp command in exactly the same way as chown: sudo chgrp mygroup myfile The File System Explained Now that you understand the principles of files and users, we can take a bird s-eye view of the Linux file system and start to make sense of it. You might already have ventured beyond the /homedirectory and wandered through the file system. You no doubt found it thoroughly confusing, largely because it s not like anything you re used to. The good news is that it s not actually very hard to understand. If nothing else, you should be aware that nearly everything can be ignored during everyday use. Note The Ubuntu file system is referred to as a hierarchical file system. This means that it consists of a lot of directories that contain files. Windows also uses a hierarchical file system. Ubuntu refers to the very bottom level of the file system as the root. This has no connection with the root user. You can switch to the root of the file system by typing the following shell command: cd / When used on its own, the forward slash is interpreted as a shortcut for root. If I do this on my PC, and then ask for a long file listing (ls -l), I see the following: