You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.3 KiB
66 lines
1.3 KiB
4 years ago
|
The syntax for the ls command is as follows:
|
||
|
|
||
|
[source,bash]
|
||
|
----
|
||
|
ls [OPTIONS] [FILES]
|
||
|
----
|
||
|
|
||
|
When used with no options and arguments, *ls* displays a list of the names of all files in the
|
||
|
|
||
|
[source,bash]
|
||
|
----
|
||
|
bin cdrom dev home lib64 media opt root sbin srv tmp var
|
||
|
boot etc initrd.img lib mnt proc run snap sys usr
|
||
|
----
|
||
|
|
||
|
Long Listing Format
|
||
|
|
||
|
The -l option causes ls to print files in a long listing format.
|
||
|
|
||
|
When the long listing format is used, the ls command will display the following file information:
|
||
|
|
||
|
|
||
|
[source,bash]
|
||
|
----
|
||
|
drwxr-xr-x 1 root root 4096 Jul 24 14:45 home
|
||
|
-rwxr-xr-- 1 root root 4096 Jul 24 14:45 home/text
|
||
|
----
|
||
|
|
||
|
- The file type
|
||
|
-- – file
|
||
|
-- d directory
|
||
|
-- l symbolic link
|
||
|
|
||
|
- The file permissions
|
||
|
|
||
|
-- The characters are pretty easy to remember.
|
||
|
--- r = read permission
|
||
|
--- w = write permission
|
||
|
--- x = execute permission
|
||
|
--- - = no permission
|
||
|
|
||
|
*file permissions in a three-digit octal number*
|
||
|
|
||
|
[source,bash]
|
||
|
----
|
||
|
Number Permission Type Symbol
|
||
|
0 No Permission ---
|
||
|
1 Execute --x
|
||
|
2 Write -w-
|
||
|
3 Execute + Write -wx
|
||
|
4 Read r--
|
||
|
5 Read + Execute r-x
|
||
|
6 Read +Write rw-
|
||
|
7 Read + Write +Execute rwx
|
||
|
----
|
||
|
|
||
|
- File owner
|
||
|
- File group
|
||
|
- File size
|
||
|
- Date and Time
|
||
|
- File name
|
||
|
|
||
|
|
||
|
|
||
|
|