Check the information of files and directories in the current directory with Linux commands.
$ls -l
#=>
-rw-r--r--1 user group 9 January 1 00:00 hoge.html.erb
drwxr-xr-x 6 user group 20480 January 1 00:00 download
The first character indicates the file type. The 2nd to 4th characters indicate the authority to the owner of the file. The 5th to 7th characters indicate the authority to the owning group of the file. The 8th to 10th characters indicate the authority for others.
Type | meaning |
---|---|
- | File |
d | directory |
l | Symbolic link |
Read permission | Write permission | Execution authority |
---|---|---|
r | w | x |
Numerical value | Authority | Contents |
---|---|---|
0 | --- | No authority |
1 | --x | Executable |
2 | -w- | Writable |
3 | -wx | Can be written and executed |
4 | r-- | Readable |
5 | r-w | Can be read and executed |
6 | rw- | Readable and writable |
7 | rwx | Can be read, written, and executed |
-Example- -rw-r--r-- ↓ File type = file Owner = with read and write permissions Owned group = with read permission Other = with read permission
$chmod mode Target file name
$ chmod 764 hoge.html.erb
argument | Contents |
---|---|
-v | Display command execution result |
-c | Display execution result only when there is a change |
-R | Change recursively |
Recommended Posts