![]() ![]() The first three characters are for the user, the next three are for the group, and the last three are for others. The next nine characters are showing the file permissions. Values for other file types are as follows: In this example, the first character is -, which indicates a regular file. Let’s explain the most important columns of the output. Here is an example: ls -l /etc/hosts -rw-r-r- 1 root root 337 Oct 4 11:31 /etc/hosts When the long listing format is used, you can see the following file information: The -l ( lowercase L) option tells ls to print files in a long listing format. ![]() The default output of the ls command shows only the names of the files and directories, which is not very informative. In the sections below, we will explore the most commonly used options. If the user you are logged in with doesn’t have read permissions to the directory, you will get a message saying that ls can’t open the directory: ls /root ls: cannot open directory '/root': Permission denied ![]() You can also pass multiple directories and files separated by space: ls /etc /var /etc/passwd For example, to list the contents of the /etc directory, you would type: ls /etc To list files in a specific directory, pass the directory path as an argument to the ls command. The files are listed in alphabetical order in as many columns as can fit across your terminal: cache db empty games lib local lock log mail opt run spool tmp When used with no options and arguments, ls displays a list of the names of all files in the current working directory ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |