ls

Command Function

This command is used to display the content of a specified directory.

Syntax

ls [path]

Parameter Description

Table 1 Parameters

Parameter

Description

Value Range

path

If path is left blank, the content of the current directory is displayed.

If the path value is an invalid file name, the following failure message is displayed:

ls error: No such directory

If the path value is a valid directory, the content of this directory is displayed.

  • Left blank
  • A valid directory

Usage

  • This command can be used to display the content of the current directory.
  • This command can also display the size of a file.
  • The ls command with the proc directory passed cannot calculate the file size and 0 is displayed in the command output.

Example

Enter ls.

Output

Figure 1 Viewing content of the current directory