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