linux 常用命令整理

2021-08-07 22:03:55 字數 1684 閱讀 8344

scp -l ***x
***x代表kb數,比如2000代表 2000/8=250k/s

2.使用tc對伺服器流量進行控制

tc qd add dev eth1 root handle 1: tbf rate 256kbit burst 10000 latency 50ms 

速率 256kbit 突發傳輸 10k 最大延遲 50ms

#tc -s qd sh dev eth1 統計

#tc qd del dev eth1 root 刪除

3.抓包

tcpdump -i eth1 tcp port 6040

-c10000

-vv-s

0-w catch.pcap

如果要根據包大小來抓包(主要是過濾大量握手或負載均衡檢查包)可以使用 port ***x and greater nnn (nnn建議200)

或者直接在控制台列印:

tcpdump -i eth1 src host ***.***

.***

.***

or dst host ***.***

.***

.*** -x

tcpdump -i em1 tcp port 4400

and \(\(dst host ***.***

.***

.***

and ! ***.***

.***

.***\) or \(src host ***.***

.***

.***

and ! ***.***

.***

.***\)\) and greater 100 -x -a

tcpdump -i enp4s0 tcp port 4400

and \(dst host xx or src host ***.***

.***

.***\) and greater 150 -a -q

tcpdump -i em2 tcp port 4405

and host ***.***

.***

.*** -a -p

tcpdump -i em1 tcp port 4400

and host ***.***

.***

.***

and greater 150 -a -q

4.立即生效hosts

rcnscd restart
5.檢視cpu占用情況

top -p pid -d secs
eg: 每隔兩秒檢測pid 8888:top -p 8888 -d 2

6.找出占用空間最大的前10個檔案或目錄

du -cks

*| sort -rn

| head -n

10

7.檢視某字串所在的檔案

grep -rrln "success-send"
8.刪除指定日期前的檔案

find log

/-mtime+3

-exec rm -rf {} \;

Linux 常用命令整理

在linux 下開發兩年了,目前轉向windows平台開發。將一些在linux 下經常會用到的命令進行整理,以免長時間不用忘了。1.使用ldd命令檢視hello依賴於哪些庫 ldd hello libc.so.6 lib libc.so.6 0x400la000 lib ld linux.so.2 ...

linux常用命令整理

cd change dictionary chmod change mode grep find 當前目錄 上層目錄 rmdir remove dictionary rm remove cp copy touch 建立新檔案,該檔案在os重啟後消失,檔案時暫時的 cat more 只能下拉,不能上拉...

linux 常用命令 整理

mount 命令 grep 最常用的就是過濾需要的內容,但有時候想過濾自己不需要的內容可以用 v 選項 比如說用 xargs grep contenta 過濾得到了很多內容,但是也有很多是自己不需要的 不需要的包含了contentb 可以再加個管道把 contentb 去掉 xargs grep c...