linux week3
生活随笔
收集整理的這篇文章主要介紹了
linux week3
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2.如何快速的回到?上?一次所在的位置?
cd An argument of - is equivalent to $OLDPWD.? cd - ?#cd $OLDPWD cd - #快速的回到 上?一次所在的位置? cd . ?#當前目錄 復制/移動? cd .. #進入當前?目錄的上級?目錄? cd ~ ?#進入當前?目錄的家?目錄 回?老老家? cd? ??#進?當前?目錄的家?目錄 等同于cd ~第4題?
已知apache/nginx服務的訪問?日志按天記錄在服務?本地?目錄/app/logs 下,由于磁盤空間緊張,現在要求只能保留留最近7天訪問?日志!請問如何解決? 請給出解決 辦法或配置或處理理命令。(提示:可以從apache服務配置上著手,也可以從?生成出來的日志上著手。) 模擬環境 mkdir -p /app/logs? cd /app/logs? for time in {01..15};do date -s "201806$time"; touch access_www_$(date +%F).log ;done date -s "20170520"? 1. [root@web02 logs]# find /app/logs -type f -mtime +7 |xargs ls -lrt -rw-r--r-- 1 root root 0 6月 1 00:00 /app/logs/access_www_2018-06-01.log -rw-r--r-- 1 root root 0 6月 2 00:00 /app/logs/access_www_2018-06-02.log -rw-r--r-- 1 root root 0 6月 3 00:00 /app/logs/access_www_2018-06-03.log -rw-r--r-- 1 root root 0 6月 4 00:00 /app/logs/access_www_2018-06-04.log -rw-r--r-- 1 root root 0 6月 5 00:00 /app/logs/access_www_2018-06-05.log -rw-r--r-- 1 root root 0 6月 6 00:00 /app/logs/access_www_2018-06-06.log -rw-r--r-- 1 root root 0 6月 7 00:00 /app/logs/access_www_2018-06-07.log 找出/app/logs下?面以.log結尾的并且修改時間是7天之前的?文件并刪除(ls -l)? [root@web02 logs]# find /app/logs -type f -name "*.log" -mtime +7 |xargs ls -lrt 2. [root@web02 logs]# ls -lrt $(find /app/logs -type f -name "*.log" -mtime +7) 3. [root@web02 logs]# find /app/logs -type f -name "*.log" -mtime +7 -exec ls -l {} \; 4. 通過系統軟件對?日志進?行行切割總結
以上是生活随笔為你收集整理的linux week3的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python 析构方法__del__
- 下一篇: s5-6 Linux 标准输出 系统优化