linux實戰命令

2021-08-23 15:09:46 字數 753 閱讀 1175

查詢/use/local下的所有檔案內容包含'who'的檔案

grep who /use/local -r

將資料夾名字按照資料夾內的內容大小排序

du --max-depth 1 -a|awk ''|sort -n

反向選擇/ 反向刪除不需要的檔案或則資料夾

ls |grep -ev '2|3'|xargs rm $1 -rf

指定一批目錄(排除某個目錄)執行cp操作

find * -type d -prune -not -name dialogbot -exec cp -r ../tmp/com '{}' ';'

在當前目錄下(包含子目錄),查詢user-center開頭的檔案所在的目錄

find . -name 'user-center*' -printf %h//n>>ulib.txt

日誌檔案的每一行的格式類似:「info: ::pollst finish,left=0,duration=46099」

awk 'begin } end' /usr/local/resin-pro-twitter/log/stdout.log

ps:awk的命令用了pattern program的時候好像就不能用begin/end了,所以採用折中的版本在begin裡寫分隔符,其實是為了定義2個全域性變數哎。。。

Linux 下磁碟實戰操作命令

linux 下磁碟實戰操作命令 企業真實場景由於硬碟常年大量讀寫,經常會出現壞盤,需要更換硬碟。或者由於磁碟空間不足,需新增新硬碟,新新增的硬碟需要經過格式化 分割槽才能被 linux 系統所使用,虛擬機器 centos6,centos 7 linux 模擬 dell r730 真實伺服器新增一塊新...

命令實戰解析

1 split 按照指定的行數或大小分隔檔案 split option input prefix l 指定行數 split l 10 etc inittab new a 指定生成檔案字尾長度 split l 10 a 4 etc inittab new2 d 使用數字字尾 split l 10 d ...

Linux實戰指令

實戰一 要求 將某資料夾及其子檔案中所有 readme.txt 的檔案找出來,統計檔案中包括name,age,base address等字段資訊。因為存在重名衝突,因此需要在抓取的過程中編號來修改其名稱 指令碼實現 bin bash count 1 for line in find name rea...