1e41f4b71Sopenharmony_ci# ls 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## Command Function 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ciThis command is used to display the content of a directory. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## Syntax 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_cils [_-ACHLSZacdfhiklmnopqrstux1_] [_--color_[_=auto_]] [_directory..._] 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci> **NOTE**<br> 14e41f4b71Sopenharmony_ci> During the system boot process, **ls=toybox ls --color=auto**, **ll = ls -alF**, **la=ls -A**, and **l=ls -CF** commands have been enabled using **alias** so that the initial actions of these commands are the same as those on Linux. For details, see **Output**. To view help information, run **toybox ls --help**. 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci## Parameters 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci**Table 1** Command parameter description 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci| Parameter | Description | Value Range | 22e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ----------------------------- | 23e41f4b71Sopenharmony_ci| --help | Displays parameters supported by the **ls** command and their usage. | N/A | 24e41f4b71Sopenharmony_ci| -a | Displays all files, including hidden files. | N/A | 25e41f4b71Sopenharmony_ci| -b | Escapes non-graphical characters. | N/A | 26e41f4b71Sopenharmony_ci| -c | Uses **ctime** as the file timestamp. This parameter must be used together with **-l**. | N/A | 27e41f4b71Sopenharmony_ci| -d | Displays only the directory, rather than listing the content of the directory. | N/A | 28e41f4b71Sopenharmony_ci| -i | Displays the node ID of a file. | N/A | 29e41f4b71Sopenharmony_ci| -p | Adds a slash (/) after the directory. | N/A | 30e41f4b71Sopenharmony_ci| -q | Displays non-printable characters, such as "?". | N/A | 31e41f4b71Sopenharmony_ci| -s | Provides information about the memory occupied by the directory and its members, in 1024 bytes. | N/A | 32e41f4b71Sopenharmony_ci| -u | Uses the last access time of the file as the timestamp. This option is used together with **-l**. | N/A | 33e41f4b71Sopenharmony_ci| -A | Lists all files except implied . and .. | N/A | 34e41f4b71Sopenharmony_ci| -H | Follows symbolic links listed in the command line. | N/A | 35e41f4b71Sopenharmony_ci| -L | Follows symbolic links. | N/A | 36e41f4b71Sopenharmony_ci| -Z | Displays security context. | N/A | 37e41f4b71Sopenharmony_ci| path | Specifies the path of the target directory.<br/>If **path** is left blank, the content of the current directory is displayed.<br>If **path** is an invalid directory, "ls error: No such directory." is displayed.<br><br>If **path** is a valid directory, the content of the specified directory is displayed. | Left blank<br>A valid directory| 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci**Table 2** Output format parameters 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci| Parameter | Description | 42e41f4b71Sopenharmony_ci| ------- | --------------------------------------- | 43e41f4b71Sopenharmony_ci| -1 | Lists one file per line. | 44e41f4b71Sopenharmony_ci| -c | Lists entries by column. | 45e41f4b71Sopenharmony_ci| -g | Like **-l**, but do not list the owner. | 46e41f4b71Sopenharmony_ci| -h | Displays the total size of files in the directory, in KiB.| 47e41f4b71Sopenharmony_ci| -l | Displays detailed information about files in the directory. | 48e41f4b71Sopenharmony_ci| -m | Fills width with a list of entries separated by a comma. | 49e41f4b71Sopenharmony_ci| -n | Like **-l**, but lists numeric user and group IDs.| 50e41f4b71Sopenharmony_ci| -o | Like **-l**, but do not list group information. | 51e41f4b71Sopenharmony_ci| -x | Lists entries by line, instead of by column. | 52e41f4b71Sopenharmony_ci| -ll | Lists the file time attribute as ns. | 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci**Table 3** Parameters for sorting (by the initial letter by default) 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci| Parameter| Description | 57e41f4b71Sopenharmony_ci| ---- | ------------------------------------------ | 58e41f4b71Sopenharmony_ci| -f | Do not sort. | 59e41f4b71Sopenharmony_ci| -r | Sorts in reverse order. | 60e41f4b71Sopenharmony_ci| -t | Sorts by time, newest first.| 61e41f4b71Sopenharmony_ci| -S | Sorts by file size, largest first. | 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci**Table 4** Color printing 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci| Parameter| Default Configuration | 66e41f4b71Sopenharmony_ci| ---- | ------------------------------------------ | 67e41f4b71Sopenharmony_ci| --color | device=yellow symlink=turquoise/red dir=blue socket=purple files: exe=green suid=red suidfile=redback stickydir=greenback=auto means detect if output is a tty. | 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ci## Usage Guidelines 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ciThe file node information of the FAT file system inherits from its parent node. The parent node ID is **0**. Therefore, if you run the **ls -i** command on the Hi3516D V300 development board, the file node IDs displayed are all **0**. 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ci## Note 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ciThe shell does not support **ls** parameters. mksh supports them. To switch to mksh, run **cd bin** and **./mksh**. 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci## Example 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ciRun the following commands: 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ci- ls 83e41f4b71Sopenharmony_ci 84e41f4b71Sopenharmony_ci- ll 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ci 87e41f4b71Sopenharmony_ci## Output 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ciExample 1: **ls** command output 90e41f4b71Sopenharmony_ci 91e41f4b71Sopenharmony_ci``` 92e41f4b71Sopenharmony_ciOHOS:/$ ls 93e41f4b71Sopenharmony_cibin etc nfs sdcard system usr 94e41f4b71Sopenharmony_cidev lib proc storage userdata vendor 95e41f4b71Sopenharmony_ci``` 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ciExample 2: **ll** command output 98e41f4b71Sopenharmony_ci 99e41f4b71Sopenharmony_ci``` 100e41f4b71Sopenharmony_ciOHOS:/$ ll 101e41f4b71Sopenharmony_citotal 20 102e41f4b71Sopenharmony_cidrwxrwxrwx 1 0 0 2048 2021-11-21 17:52 bin/ 103e41f4b71Sopenharmony_cidrwxr-xr-x 0 0 0 0 1970-01-01 00:00 dev/ 104e41f4b71Sopenharmony_cidrwxrwxrwx 1 0 0 2048 2021-11-21 17:52 etc/ 105e41f4b71Sopenharmony_cidrwxrwxrwx 1 0 0 2048 2021-11-21 17:52 lib/ 106e41f4b71Sopenharmony_cidrwxrwxrwx 0 0 0 4096 2021-10-25 02:17 nfs/ 107e41f4b71Sopenharmony_cidr-xr-xr-x 0 0 0 0 1970-01-01 00:00 proc/ 108e41f4b71Sopenharmony_cidrwxrwxrwx 1 0 0 4096 1979-12-31 00:00 sdcard/ 109e41f4b71Sopenharmony_cidrwxrwxrwx 1 0 0 2048 2021-11-21 17:52 storage/ 110e41f4b71Sopenharmony_cidrwxrwxrwx 1 0 0 2048 2021-11-21 17:52 system/ 111e41f4b71Sopenharmony_cidrwxrwxrwx 1 0 0 2048 2021-11-21 17:52 userdata/ 112e41f4b71Sopenharmony_cidrwxrwxrwx 1 0 0 2048 2021-11-21 17:52 usr/ 113e41f4b71Sopenharmony_cidrwxrwxrwx 1 0 0 2048 2021-11-21 17:52 vendor/ 114e41f4b71Sopenharmony_ci``` 115