- Table of Contents
-
- 01-Fundamentals Command Reference
- 00-Preface
- 01-CLI commands
- 02-RBAC commands
- 03-Login management commands
- 04-FTP and TFTP commands
- 05-File system management commands
- 06-Configuration file management commands
- 07-Software upgrade commands
- 08-GIR commands
- 09-Preprovisioning commands
- 10-Emergency shell commands
- Related Documents
-
Title | Size | Download |
---|---|---|
10-Emergency shell commands | 93.76 KB |
Contents
Emergency shell commands
File system names, directory names, or file names must be compliant with the naming conventions. For more information about the naming conventions and the methods for specifying the names, see Fundamentals Configuration Guide.
Unless otherwise stated, a file or directory name argument in this document must contain the file system name and cannot contain file system location information. The path information can contain multiple levels of directories, each of which can have 1 to 255 characters. The file name alone (without the path information) can have 1 to 255 characters. The entire argument can have 1 to 511 characters.
If the device has a flash memory and a CF card, you can access the flash memory and the CF card in emergency shell mode. Examples in this chapter use the flash memory. A different storage medium might be used on your device.
copy
Use copy to copy a file.
Syntax
copy source-file { dest-file | dest-directory }
Views
User view
Parameters
source-file: Specifies the file to be copied.
dest-file: Specifies the destination file.
dest-directory: Specifies the destination directory. The system uses the name of the source file as the name for the destination file.
Usage guidelines
If the destination file already exists, the system prompts whether or not to overwrite it. If you enter Y, the existing file is overwritten. If you enter N, the command is not executed.
Examples
# Copy the test.cfg file. Save the copy to testbackup.cfg.
<boot> copy flash:/test.cfg flash:/testbackup.cfg
Copy flash:/test.cfg to flash:/testbackup.cfg?[Y/N]:y
Start to copy flash:/test.cfg to flash:/testbackup.cfg...Done.
# Copy the test.cfg file and save the copy to testbackup.cfg. Overwrite the existing file that has the same name as the destination file.
<boot> copy flash:/test.cfg flash:/testbackup.cfg
Copy flash:/test.cfg to flash:/testbackup.cfg?[Y/N]:y
flash:/testbackup.cfg already exists. Overwrite it?[Y/N]:y
Start to copy flash:/test.cfg to flash:/testbackup.cfg...Done.
delete
Use delete to permanently delete a file.
Syntax
delete file
Views
User view
Parameters
file: Specifies the file to be deleted.
Examples
# Delete the tt.cfg file.
<boot> delete flash:/tt.cfg
Delete flash:/tt.cfg? [Y/N]:y
Deleting the file permanently will take a long time. Please wait...
Start to delete flash:/tt.cfg...Done.
dir
Use dir to display files or directories.
Syntax
dir [ /all ] [ file | directory ]
Views
User view
/all: Displays both hidden and non-hidden files and subdirectories.
file: Specifies a file or directory.
directory: Specifies a directory.
Usage guidelines
Task |
Command |
Remarks |
Display all non-hidden files and subdirectories in the current directory. |
dir |
N/A |
Display all files and subdirectories in the current directory. |
dir /all |
N/A |
Display all non-hidden files and subdirectories in a directory. |
dir directory |
Specify a directory for the directory argument. |
Display all files and subdirectories in a directory. |
dir /all directory |
Specify a directory for the directory argument. |
Display a file. |
dir file |
Specify a file for the file argument. |
Examples
# Display information about all files and directories in the system.
<boot> dir /all
Directory of flash:
0 drw- - Jan 01 2020 00:06:09 01
1 drw- - Jan 15 2020 04:03:14 pki
2 drw- - Jan 01 2020 00:04:07 test
4 drw- - Jan 05 2020 06:45:07 logfile
5 -rwh 20 Jan 20 2020 09:09:52 .snmpboots
6 drw- - Jan 05 2020 05:56:22 diagfile
7 drwh - Jan 20 2020 09:23:48 .trash
8 -rw- 816 Jan 20 2020 06:15:00 ifindex.dat
9 -rw- 3231 Jan 31 2020 09:01:41 startup.cfg
10 -rw- 60620 Jan 31 2020 09:01:43 startup.mdb
11 drw- - Jan 30 2020 04:43:24 versionInfo
12 drw- - Jan 05 2020 05:56:22 seclog
13 -rwh 18 Jan 20 2020 09:09:34 .pathfile
14 -rw- 11238400 Jan 30 2020 11:06:53 boot-t2301001.bin
15 -rw- 0 Jan 31 2020 05:04:40 lauth.dat
16 -rw- 4383 Jan 20 2020 06:15:00 test.cfg
61440 KB total (11108 KB free)
# Display all unhidden files and directories in the system.
<boot> dir
Directory of flash:
0 drw- - Jan 01 2020 00:06:09 01
1 drw- - Jan 15 2020 04:03:14 pki
2 drw- - Jan 01 2020 00:04:07 test
4 drw- - Jan 05 2020 06:45:07 logfile
5 drw- - Jan 05 2020 05:56:22 diagfile
6 -rw- 816 Jan 20 2020 06:15:00 ifindex.dat
7 -rw- 3231 Jan 31 2020 09:01:41 startup.cfg
8 -rw- 60620 Jan 31 2020 09:01:43 startup.mdb
9 drw- - Jan 30 2020 04:43:24 versionInfo
10 drw- - Jan 05 2020 05:56:22 seclog
11 -rw- 11238400 Jan 30 2020 11:06:53 boot-t2301001.bin
12 -rw- 0 Jan 31 2020 05:04:40 lauth.dat
13 -rw- 4383 Jan 20 2020 06:15:00 test.cfg
61440 KB total (11108 KB free)
# Display information about the config.cfg file.
<boot> dir flash:/config.cfg
Directory of flash:
0 -rw- 3231 Jan 31 2020 09:01:41 startup.cfg
61440 KB total (11108 KB free)
Table 1 Command output
Field |
Description |
Directory of |
Current directory. |
7 -rw- 3231 Jan 31 2020 09:01:41 startup.cfg |
Information about a file or directory: · 7—Index number, automatically assigned by the system. · -rw-—Attributes of the file or directory. The first character is the directory indicator (d for directory and - for file). The second character indicates whether the file or directory is readable (r for readable). The third character indicates whether the file or directory is writable (w for writable). The last character indicates whether the file or directory is hidden (h for hidden and - for visible). · 3231—Size of the file, in bytes. For a directory, the value of this field is a hyphen (-). · Jan 31 2020 09:01:41—Time when the file was most recently modified. · startup.cfg—Name of the file or directory. |
61440 KB total (11108 KB free) |
Total size of the storage medium and size of the free space, in kilobytes. |
display copyright
Use display copyright to display copyright information.
Syntax
display copyright
Views
Any view
Examples
# Display copyright information.
<boot> display copyright
...
display install package
Use display install package to display information about a software package.
Syntax
display install package package
Views
Any view
Parameters
package: Specifies a .bin system image file in the filesystemname/filename.bin format, for example, flash:/startup-system.bin. The file must be saved in the root directory of a file system on the device. The value string can have a maximum of 63 characters.
Examples
# Display information about the system.bin software package.
<boot> display install package flash:/system-t6101010.bin
Verifying the file flash:/system-t6101010.bin ..................Done.
flash:/system-t6101010.bin
[Package]
Vendor: H3C
Product: xxxx
Service name: system
Platform version: 7.1.070
Product version: Test 0001010
Supported board: mpu
[Component]
Component: system
Description: system package
Table 2 Command output
Field |
Description |
Product |
Product name. |
Service name |
Type of the service package: · boot—Boot image. · system—System image. · patch—Patch package. If the value of this field is not boot, system, or patch, the service packet is a feature package. |
Platform version |
Platform version number. |
Product version |
Product version number. You determine whether the version of a system image matches that of a boot image by checking the value of this field. |
[Component] |
Information about the components of the software package. |
display version
Use display version to display boot image version information.
Syntax
display version
Views
Any view
Examples
# Display boot image version information.
<boot> display version
…
format
Use format to format a file system.
Syntax
format filesystem
Views
User view
Parameters
filesystem: Specifies a file system.
Usage guidelines
Use this command with caution. This command permanently deletes all files and directories from the file system, including the startup image files and startup configuration files. The deleted files and directories cannot be restored. Without startup images, the device cannot reboot.
Examples
# Format the flash: file system.
<boot> format flash:
All data on flash: will be lost, continue?[Y/N]:y
Formatting flash:… Done.
mkdir
Use mkdir to create a directory.
Syntax
mkdir directory
Views
User view
Parameters
directory: Specifies a directory.
Usage guidelines
You can create a directory only in an existing directory. For example, to create the flash:/test/mytest directory, the directory test must already exist.
The name of the directory to be created must be unique in the parent directory.
Examples
# Create a directory named test.
<boot> mkdir flash:/test
Directory flash:/test created.
# Create a directory named subtest in the flash:/test directory.
<boot> mkdir flash:/test/subtest
Directory flash:/test/subtest created.
Related commands
dir
rmdir
more
Use more to display the contents of a text file.
Syntax
more file
Views
User view
Parameters
file: Specifies a text file.
Examples
# Display the contents of the test.txt file.
<boot> more flash:/test.txt
Have a nice day.
move
Use move to move a file.
Syntax
move source-file { dest-file | dest-directory }
Views
User view
Parameters
source-file: Specifies the name of the file to be moved, a case-insensitive string of 1 to 63 characters.
dest-file: Specifies the name for the destination file, a case-insensitive string of 1 to 63 characters.
dest-directory: Specifies the name of the directory, a case-insensitive string of 1 to 63 characters. The system moves the file without changing the file name.
Usage guidelines
If a file in the destination directory is using the destination file name, the system prompts whether or not to overwrite the existing file. If you enter Y, the existing file is overwritten. If you enter N, the command is not executed.
Examples
# Move the config.cfg file to the flash:/test directory.
<boot>move flash:/config.cfg flash:/test/
Move flash:/config.cfg to flash:/test/config.cfg?[Y/N]:y
<boot> dir flash:/test
Directory of flash:/test
0 -rw- 77065 Jan 20 1939 06:15:02 config.cfg
61440 KB total (11108 KB free)
pwd
Use pwd to display the working directory.
Syntax
pwd
Views
User view
Examples
# Display the working directory.
<boot> pwd
flash:
quit
Use quit to return to the upper-level view.
Syntax
quit
Views
System view
Management Ethernet interface view
Examples
# Return from management Ethernet interface view to user view.
[boot] quit
<boot>
reboot
Use reboot to reboot the device.
Syntax
reboot
Views
User view
Examples
# Reboot the device.
<boot> reboot
rmdir
Use rmdir to delete an existing directory.
Syntax
rmdir directory
Views
User view
Parameters
directory: Specifies the directory to be deleted.
Usage guidelines
To delete a directory, first delete the files and subdirectories in the directory. To delete files, use the delete command.
Examples
# Delete the mydir directory.
<boot> rmdir flash:/mydir
Remove directory flash:/mydir?[Y/N]:y
Directory flash:/1 removed.
Related commands
delete
dir
mkdir