man手册、zip备份
man手冊、zip備份
3.1問題
本例要求掌握man幫助手冊的使用,以及zip壓縮/解壓縮的操作,完成下列任務(wù):
查閱passwd命令、/etc/passwd配置文件的手冊頁
使用zip打包/usr/share/doc/qemu-kvm/目錄
3.2方案
zip/unzip壓縮與解壓縮:
制作zip壓縮包:zip[-r]備份文件.zip被歸檔的文檔...
釋放zip壓縮包:unzip備份文件.zip[-d目標文件夾]
3.3步驟
實現(xiàn)此案例需要按照如下步驟進行。
步驟一:使用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)恢復(fù)測試
l 刪除目標文件夾并確認結(jié)果:
[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
l 恢復(fù)目標文件夾并確認結(jié)果:
[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
總結(jié)
以上是生活随笔為你收集整理的man手册、zip备份的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MybatisPlus #{param}
- 下一篇: 实战进阶 Vue3+Axios+pini