Linux Shell 常用指令示例

环境:CentOS

1. 查看当前目录(含子目录)总大小

$ du -sh
1.4M .

2. 查看当前目录总大小及子目录大小

$ du -h
4.0K ./folder
1.4M .

3. 查看自己空间和文件配额

$ quota
Disk quotas for user zilzhang (uid 110111452):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
         my.com   307004  5242880 5242880  115  4294967295 4294967295

4. sh 执行命令

echo "ls -lrt" | sh

5. 发email 程序

/usr/sbin/sendmail -f [email protected] $EMAIL_TO $EMAIL_CC <<EOF
Subject: $ENV Table $TABLE_NAME Check Volume Do Not Pass
MIME-Version: 1.0
From: [email protected]
To: $EMAIL_TO
Cc: $EMAIL_CC
Content-Type: text/html
Content-Disposition: inline
<html>
<head>
</head>
<body margin-top=24px margin-left=16px>
 Hi All,<br>
     <br>
           内容

     <br>
                  
                 <br>
 Thanks<br>
 DW_ADM
 <br>
</body>
</html>
EOF

 

6. 循环

for i in `ls`
do
echo $i
done

 

for ((i=0;i<=10;i++))
do
echo $i
done

 

你可能感兴趣的:(linux,shell,unix,sendmail)