Two linux commands

Source: Internet
Author: User
Two linux commands-general Linux technology-Linux technology and application information. For details, refer to the following section. I learned two commands today. They are actually very simple, but I seldom use them, but I don't know them. Here is a simple record.

Tar
I used it almost every day, but today I encountered a new problem. How can I keep some specified directories in the package? The procedure is as follows:
Tar-cvf target.tar -- exclude = directory 1 -- exlude = directory 2 ...... Source directory

Script
This command is used to save the operation process in the log. The securecrt has the log setting function. I didn't expect it to be available on the operating system. The syntax and usage are very simple:
Syntax: script [-a] [-f] [-q] [-t] [file]

1. Execute the script command
[Mysql @ bj122 mysql] $ script
Script started, file is typescript

2. Execute some commands at will
[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, 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 am 0.41 s 0.04 s-bash
Zxzhai pts/2 203.86.63.98 am 0.00 s 0.42 s 0.11 s-bash
Zxzhai pts/3 203.86.63.98 am 1: 58 m 0.15 s 0.03 s ssh-p7522 192.168.160.32-lzzx
Search pts/4 203.86.63.98 am 3: 03 m 0.12 s 0.03 s-bash
Search pts/5 203.86.63.98 pm 3: 19 m 0.20 s 0.04 s-bash

3. Exit script
[Mysql @ bj122 mysql] $ exit
Exit
Script done, file is typescript

4. logs are recorded in typescript files.
[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, 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 am 0.41 s 0.04 s-bash
Zxzhai pts/2 203.86.63.98 am 0.00 s 0.42 s 0.11 s-bash
Zxzhai pts/3 203.86.63.98 am 1: 58 m 0.15 s 0.03 s ssh-p7522 192.168.160.32-lzzx
Search pts/4 203.86.63.98 am 3: 03 m 0.12 s 0.03 s-bash
Search pts/5 203.86.63.98 pm 3: 19 m 0.20 s 0.04 s-bash
[Mysql @ bj122 mysql] $ exit
Exit

Script done on Wed Jul 2 17:34:13 2008
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.