< Home

cd (user view)

Function

The cd command changes the current working directory of a user.

By default, the current working directory is flash:.

Format

cd directory

Parameters

Parameter Description Value

directory

Specifies the current working directory of a user.

The value is a string of 1 to 64 case-insensitive characters without spaces in the [ drive ] path format.

In the preceding parameter, drive specifies the storage device name, and path specifies the directory and subdirectory.

You are advised to add : and / between the storage device name and directory. The directory name cannot contain the following characters: ~ * / \ : ' "

For example, a directory name is flash:/selftest/test/.

Views

User view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

The following describes the drive name.
  • drive is the storage device and is named as flash:.

  • If devices are stacked, drive can be named as:

    • flash: root directory of the flash memory of the master switch in the stack.
    • chassis ID#flash: root directory of the flash memory on a device in the stack.

    For example, slot2#flash: indicates the flash memory in slot 2.

The path can be an absolute path or relative path. A relative path can be designated relative to either the root directory or the current working directory. A relative path beginning with a slash (/) is a path relative to the root directory.
  • flash:/my/test/ is an absolute path.

  • /selftest/ is a path relative to the root directory and indicates the selftest directory in the root directory.

  • selftest/ is a path relative to the current working directory and indicates the selftest directory in the current working directory.

For example, if you change the current working directory flash:/selftest/ to the logfile directory in flash, the absolute path is flash:/logfile/, and the relative path is /logfile/. The logfile directory is not logfile/ because it is not in the current working directory selftest.

Precautions

  • The directory specified in the cd command must exist; otherwise, the error messages will displayed:

    You can perform the following operations to rectify faults:
    1. Run the pwd command to view the current working directory.
    2. Run the dir command to view the current working directory and verify that the directory specified in the cd command exists.

Example

# Change the current working directory from flash:/temp to flash:.

<HUAWEI> pwd
flash:/temp
<HUAWEI> cd flash:
<HUAWEI> pwd
flash:

# Change the current working directory from flash: to flash:/t1/t2.

<HUAWEI> pwd
flash:
<HUAWEI> cd flash:/t1/t2
<HUAWEI> pwd
flash:/t1/t2

# Change the current working directory from flash:/selftest to flash:/logfile.

<HUAWEI> pwd
flash:/selftest
<HUAWEI> cd /logfile/
<HUAWEI> pwd
flash:/logfile

# Change the current working directory from flash:/selftest to flash:/selftest/test.

<HUAWEI> pwd
flash:/selftest
<HUAWEI> cd test/
<HUAWEI> pwd
flash:/selftest/test
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >