linux命令pf linux命令poweroff( 二 )


[root@linux ~]# tar -czvpf /tmp/etc.tar.gz /etc
# 这个 -p 的属性是很重要的,尤其是当您要保留原本档案的属性时!
范例六:在 /home 当中,比 2005/06/01 新的档案才备份
[root@linux ~]# tar -N '2005/06/01' -czvf home.tar.gz /home
范例七:我要备份 /home, /etc,但不要 /home/dmtsai
[root@linux ~]# tar --exclude /home/dmtsai -czvf myfile.tar.gz /home/* /etc
范例八:将 /etc/ 打包后直接解开在 /tmp 底下,而不产生档案!
[root@linux ~]# cd /tmp
[root@linux tmp]# tar -cvf - /etc | tar -xvf -
# 这个动作有点像是 cp -r /etc /tmp 啦~依旧是有其有用途的!
# 要注意的地方在于输出档变成 - 而输入档也变成 -  , 又有一个 | 存在~
# 这分别代表 standard output, standard input 与管线命令啦!
# 这部分我们会在 Bash shell 时,再次提到这个指令跟大家再解释啰!
++++++++++++++++++++++++++++++++++++++++++++
补充:tar如何解压文件到指定的目录
tar czvf mysql.tar.gz /var/lib/mysql
压缩的文件,我想解压到当前目录下 , 而不是绝对路径下,该如何解压?
tar cxvf mysql.tar.gz 的话,会覆盖 /var/lib/mysql 下全部文件吧?我现在就一个表坏了,想单独恢复一个表的资料 , 而不是恢复全部数据库,所以要解压到指定的目录下 , 再把那个表资料找不来恢复 。
============================================
#tar zxvf mysql.tar.gz -C /home/aaa
============================================
tar zxvf mysql.tar.gz -C /home/aaa
这样的话,解压后的目录结构是怎么样的?
/home/aaa/var/lib/mysql 吗?
============================================
试下就知道了....
============================================
归档里面的所有文件均是相对引用,归档解压缩(释放)在了当前目录 。归档文件总是释放到当前目录,为的是防止破坏文件系统中重名的文件 。
所以,楼主的解压缩不会覆盖/var/lib/mysql,只会释放在当前目录先 , 即./var/lib/mysql如果想覆盖的话,在归档和解压时请使用-P参数:
tar zcvf mysql.tar.gz -P /var/lib/mysql
tar -Pzxvf mysql.tar.gz
如何使用Linux命令dhclient如何使用Linux命令
dhclient
The
Internet Systems Consortium DHCP Client, dhclient, provides a means for
configuring one or more network interfaces using the Dynamic Host Configuration
Protocol, BOOTP protocol, or if these protocols fail, by statically assigning an
address.
linux
dhclient linux命令pf的语法
dhclient
[ -p port ] [ -d ] [ -e VAR=value ] [ -q ] [ -1 ] [ -r ] [ -lf lease-file ] [
-pf pid-file ] [ -cf config-file ] [ -sf script-file ] [ -e ENVVAR=value ] [ -s
server ] [ -g relay ] [ -n ] [ -nw ] [ -w ] [ if0 [ ...ifN ] ]
-p port
If the DHCP client should listen and transmit on a port other
than the standard (port 68), the -p flag may used. It should be followed by the
udp port number that dhclient should use. This is mostly useful for debugging
purposes. If a different port is specified for the client to listen on and
transmit on, the client will also use a different destination port - one greater
than the specified destination port.
-s
The DHCP client normally transmits any protocol messages it sends
before acquiring an IP address to, 255.255.255.255, the IP limited broadcast
address. For debugging purposes, it may be useful to have the server transmit
these messages to some other address. This can be specified with the -s flag,
followed by the IP address or domain name of the destination.
-g
For testing purposes, the giaddr field of all packets that the
client sends can be set using the -g flag, followed by the IP address to send.

推荐阅读