2022-07-18 Linux df、free、chown、crontab命令
生活随笔
收集整理的這篇文章主要介紹了
2022-07-18 Linux df、free、chown、crontab命令
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Linux df、free、chown、crontab命令
- 前言
- df 查看磁盤使用情況
- free 查看內存使用情況
- chown 設置文件擁有者和擁有組
- crontab 定時器
前言
介紹一些常用的Linux命令,觀察系統狀態
df 查看磁盤使用情況
[root@iZbp10sz66ubwocy0uxhauZ shell]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 79G 20G 56G 26% / devtmpfs 1.8G 0 1.8G 0% /dev tmpfs 1.8G 9.5M 1.8G 1% /dev/shm tmpfs 1.8G 688K 1.8G 1% /run tmpfs 1.8G 0 1.8G 0% /sys/fs/cgroup tmpfs 361M 0 361M 0% /run/user/0 /dev/loop1 911M 911M 0 100% /mnt/dmfree 查看內存使用情況
[root@iZbp10sz66ubwocy0uxhauZ shell]# free -htotal used free shared buff/cache available Mem: 3.5G 1.1G 156M 10M 2.2G 2.1G Swap: 0B 0B 0Bchown 設置文件擁有者和擁有組
# 查看當前文件列表 [root@iZbp10sz66ubwocy0uxhauZ shell]# ll total 8 -rw-r--r-- 1 root root 29 Jul 18 20:59 content -rwxr-xr-x 1 root root 26 Jul 18 20:49 cron.sh# 設置content文件擁有者為zsl用戶,用戶組public(當為文件夾時,使用 -R 可選項將遞歸設置所有子文件) [root@iZbp10sz66ubwocy0uxhauZ shell]# chown -R zsl:public content# 查看設置后的文件列表 [root@iZbp10sz66ubwocy0uxhauZ shell]# ll total 8 -rw-r--r-- 1 zsl public 29 Jul 18 20:59 content -rwxr-xr-x 1 root root 26 Jul 18 20:49 cron.shcrontab 定時器
“* * * * * ” 五個* 分別代表 分鐘、小時、天、月、星期,與java中定時任務大致相同;
設置定時器:
# 進入vi模式設置定時器 [root@iZbp10sz66ubwocy0uxhauZ shell]# crontab -e * * * * * date >> /root/shell/content * * * * * echo '123' >> /root/shell/content查看定時任務:
# 查看定時任務 [root@iZbp10sz66ubwocy0uxhauZ shell]# crontab -l * * * * * date >> /root/shell/content * * * * * echo '123' >> /root/shell/content查看定時任務結果:
# 查看content文件內容 [root@iZbp10sz66ubwocy0uxhauZ shell]# cat /root/shell/content Mon Jul 18 20:59:01 CST 2022 123 Mon Jul 18 21:11:01 CST 2022 123 Mon Jul 18 21:12:01 CST 2022清楚定時器內容(可以通過crontab -e 刪除單行):
# 查看content文件內容 [root@iZbp10sz66ubwocy0uxhauZ shell]# crontab -r [root@iZbp10sz66ubwocy0uxhauZ shell]# crontab -l no crontab for root總結
以上是生活随笔為你收集整理的2022-07-18 Linux df、free、chown、crontab命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 读《基于深度学习的跨视角步态识别算法研究
- 下一篇: linux 其他常用命令