< Home

dir/ls (SFTP client view)

Function

The dir and ls commands display a list of specified files that are stored on the SFTP server.

Format

dir [ -l | -a ] [ remote-directory ]

ls [ -l | -a ] [ remote-directory ]

Parameters

Parameter Description Value
-l Displays detailed information about all files and directories in a specified directory. -
-a Displays names of all files and directories in a specified directory. -
remote-directory Specifies the name of a directory on the SFTP server. The value is a string of 1 to 64 case-insensitive characters without spaces.

Views

SFTP client view

Default Level

3: Management level

Usage Guidelines

The dir and ls commands are equivalent.
  • If -l and -a parameters are not specified, detailed information about all files and directories in a specified directory is displayed when you run the dir or ls command. The effect is the same as the dir -l command output.
  • By default, if the remote-directory parameter is not specified, the list of current directory files is displayed when you run the dir or ls command.

Example

# Display a list of files in the test directory of the SFTP server.

<HUAWEI> system-view
[HUAWEI] sftp 10.137.217.201
Please input the username:admin
Trying 10.137.217.201 ...
Press CTRL+K to abort
Connected to 10.137.217.201 ...
Enter password:
sftp-client> dir test
drwxrwxrwx   1 noone    nogroup         0 Mar 24 2012 .
drwxrwxrwx   1 noone    nogroup         0 Mar 29 2012 ..
-rwxrwxrwx   1 noone    nogroup         0 Mar 24 2012 yourtest
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 2012 backup.txt
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 2012 backup1.txt
sftp-client> dir -a test
.
..
yourtest
backup.txt
backup1.txt
sftp-client> ls test
drwxrwxrwx   1 noone    nogroup         0 Mar 24 2012 .
drwxrwxrwx   1 noone    nogroup         0 Mar 29 2012 ..
-rwxrwxrwx   1 noone    nogroup         0 Mar 24 2012 yourtest
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 2012 backup.txt
-rwxrwxrwx   1 noone    nogroup      5736 Mar 24 2012 backup1.txt
sftp-client> ls -a test
.
..
yourtest
backup.txt
backup1.txt
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >