Common Shell Routines

Source: Internet
Author: User

1. Iterate over each line in the file

 while read line;  Do Echo $line;  Done file. txt

Or

Cat file. txt | ( while read line;  Do echo $line; done)

Or

Cat file awk ' {print} '

2. Iterate over a word

 for inch $line;  Do Echo $word;  Done

3. WC statistics lines and characters

WC file // number of rows of statistics WC -wfile//  statistic number of words WCfile//  Statistical characters 

4. Linux at

The AT command is used to schedule a program to execute once in the future. All submitted tasks will be placed in the/var/spool/at directory and executed by the ATD Daemon at the time of execution

5. Identify the specific file

Find files that were modified 120 days ago in the/home directory

Find /home-mtime +

The/var directory to find files that have not been accessed within 90 days

find /var \! -atime-

Find files larger than 10MB in the/usr directory

Find /usr-size +10m

6. What is the use of the/proc file system?

The/proc file system is a memory-based file system that maintains information about the kernel state that is currently running. Includes CPU, memory, partition, IO address and other running processes. They are not files that actually store information, but instead point to in-memory information and are automatically maintained by the system.

Common Shell Routines

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.