Using ls -l

In this book, we have already spent a large amount of time using the ls command so our coverage here will be at a minimum. In this example, we will use the –l option. If you run ls -l to list your directories, you can see the owner, group, and associated permissions for any file. Some versions of ls won't show you the owner and group simultaneously with this command. Usually, they list group and owner if you add the -g option, as in ls -lg.

For an example of using ls –l, type the following:

					>ls -l
					-rw-r--r-- 1 rob  rob     2024 Dec 25 20:00 atest.tar
					drwxrwxr-x 5 rob  rob     1024 Dec 25 20:22 test
					...
				

The information that we are most concerned with dissecting is the first, third, and fourth columns. The first column identifies the owner, group, and other permissions that are active for a file or directory. The first character is a d if the file type is a directory. In this example, I have a test directory I created with the mkdir command. Normally this is a - for a normal file, which you can see for my atest.tar file. The remainder of the characters, as you might guess, stand for read (r), write (w), and execute (x). The first three characters (following the initial - or d character) are the active owner permissions, the second three characters are the group permissions, and the last three are other permissions. It is important to memorize these settings, because this is how you know how secure your file or directory is. This tells you what the world can do to your files, such as change or delete them if the permissions are too generous. Moving on, we see the third column is the file owner, me. The fourth column is the group owner, which is again me. The rest of the information is simply the size of the file, the date of creation, the time, and the name of the file or directory.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.195.101