4. PROCESO DE PASANTÍA
4.4. RESULTADOS GENERALES POR NIVEL
Use tar create to archive files and folders.
Syntax
tar create [ gz ] archive-file fileurl-dest [ verbose ] source fileurl-source-list&<1-5>
Views
User view
Predefined user roles
network-admin
Parameters
gz: Uses gzip to compress the files and folders before archiving them.
archive-file fileurl-dest: Specifies the archive file name. If you specified the gz keyword, the suffix of this argument must be .tar.gz. If you did not specify the gz keyword, the suffix of this argument must be .tar.
verbose: Displays the names of the successfully archived files and folders.
source fileurl-source-list&<1-5>: Specifies the files and folders to be archived. The fileurl-source-list
argument can be a space-separated list of up to five items. Each item can be a file or folder name.
Examples
Creating archive a.tar …… Done.
# Compress file a.cfg and archive the file to a.tar.gz.
<Sysname> tar create gz archive-file a.tar.gz source a.cfg Creating archive a.tar.gz Done.
# Compress and archive files and folders, and display the successfully archived files and folders.
<Sysname> tar create gz archive-file a.tar.gz verbose source a.cfg a.dbm ./core a.cfg a.dbm ./core Related commands • tar extract • tar list
tar extract
Use tar extract to extract files and folders.
Syntax
tar extractarchive-file fileurl-dest [ verbose ] [ screen | to directory-name ]
Views
User view
Predefined user roles
network-admin
Parameters
archive-file fileurl-dest: Specifies the archive file name. The suffix can be .tar or .tar.gz.
verbose: Displays the names of the successfully extracted files and folders.
screen: Displays the content of the extracted files and folders on the screen. The extracted files are not saved.
to directory-name: Saves the extracted files and folders to a path.
Usage guidelines
If you do not specify the screen keyword or the to directory-name option, the command extracts the archived files and folders and saves them to the same folder as the archive file.
Examples
# Extract files and folders, and save them to the same folder as the archive file.
<Sysname> tar extract archive-file a.tar.gz Extracting archive a.tar.gz …… Done.
# Extract files and folders, and display their content on the screen.
<Sysname> tar extract archive-file a.tar.gz verbose screen a.cfg # version 7.1.045, Release 1111 # sysname Sysname #
# Extract files and folders, save them to the same folder as the archive file, and display the names of the archived files and folders.
<Sysname> tar extract archive-file a.tar.gz verbose a.txt
# Extract files and folders, and save them to the path flash:/a.
<Sysname> tar extract archive-file a.tar.gz to flash:/a Extracting archive a.tar.gz ...Done.
Related commands • tar create
• tar list
tar list
Use tar list to display the names of archived files and folders.
Syntax
tar list archive-file fileurl-dest
Views
User view
Predefined user roles
network-admin
Parameters
archive-file fileurl-dest: Specifies the archive file name. The suffix can be .tar or .tar.gz.
Examples
# Display the names of archived files and folders.
<Sysname> tar list archive-file a.tar.gz a.cfg
Related commands • tar create
• tar extract
umount
Use umount to unmount a hot swappable storage medium.
Syntax
umount medium-name
Default
A storage medium is automatically mounted and placed in mounted state.
Views
User view
Predefined user roles
Parameters
medium-name: Specifies the name of a storage medium. The value varies by device model.
Usage guidelines
Before you remove a mounted storage medium from the system, first unmount it to avoid damaging the medium.
Before you unmount a storage medium, make sure no other users are accessing the medium. Otherwise, the unmount operation fails.
When a storage medium is connected to a lower version system, the system might not be able to automatically recognize the device. In this case, you must first execute the mount command for the storage medium to operate correctly.
To avoid file system corruption, do not perform the following tasks while the system is mounting or unmounting a storage medium:
• Install or remove storage media.
• perform a master/subordinate switchover.
Examples
# Unmount a USB disk from the master.
<Sysname> umount usba0:
# Unmount a USB disk from the subordinate member with the member ID 2.
<Sysname> umount slot2#usba0:
Related commands
mount
undelete
Use undelete to restore a file from the recycle bin.
Syntax
undeletefile-url
Views
User view
Predefined user roles
network-admin
Parameters
file-url: Specifies the name of the file to be restored.
Usage guidelines
If a file with the same name already exists in the directory, the system prompts whether or not you want to overwrite the existing file. If you enter Y, the existing file is overwritten. If you enter N, the command is not executed.
Examples
# Restore the copy.cfg file, which was moved from the flash: directory to the recycle bin.
<Sysname>undelete copy.cfg Undelete flash:/copy.cfg?[Y/N]:y
Undeleting file flash:/copy.cfg... Done.
• Method 1:
<Sysname>undelete seclog/startup.cfg Undelete flash:/seclog/startup.cfg?[Y/N]:y
Undeleting file flash:/seclog/startup.cfg... Done. <Sysname>
• Method 2:
<Sysname> cd seclog
<Sysname> undelete startup.cfg
Undelete flash:/seclog/startup.cfg?[Y/N]:y