A dash (-) indicates that the file is a regular file.In the preceding examples, the first character in each list was either a dash (-) or the letter d. This section explains the series of letters and dashes that define the file permissions. The rest of this article explains how to interpret and use these details. The necessary details to check file permissions are (1) the series of letters and dashes on the far left of each line, and (2) the two columns that have root in them (in the preceding example). The file names are on the far right side of each line, and the file details precede the names. rw-r-r- 1 root root 10 Jun 30 03:29 adjtimeĭrwxr-xr-x 4 root root 4096 Jun 30 03:44 apache2ĭrwxr-xr-x 3 root root 4096 ca-certificates To get more information about the files in a directory, use the -l option with ls, as shown in the following example. would take you to /, the very top of the hierarchy. For example, if your current directory is /root, typing cd. the directory changes to the one above the one you’re in, in the file system hierarchy. The double period (.) refers to the parent directory.This is convenient if you want it to run a command and reference your current directory (for example, when you want to copy a file there). The single period (.) refers to the directory itself.viminfoĬonsider the single period and double period in both directory lists: If you combine the -a option with the -l option (see the next section) into -la, you get all the details of the hidden files: $ ls -la /root bashrc file is especially useful to know about because it contains user environment settings that you can change. But it’s important to know that they’re there and how to see them. viminfoįiles that start with a period are often system files and application settings files, and you usually don’t want them included in directory lists. However, if you add the -a option, the ls command returns a list of files: $ ls -a /root For example, if you use only ls to look at the root home directory on a clean Linux installation, no files are returned: $ ls /root To display hidden files (files with names that start with a period), use the -a option. The command df -h shows current disk usage in a easier to read format. Other linux tools such as df also support this flag. When you use the -h option, files sizes are displayed in the human-readable format of kilobytes, megabytes, and so on, rather than in raw bytes. The -h option changes the way file sizes are displayed. $ ls /etcĭIR_COLORS gentoo-release man.conf runlevelsĬa-certificates nf securettyĬnf hosts modprobe.d scsi_id.config The following example shows a list of the first few files in the /etc directory on a Gentoo system. You can also specify a directory to list. When run by itself, ls returns a list of the current working directory. Use the ls command (the first letter is a lowercase L) to see what files are in a directory. You can ensure that a user can read a particular file, for example, or examine a directory structure to ensure that users can follow the hierarchy to the files that they need. Being able to check the permissions on a file is useful, especially for troubleshooting. This article explains how to use the ls command to check Linux file permissions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |