Chapter 1 File System Management Configuration Commands
1.1 File Attribute Configuration Commands
Syntax
boot attribute-switch
{ all | app | configuration | web }
View
User view
Parameter
all: Specifies
all the files, including app files, configuration files and Web files.
app: Specifies
app files.
configuration: Specifies configuration files.
web: Specifies
Web files.
Description
Use the boot attribute-switch
command to switch between the main and backup attribute for all the files or a
specified type of files. That is, change a file with the main attribute to one
with the backup attribute, or vice versa.
Example
# Switch the attributes of all the files.
<H3C> boot attribute-switch all
The boot, web and configuration
file's backup-attribute and main-attribute will exchange.
Are you sure? [Y/N] y
The boot, web and configuration
file's backup-attribute and main-attribute exchanged successfully on unit 1!
1.1.2 boot
boot-loader
Syntax
boot boot-loader
file-url
View
User view
Parameter
file-url:
Path or the name of the app file in the Flash memory, a string comprising 1 to
64 characters.
Description
Use the boot
boot-loader command to configure an app file of a device to be with the
main attribute. The app file specified by this command becomes the main startup
file when the device starts up next time.
Example
# Configure the file named boot.bin to be the
main startup file of the device.
<H3C> boot boot-loader boot.bin
The specified file will be booted
next time on unit 1!
1.1.3 boot boot-loader backup-attribute
Syntax
boot boot-loader
backup-attribute file-url
View
User view
Parameter
file-url:
Path or the name of the app file in the Flash memory, a string comprising 1 to
64 characters.
Description
Use the boot boot-loader backup-attribute
command to configure an app file of a device to be with the backup attribute.
The app file specified by this command becomes the backup startup file when the
device starts up next time. When the main startup file is unavailable, the
backup startup file is used to start the switch.
Example
# Configure the file named backup.bin to be
the backup startup file of the device.
<H3C> boot boot-loader backup-attribute
backup.bin
Set boot file backup-attribute
successfully on unit 1!
Syntax
boot web-package
webfile { backup | main }
View
User view
Parameter
webfile:
Name of a Web file, a string comprising 5 to 127 characters.
main: Specifies
the file to be with the main attribute.
backup: Specifies
the file to be with the backup attribute.
Description
Use the boot web-package command to
configure a Web file to be with the main or backup attribute.
Caution:
l
The configuration of the main or backup attribute
for a Web file takes effect immediately without restarting the device.
l
After you upgrade a Web file, you need to
specify the new Web file in the Boot menu after restarting the switch.
Otherwise, the Web server cannot function normally.
Example
# Configure the Web file named boot.web to
be with the main attribute.
<H3C> boot web-package boot.web
main
Syntax
display boot-loader
[ unit unit-id ]
View
Any view
Parameter
unit unit-id:
Specifies the unit ID of a switch, which must be 1.
Description
Use the display boot-loader
command to display the information about the app startup files of a specific device.
Displayed information includes the current app startup file name, and the main
and backup app startup files to be used when the switch starts up next time.
Example
# Display the information about the app
startup files.
<H3C> display boot-loader
Unit 1:
The current boot app is:
s3152p.bin
The main boot app is:
s3152p.bin
The backup boot app is:
s3152p.bin
1.1.6 startup
bootrom-access enable
Syntax
startup bootrom-access enable
undo startup bootrom-access enable
View
User view
Parameter
None
Description
Use the startup bootrom-access enable command
to specify a switch to prompt users to use customized password to enter the
BOOT menu.
Use the undo startup bootrom-access
enable command to disable the above function.
By default, users have to use customized
passwords to enter the BOOT menu.
You can use the display startup command
to view the execution results of these two commands.
Example
# Specify to prompt users to use customized
passwords to enter the BOOT menu.
<H3C> startup bootrom-access
enable
1.2 File System Configuration Commands
Note to limit the
lengths of device name, directory name, file path and file name within the
following ranges regulated for the switch.
l
A directory name should be no more than 91
characters.
l
A file name plus its local path name should be
no more than 127 characters.
l
A device name should be no more than 14
characters.
l
A file name plus its complete path name should
be no more than 142 characters.
Syntax
cd directory
View
User view
Parameter
directory:
Target directory.
Description
Use the cd command to enter a specified
directory on the Ethernet switch.
The default directory is the root directory
of Flash memory.
Example
# Enter the directory named test.
<H3C> cd test
<H3C> pwd
unit1>flash:/test
Syntax
copy fileurl-source
fileurl-dest
View
User view
Parameter
fileurl-source:
Path name or file name of the source file in the Flash memory.
fileurl-dest:
Path name or file name of the target file in the Flash memory.
Description
Use the copy command to copy a file.
If the fileurl-dest argument
identifies an existing file, the system prompts you for the confirmation to
overwrite the existing file.
Example
# Copy the file from flash:/config.cfg into
flash:/test/1.cfg.
<H3C> copy flash:/config.cfg
flash:/test/1.cfg
Copy unit1>flash:/config.cfg to
unit1>flash:/test/1.cfg?[Y/N]:y
...
%Copy file unit1>flash:/config.cfg
to unit1>flash:/test/1.cfg...Done.
Syntax
delete [ /unreserved
] file-url
delete { running-files
| standby-files } [ /unreserved ]
View
User view
Parameter
/unreserved: Specifies to delete a
file completely.
file-url:
Path name or file name of a file in the Flash memory. You can use the *
character in this argument as a wildcard. For example, the delete *.txt
command deletes all the files with txt as their extensions.
running-files: Specifies to delete all the files with the main attribute.
standby-files: Specifies to delete all the files with the backup attribute.
Description
Use the delete command to delete a
specified file from the Flash memory on a switch.
You can use the * character in the argument
as a wildcard.
If you execute the delete command
with the /unreserved keyword specified, the specified file is permanently
deleted. That is, the file cannot be restored.
You can delete files based on file
attribute. If you execute the delete running-files command, all the
files with the main attribute will be deleted. If you execute the delete
standby-files command, all the files with the backup attribute will be
deleted.
For a file that has both the main and
backup attributes, the delete running-files deletes its main attribute
only instead of deleting the file itself, and the delete standby-files command
deletes its backup attribute only instead of deleting the file itself.
Following are the notes concerning with the
deleted files:
l
The deleted files are moved to the recycle bin.
l
The dir command cannot display the information
about deleted files.
l
To display the information about deleted files, use
the dir /all command.
l
To restore a deleted file, use the undelete
command.
l
To restore the deleted files from the recycle
bin, use the undelete command; to delete the files permanently from the
recycle bin, use the reset recycle-bin command.
When you use the delete running-files or
delete standby-files command, you will be prompted to confirm whether to
delete all files with the main/backup attribute. If you choose yes, the corresponding
files are deleted. If you choose no, the system will further to prompt you to confirm
the following items orderly:
1)
Delete the image files with the main/backup attribute?
2)
Delete the configuration files with the
main/backup attribute?
3)
Delete the Web files with the main/backup attribute?
The corresponding messages are displayed as
follows:
Delete the running image file?
[Y/N]:n
Delete the running config file?
[Y/N]:n
Delete the running web file? [Y/N]:n
Delete the backup image file? [Y/N]:n
Delete the backup config file?
[Y/N]:n
Delete the backup web file? [Y/N]:n
The corresponding files will be deleted
after you choose yes.
Caution:
For deleted files
whose names are the same, only the latest deleted file is stored in the recycle
bin and can be restored.
Example
# Delete the file test/test.txt.
<H3C> delete test/test.txt
Delete
unit1>flash:/test/test.txt?[Y/N]:y
.
%Delete file
unit1>flash:/test/test.txt...Done.
# Delete the files with the main attribute.
<H3C> delete running-files
Delete the running files ? [Y/N]:y
Start deleting ..........
Deleting ... done
1.2.4 dir
Syntax
dir [ /all
] [ file-url ]
View
User view
Parameter
/all: Specifies to display the
information about all the files, including those in the recycle bin.
file-ur:
Path name or the name of a file in the Flash memory. You can use the *
character as a wildcard. For example, the dir *.txt command displays the
information about all the files with the extension of txt in the current
directory.
Description
Use the dir command to display the information
about the specified files or directories in the Flash memory on a switch.
You can use the * character as a wildcard.
In the output information, files with the
main, backup or main/backup attribute are tagged.
In the output information
of the dir /all command, deleted files (that is, those in the recycle
bin) are embraced in brackets.
Example
# Display the information about all the ordinary
files in the root directory of the file system.
<H3C> dir
Directory of unit1>flash:/
1 (*b) -rw- 3272557 Jul 24
2006 12:00:00 s3152p.bin
2 -rw- 310368 Apr 01
2000 23:58:47 s3100-52p.btm
3 -rw- 1890 Apr 02
2000 00:04:51 moni_pcs01_02.cfg
4 -rw- 2059 Apr 02
2000 13:57:57 123.cfg
5 (b) -rw- 4428 Apr 02
2000 03:54:25 startup.cfg
6 -rw- 728656 Apr 02
2000 15:19:35 default.diag
7
-rw- 65 Apr 02 2000 16:23:19 temp1
8 -rw- 310480 Apr 02
2000 16:36:40 s4e02_00c08.btm
9 -rw-
100784 Apr 02 2000 17:16:00 cmdtree.txt
7239 KB total (2476 KB free)
(*) -with main attribute (b) -with
backup attribute
(*b) -with both main and backup
attribute
# Display the information about all the
files whose names begin with the character t (including those in the recycle
bin) in the local directory flash:/test/.
<H3C> dir /all test/t*
Directory of unit1>flash:/test/
0 -rw- 279296 Apr 04
2000 14:45:19 test.txt
15367 KB total (3720 KB free)
(*) -with main attribute (b) -with
backup attribute
(*b) -with both main and backup
attribute
Syntax
execute
filename
View
System view
Parameter
filename: Batch
file, with the extension .bat.
Description
Use the execute command to execute
the specified batch file.
This command executes command lines in the batch
file in sequence. Note that the batch file cannot contain any invisible
character. If any invisible character is found, the command will quit the
current execution process and the executed operations are not cancelled
automatically.
The batch execution command is the
automation of executing commands in a batch file. However it
l
Does not guarantee that every command in the
file is executed.
l
Does not perform hot backup.
l
Does not restrict the forms and contents of
commands in the file.
Example
# Execute the batch file named test.bat
under the directory flash:/.
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] execute test.bat
<H3C>
....
%Created dir unit1>flash:/test3.
Syntax
file prompt {
alert | quiet }
View
System view
Parameter
alert: Specifies
to prompt for confirmation before performing file-related operations that have
potential risks.
quiet: Specifies
to disable prompts for file-related operations.
Description
Use the file prompt command to
configure the prompt mode for file-related operations.
By default, alert mode is used, by which a
switch prompts for confirmation before performing file-related operations that
have potential risks.
If you set the prompt mode of the
file-related operations to quiet, the switch does not prompt for
confirmation before performing file-related operations. In this case, the
system is more likely to operate improperly if irretrievable file-related
operations are performed. For example, if the prompt mode is set to alert,
the following messages will be displayed when you delete a file:
<H3C> delete
unit1>flash:/te.txt
Delete unit1>flash:/te.txt?[Y/N]:y
......
%Delete file
unit1>flash:/te.txt...Done.
If the prompt mode is set to quiet,
the following messages will be displayed when you delete a file:
<H3C> delete
unit1>flash:/te.txt
....
%Delete file
unit1>flash:/te.txt...Done.
Example
# Set the prompt mode to quiet for
file-related operations.
<H3C>
system-view
System View: return to User View with
Ctrl+Z.
[H3C] file prompt quiet
Syntax
fixdisk device
View
User view
Parameter
device: Name
of a device.
Description
Use the fixdisk command to restore
space on the Flash memory.
In case that space on the Flash memory may
become unavailable for reasons such as abnormal operations, you can run this
command to restore the space.
Example
# Restore space on the Flash memory.
<H3C> fixdisk flash:
Fixdisk flash: may take some time to
complete.
%Fixdisk unit1>flash: completed.
Syntax
format device
View
User view
Parameter
device: Name
of a device.
Description
Use the format command to format the
Flash memory.
Caution:
The format
operation leads to the loss of all the files on the Flash memory, and the
operation is irretrievable.
Example
# Format the Flash memory.
<H3C>format unit1>flash:
All data on unit1>flash: will be
lost , proceed with format ? [Y/N]:y
..............................
%Format unit1>flash: completed.
Syntax
mkdir directory
View
User view
Parameter
directory:
Name of a directory.
Description
Use the mkdir command to create a
directory in the specified directory of a Flash memory.
Note that the names of the directories and
files in the same directory must be unique.
Example
# Create a directory in the current
directory, with the name being dd.
<H3C> mkdir dd
....
%Created dir unit1>flash:/dd.
Syntax
more file-url
View
User view
Parameter
file-url:
Path name or file name of a file in the Flash memory.
Description
Use the more command to display the
contents of a specified file.
Currently, the contents of a file can only
be displayed in text.
Example
# Display the content of the file named test.txt.
<H3C> more test.txt
AppWizard has created this test
application for you.
This file contains a summary of what
you will find in each of the files that make up your test application.
Test.dsp
This file (the project file) contains
information at the project level and is used to build a single project or
subproject. Other users can share the project (.dsp) file, but they should
export the makefiles locally.
Syntax
move fileurl-source
fileurl-dest
View
User view
Parameter
fileurl-source:
Path name or file name of the source file in the Flash memory.
fileurl-dest:
Path name or file name of the target file in the Flash memory.
Description
Use the move command to move a file
to a specified directory.
If the target file name is the same as an
existing file, the system prompts you for the confirmation to overwrite the existing
file.
Example
# Move the file named 1.txt from flash:/ to
flash:/a/, with the name unchanged.
<H3C>move unit1>flash:/1.txt unit1>flash:/a/
Move unit1>flash:/1.txt to
unit1>flash:/a/1.txt?[Y/N]:y
.
%Moved file unit1>flash:/1.txt to
unit1>flash:/a/1.txt.
Syntax
pwd
View
User view
Parameter
None
Description
Use the pwd command to display the
current path.
Example
# Display the current path.
<H3C> pwd
unit1>flash:
Syntax
rename fileurl-source
fileurl-dest
View
User view
Parameter
fileurl-source:
Original path name or file name of a file in the Flash memory.
fileurl-dest:
Target path name or file name.
Description
Use the rename command to rename a
file or a directory.
If the target file name or directory name
is the same with any existing file name or directory name, you will fail to perform
the rename operation.
Example
# Rename the file named config.txt to config.bak.
<H3C>rename config.txt config.bak
Rename unit1>flash:/config.txt to
unit1>flash:/config.bak?[Y/N]:y
.
%Renamed file unit1>flash:/config.txt
to unit1>flash:/config.bak.
Syntax
reset recycle-bin
[ file-url ] [ /force ]
View
User view
Parameter
file-url:
Path name or file name of a file in the Flash memory. This argument supports
the wildcard “*”.
/force: Specifies not to prompt for
confirmation before deleting files.
Description
Use the reset recycle-bin command to
clear the recycle bin in the Flash memory.
The files deleted by the delete
command are moved to the recycle bin. To delete them permanently, you can use
the reset recycle-bin command.
Example
# Clear the recycle bin.
<H3C>reset recycle-bin unit1>flash:/
Clear unit1>flash:/te.txt ?[Y/N]:y
Clearing files from flash may take a
long time. Please wait...
.....
%Cleared file
unit1>flash:/~/te.txt.
Syntax
rmdir directory
View
User view
Parameter
directory:
Name of a directory.
Description
Use the rmdir command to delete a
directory.
As only empty directories can be deleted,
you need to clear a directory before deleting it.
Example
# Delete the directory named dd.
<H3C> rmdir dd
Rmdir unit1>flash:/dd?[Y/N]:y
....
%Removed directory unit1>flash:/dd.
Syntax
undelete file-url
View
User view
Parameter
file-url:
Path name or file name of a file in the Flash memory.
Description
Use the undelete command to restore a
deleted file from the recycle bin.
If the name of the file to be restored is
the same as that of an existing file, the system prompts you for the
confirmation to overwrite the latter.
Example
# Restore the deleted file named sample.bak.
<H3C> undelete sample.bak
Undelete unit1>flash:/sample.bak
?[Y/N]:y
% Undeleted file unit1>flash:/sample.bak.
Syntax
ftp server enable
undo ftp server
View
System view
Parameter
None
Description
Use the ftp server enable command to
enable FTP server and allow FTP users to log in.
Use the undo ftp server command to
disable FTP server and deny FTP users to log in.
By default, FTP server is disabled.
You can use the commands here to enable or
disable FTP server. Disabling FTP server can ensure secure operating of the
device.
Example
# Disable FTP server.
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] undo ftp server
% Close FTP server
Syntax
local-user user-name
undo local-user { user-name | all [ service-type { telnet |
ftp | lan-access | ssh | terminal } ] }
View
System view
Parameter
user-name:
Local user name, a character string of no more than 80 characters. This string
cannot contain the following characters: /:*?<>. It can contain no more
than one "@" character; the pure user name (the part before
"@", that is, the user ID) cannot be longer than 55 characters. The
user name is case-insensitive; that is, the system considers UserA and usera as
the same user.
service-type:
Specifies a user type. You can specify one of the following user types: telent,
ftp, lan-access (this type of users are mainly Ethernet access
users, for example, 802.1x users), ssh, and terminal (this type
of users can use terminal service, that is, the users can log into the switch
through Console port, AUX port, or Asynchronous serial port).
all:
Specifies all users.
Description
Use the local-user command to add a
local user and enter local user view.
Use the undo local-user command to
delete the specified local user(s).
Example
# Add a local user named hello1.
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] local-user hello1
New local user added.
[H3C-luser-hello1]
Syntax
local-user password-display-mode
{ auto | cipher-force }
undo local-user password-display-mode
View
System view
Parameter
auto:
Specifies to display passwords in the modes adopted when the passwords are set.
If a password is set in cipher mode, the password will be displayed in cipher
text; or else, the password will be displayed in plain text.
cipher-force:
Specifies to display passwords in cipher text forcibly.
Description
Use the local-user password-display-mode
command to set the password display mode when the switch displays the local
users.
Use the undo local-user password-display-mode
command to restore the default password display mode.
If the cipher-force mode is adopted,
the passwords will be displayed in cipher text even though the password
command is used to specify the password display mode to simple.
By default, the password display mode of
local users is auto.
Example
# Set the password display mode when the
switch displays local users to cipher-force.
<H3C>system-view
System View: return to User View with
Ctrl+Z.
[H3C] local-user password-display-mode
cipher-force
Syntax
password { simple
| cipher } password
undo password
View
Local user view
Parameter
simple: Specifies
to display password in plain text.
cipher: Specifies
to display password in cipher text.
password:
Password to be set. In simple mode, it is a string of 1 to 63 characters;
in cipher mode, it is a character string of 1 to 63 characters or fixed 88
characters.
Description
Use the password command to set a
password for the local user.
Use the undo password command to
cancel the password setting.
Note that, after the local-user
password-display-mode cipher-force command is used, the user
password will be displayed in cipher text even though the password
command is used to specify the password display mode to simple.
Example
# Set the password of user hello1 to
20030422 in plain text.
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] local-user hello1
[H3C-luser-hello1] password simple
20030422
Syntax
ftp [ ipaddress
[ port ] ]
View
User view
Parameter
ipaddress:
IP address of a remote FTP server.
port: Port
number of the remote FTP server. If the port argument is not specified,
the default port number will be used.
Description
Use the ftp command to establish a
control connection with a remote FTP server and enter FTP client view.
Example
# Connect to the remote FTP server whose IP
address is 1.1.1.1.
<H3C> ftp 1.1.1.1
Trying ...
Press CTRL+K to abort
Connected.
220 FTP service ready.
User(none):hello
331 Password required for hello.
Password:
230 User logged in.
Syntax
get remotefile
[ localfile ]
View
FTP client command view
Parameter
localfile:
Local file name.
remotefile:
File name on the remote FTP server.
Description
Use the get command to download a
remote file and save the file to the local device.
If no local file name is specified, the
switch will save the remote file locally with the same file name as that on the
remote FTP server
Example
# Download the file temp1.c and save it as local
file temp.c .
<H3C> ftp 1.1.1.1
Trying ...
Press CTRL+K to abort
Connected.
220 FTP service ready.
User(none):hello
331 Password required for hello.
Password:
230 User logged in.
[ftp] get temp1.c temp.c
200 Port command okay.
150 Opening ASCII mode data
connection for temp1.c.
..226 Transfer complete.
FTP: 1709 byte(s) received in 2.176
second(s) 0.00 byte(s)/sec.
[ftp]
Syntax
tftp tftp-server get source-file [ dest-file ]
View
User view
Parameter
tftp-server:
IP address or host name of a TFTP server.
source-file:
Name of the file which will be downloaded from the TFTP server.
dest-file:
Name of the file to which the downloaded file will be saved on the switch.
Description
Use the tftp get command to download
a file from a TFTP server to this switch.
Example
# Download the file LANSwitch.bin from the
TFTP server, whose IP address is 1.1.3.214, to this switch and save it to the
file vs.bin.
<H3C> tftp 1.1.3.214 get LANSwitch.bin
vs.bin