網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
linux系統(tǒng)管理高級(jí)命令(練習(xí))(six day)
作者:沉迷于學(xué)習(xí)的網(wǎng)絡(luò)狗 更新時(shí)間: 2024-07-15 編程語(yǔ)言1. 使用ls查看/etc/?錄下所有的?件信息
[root@oneday ~]# ls /etc/
2. 使用ls查看/etc/目錄下名包含“a”字?的?件或者?錄信息
[root@oneday ~]# ls /etc/*a*
3. 使?ls查看/etc/?錄下以".conf"結(jié)尾的?件信息
[root@oneday ~]# ls /etc/*.conf
4. 使?ls查看/etc/?錄中以"y"字?開(kāi)頭的?件信息
[root@oneday ~]# ls /etc/y*
5. find查找/var/?錄中以“.log”?件
[root@oneday~]# find /var -name "*.log"
6. 在opt?錄下創(chuàng)建test?錄
[root@oneday ~]# mkdir /opt/test
7. 在test?錄中創(chuàng)建abc.txt,def.txt.ghi.txt,xxx.txt.yyy.txt五個(gè)?件
[root@oneday ~]# touch /opt/test/abc.txt /opt/test/def.txt /opt/test/ghi.txt /opt/test/xxx.txt /opt/test/yyy.txt
8. 修改以上5個(gè)?件的最后修改時(shí)間分別為15,14,13,12,11,10?
[root@oneday ~]# touch /opt/test/abc.txt -m -d "2024-7-15 00:00"
[root@oneday ~]# touch /opt/test/def.txt -m -d "2024-7-14 00:00"
[root@oneday ~]# touch /opt/test/ghi.txt -m -d "2024-7-13 00:00"
[root@oneday ~]# touch /opt/test/xxx.txt -m -d "2024-7-12 00:00"
[root@oneday ~]# touch /opt/test/yyy.txt -m -d "2024-7-11 00:00"
[root@oneday ~]# ls -l /opt/test
總用量 103424
-rw-r--r-- 1 root root ? ? ? ? 0 7月 ?15 00:00 abc.txt
-rw-r--r-- 1 root root ? ? ? ? 0 7月 ?14 00:00 def.txt
-rw-r--r-- 1 root root ? ? ? ? 0 7月 ?13 00:00 ghi.txt
-rw-r--r-- 1 root root ? ? ? ? 0 7月 ?12 00:00 xxx.txt
-rw-r--r-- 1 root root ? ? ? ? 0 7月 ?11 00:00 yyy.txt
9. 在test?錄下創(chuàng)建a?錄
[root@oneday ~]# mkdir /opt/test/a
10. 將以上5個(gè)?件復(fù)制?份到a?錄中
[root@oneday ~]# cp /opt/test/*.txt /opt/test/a
11. 將a?錄?件做成bak.tar.gz?件保存到家?錄中
[root@oneday ~]# tar -czvf ~/bak.tar.gz /opt/test/a?
12. 使?find刪除test?錄下3天前的?件
[root@oneday ~]# find /opt/test -mtime +3 -exec rm -rf {} \;
13. find刪除opt?錄下3天內(nèi)的?件
[root@oneday ~]# find /opt/test -mtime -3 -exec rm -rf {} \;
14. find刪除正好第三天的?件
[root@oneday ~]# find /opt/test -mtime 3 | xargs rm -rf?
15. 將/opt/test/a?錄中的?件復(fù)制i?份到/opt/test/?錄下
[root@oneday ~]# cp /opt/test/a /opt/test/
16. 創(chuàng)建?錄/opt/test0
[root@oneday~]# mkdir /opt/test0
17. 在/opt/test0/?錄中創(chuàng)建三個(gè)?件 a.mp4(5M),b.mp4(20M),c.mp4(80M)
[root@oneday ~]# dd if=/dev/zero of=/opt/test0/a.mp4 bs=5M count=1
[root@oneday ~]# dd if=/dev/zero of=/opt/test0/b.mp4 bs=20M count=1
[root@oneday ~]# dd if=/dev/zero of=/opt/test0/c.mp4 bs=80M count=1
[root@oneday ~]# ls -lh /opt/test0/
總用量 105M
-rw-r--r-- 1 root root 5.0M 7月 ?15 16:23 a.mp4
-rw-r--r-- 1 root root ?20M 7月 ?15 16:23 b.mp4
-rw-r--r-- 1 root root ?80M 7月 ?15 16:24 c.mp4
18. 創(chuàng)建?錄/opt/test0/b/
[root@oneday ~]# mkdir /opt/test0/b/
19. 將/op t/test0/中的?件復(fù)制?份/opt/test0/b/?錄中
[root@oneday ~]# cp /opt/test0/*.mp4 /opt/test0/b
20. find查詢/opt/test0/?錄中?件?于20M的,并刪除
[root@oneday ~]# find /opt/test0/ -size +20M -type f -delete
21. find查詢/opt/test0/?錄中?件?于20M的?件并刪除
[root@oneday ~]# find /opt/test0/ -size -20M -type f -delete
22. find查找/opt/test0/?錄中?件size為20M的?件并刪除
[root@oneday ~]# find /opt/test0/ -size 20M -type f -delete
23. /opt/test0/b中的?件復(fù)制?份到/opt/test0中
[root@oneday ~]# cp /opt/test0/b/*.mp4 /opt/test0/
24. 打開(kāi)新的虛擬主機(jī)
25. 將家?錄中的bak.tar.gz?件上傳到新主機(jī)的/opt?錄中
[root@oneday ~]# scp /root/*.tar.gz root@192.168.8.141:/opt/
26. 將新主機(jī)的/etc/skel/?錄下載到 當(dāng)前主機(jī)的/opt?錄中
[root@twoday ~]# scp -r root@192.168.8.136:/etc/skel/ /opt/
27. 設(shè)置計(jì)劃任務(wù),每周3將/etc/yum.repos.d/?錄下的.repo?件壓縮保存到tmp,在?件名中添加時(shí)間戳
[root@oneday ~]# crontab -e
*/1 * * * * /usr/bin/tar -zcvf /tmp/etc-$(date "+\%Y\%m\%d\%H\%M\%S").tar.gz/etc/yum.repos.d/*.repo
原文鏈接:https://blog.csdn.net/m0_75005437/article/details/140444281
- 上一篇:沒(méi)有了
- 下一篇:沒(méi)有了
相關(guān)推薦
- 2022-05-10 開(kāi)發(fā)跨域問(wèn)題的解決
- 2022-10-27 python使用pika庫(kù)調(diào)用rabbitmq參數(shù)使用詳情_(kāi)python
- 2022-05-17 解析Go?中的?rune?類型_Golang
- 2022-07-25 Oracle表分區(qū)詳解_oracle
- 2023-10-25 對(duì)于Echarts實(shí)例化與銷(xiāo)毀的一些運(yùn)用
- 2022-06-28 python生成圖片驗(yàn)證碼的方法_python
- 2022-03-17 .NET?6開(kāi)發(fā)TodoList應(yīng)用引入第三方日志庫(kù)_實(shí)用技巧
- 2023-03-19 C語(yǔ)言實(shí)現(xiàn)求解素?cái)?shù)的N種方法總結(jié)_C 語(yǔ)言
- 欄目分類
-
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門(mén)
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支