man手册、zip备份

                                                                                                            man手册、zip备份

3.1问题

本例要求掌握man帮助手册的使用,以及zip压缩/解压缩的操作,完成下列任务:

查阅passwd命令、/etc/passwd配置文件的手册页

使用zip打包/usr/share/doc/qemu-kvm/目录

3.2方案

zip/unzip压缩与解压缩:

制作zip压缩包:zip[-r]备份文件.zip被归档的文档...

释放zip压缩包:unzip备份文件.zip[-d目标文件夹]

3.3步骤

实现此案例需要按照如下步骤进行。

步骤一:使用man手册页获取帮助

1)查看passwd命令的手册页

[root@svr7~]#man passwd

PASSWD(1)User utilities PASSWD(1)

NAME

passwd-update user's authentication tokens

SYNOPSIS

passwd[-k][-l][-u[-f]][-d][-e][-n mindays][-x maxdays][-w

warndays][-i inactivedays][-S][--stdin][username]

DESCRIPTION

The passwd utility is used to update user's authentication token(s).

This task is achieved through calls to the Linux-PAM and Libuser API.

Essentially,it initializes itself as a"passwd"service with Linux-

PAM and utilizes configured password modules to authenticate and then

update a user's password.

....

2)查看/etc/passwd配置文件的手册页

[root@svr7~]#man 2 passwd

PASSWD(5)Linux Programmer's Manual PASSWD(5)

NAME

passwd-password file

DESCRIPTION

The/etc/passwd file is a text file that describes user login

accounts for the system.It should have read permission allowed for

all users(many utilities,like ls(1)use it to map user IDs to user

names),but write access only for the superuser.

In the good old days there was no great problem with this general

read permission.Everybody could read the encrypted passwords,but

the hardware was too slow to crack a well-chosen password,and more

over the basic assumption used to be that of a friendly user-commu

nity.These days many people run some version of the shadow password

suite,where/etc/passwd has an'x'character in the password

....

步骤二:使用zip命令制作压缩包

1)将目录/usr/share/doc/qemu-kvm/备份为/root/qemu-kvm.zip

[root@svr7~]#zip -r /root/qemu-kvm.zip /usr/share/doc/qemu-kvm/

adding:usr/share/doc/qemu-kvm/(stored 0%)

adding:usr/share/doc/qemu-kvm/COPYING(deflated 62%)

adding:usr/share/doc/qemu-kvm/COPYING.LIB(deflated 65%)

adding:usr/share/doc/qemu-kvm/Changelog(deflated 61%)

adding:usr/share/doc/qemu-kvm/LICENSE(deflated 45%)

adding:usr/share/doc/qemu-kvm/README(deflated 4%)

2)恢复测试

删除目标文件夹并确认结果:

[root@svr7~]#rm -rf /usr/share/doc/qemu-kvm/

[root@svr7~]#ls /usr/share/doc/qemu-kvm/

ls:cannot access/usr/share/doc/qemu-kvm/:No such file or directory

恢复目标文件夹并确认结果:

[root@svr7~]#unzip /root/qemu-kvm.zip-d/

Archive:/root/qemu-kvm.zip

creating:/usr/share/doc/qemu-kvm/

inflating:/usr/share/doc/qemu-kvm/COPYING

inflating:/usr/share/doc/qemu-kvm/COPYING.LIB

inflating:/usr/share/doc/qemu-kvm/Changelog

....

[root@svr7~]#ls /usr/share/doc/qemu-kvm/

COPYING README qemu-tech.html

COPYING.LIB README.rhel6-gpxe-source qmp-commands.txt

Changelog README.systemtap qmp-events.txt

LICENSE qemu-doc.html qmp-spec.txt

posted @ 2019-11-26 16:28  云计算(互联网)  Views(289)  Comments(0Edit  收藏  举报