今天學到了兩個命令,其實都很簡單,只是本身不多使用而不知道罷了,這裏簡單記錄一下 tar 幾乎每天都會用到,今天卻遇到一個新問題,如何將指定的一些目錄不打到包內?操做以下: tar -cvf target.tar --exclude=目錄1 --exlude=目錄2.。。。。。源目錄 script 這個命令用來將操做的過程保存在日誌中,securecrt中有設置log的功能,沒想到操做系統上也能夠,語法和使用都很簡單: 語法:script [-a] [-f] [-q] [-t] [file] 一、執行script命令 [mysql@bj122 mysql]$ script Script started, file is typescript 二、隨便執行一些命令 [mysql@bj122 mysql]$ ls charge_2008 checklog dbalert.tar mysql pointcard_slave.tar.gz charge_alert checklog.tar etl_daily MysqlAlert.class temp charge_alert.tar checklog.tar.gz etl_daily.tar mysql_db.tar ttt.txt charge_stat_for_yuhui cron_mysql ftptst.ctl mysql-standard-5.0.27-linux-i686-glibc23 typescript charge_stat_for_yuhui.tar dbalert ip.txt nohup.out [mysql@bj122 mysql]$ w 17:34:09 up 7:40, 5 users, load average: 0.01, 0.02, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT search pts/0 203.86.63.98 9:56am 1:39 0.41s 0.04s -bash zxzhai pts/2 203.86.63.98 11:37am 0.00s 0.42s 0.11s -bash zxzhai pts/3 203.86.63.98 11:46am 1:58m 0.15s 0.03s ssh -p7522 192.168.160.32 -lzzx search pts/4 203.86.63.98 11:57am 3:03m 0.12s 0.03s -bash search pts/5 203.86.63.98 2:13pm 3:19m 0.20s 0.04s -bash 三、退出script [mysql@bj122 mysql]$ exit exit Script done, file is typescript 四、日誌記錄在typescript文件中 [mysql@bj122 mysql]$ more typescript Script started on Wed Jul 2 17:34:03 2008 [mysql@bj122 mysql]$ ls charge_2008 checklog dbalert.tar mysql pointcard_slave.tar.gz charge_alert checklog.tar etl_daily MysqlAlert.class temp charge_alert.tar checklog.tar.gz etl_daily.tar mysql_db.tar ttt.txt charge_stat_for_yuhui cron_mysql ftptst.ctl mysql-standard-5.0.27-linux-i686-glibc2 3 typescript charge_stat_for_yuhui.tar dbalert ip.txt nohup.out [mysql@bj122 mysql]$ w 17:34:09 up 7:40, 5 users, load average: 0.01, 0.02, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT search pts/0 203.86.63.98 9:56am 1:39 0.41s 0.04s -bash zxzhai pts/2 203.86.63.98 11:37am 0.00s 0.42s 0.11s -bash zxzhai pts/3 203.86.63.98 11:46am 1:58m 0.15s 0.03s ssh -p7522 192.168.160.32 -lzzx search pts/4 203.86.63.98 11:57am 3:03m 0.12s 0.03s -bash search pts/5 203.86.63.98 2:13pm 3:19m 0.20s 0.04s -bash [mysql@bj122 mysql]$ exit exit Script done on Wed Jul 2 17:34:13 2008