2022-07-18 Linux df、free、chown、crontab命令
生活随笔
收集整理的這篇文章主要介紹了
2022-07-18 Linux df、free、chown、crontab命令
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Linux df、free、chown、crontab命令
- 前言
- df 查看磁盤(pán)使用情況
- free 查看內(nèi)存使用情況
- chown 設(shè)置文件擁有者和擁有組
- crontab 定時(shí)器
前言
介紹一些常用的Linux命令,觀察系統(tǒng)狀態(tài)
df 查看磁盤(pán)使用情況
[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 查看內(nèi)存使用情況
[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 設(shè)置文件擁有者和擁有組
# 查看當(dāng)前文件列表 [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# 設(shè)置content文件擁有者為zsl用戶,用戶組public(當(dāng)為文件夾時(shí),使用 -R 可選項(xiàng)將遞歸設(shè)置所有子文件) [root@iZbp10sz66ubwocy0uxhauZ shell]# chown -R zsl:public content# 查看設(shè)置后的文件列表 [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 定時(shí)器
“* * * * * ” 五個(gè)* 分別代表 分鐘、小時(shí)、天、月、星期,與java中定時(shí)任務(wù)大致相同;
設(shè)置定時(shí)器:
# 進(jìn)入vi模式設(shè)置定時(shí)器 [root@iZbp10sz66ubwocy0uxhauZ shell]# crontab -e * * * * * date >> /root/shell/content * * * * * echo '123' >> /root/shell/content查看定時(shí)任務(wù):
# 查看定時(shí)任務(wù) [root@iZbp10sz66ubwocy0uxhauZ shell]# crontab -l * * * * * date >> /root/shell/content * * * * * echo '123' >> /root/shell/content查看定時(shí)任務(wù)結(jié)果:
# 查看content文件內(nèi)容 [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清楚定時(shí)器內(nèi)容(可以通過(guò)crontab -e 刪除單行):
# 查看content文件內(nèi)容 [root@iZbp10sz66ubwocy0uxhauZ shell]# crontab -r [root@iZbp10sz66ubwocy0uxhauZ shell]# crontab -l no crontab for root總結(jié)
以上是生活随笔為你收集整理的2022-07-18 Linux df、free、chown、crontab命令的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 读《基于深度学习的跨视角步态识别算法研究
- 下一篇: [基础概念] headroom/tail