您现在的位置是:首页 > Linux OSLinux OS

常用的命令

2021-11-17【Linux OS】人已围观

简介常用的命令

[root@10-20-30-134 ~]# lspci | grep Solarflare

37:00.0 Ethernet controller: Solarflare Communications XtremeScale SFC9250 10/25/40/50/100G Ethernet Controller (rev 01)

37:00.1 Ethernet controller: Solarflare Communications XtremeScale SFC9250 10/25/40/50/100G Ethernet Controller (rev 01)

[root@10-20-30-134 ~]#

[root@10-20-30-134 ~]#

[root@10-20-30-134 ~]# lspci -s 37:00.0 -vv

37:00.0 Ethernet controller: Solarflare Communications XtremeScale SFC9250 10/25/40/50/100G Ethernet Controller (rev 01)

        Subsystem: Solarflare Communications XtremeScale X2522-25G Network Adapter

        Physical Slot: 2

        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx+

        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

        Latency: 0, Cache Line Size: 64 bytes

        Interrupt: pin A routed to IRQ 30

        NUMA node: 0

        Region 0: Memory at e3000000 (64-bit, non-prefetchable) [size=8M]

        Region 2: Memory at e3804000 (64-bit, non-prefetchable) [size=16K]





tcpdump抓包

tcpdump tcp port 80 -s 0 -w /tmp/222.pcap


监控某一个核上的任务

watch -n 1 "ps -eLF | grep \" 7 \""



进程切换情况

[yugq@hs-10-20-30-133 tcp]$ pidstat -wt 1 -p 16408

Linux 3.10.0-957.el7.x86_64 (hs-10-20-30-133)   12/15/2021      _x86_64_        (16 CPU)


01:17:58 PM   UID      TGID       TID   cswch/s nvcswch/s  Command

01:17:59 PM  1006     16408         -      0.00      3.00  udp_client

01:17:59 PM  1006         -     16408      0.00      3.00  |__udp_client



查看网卡驱动信息

ethtool -i  eno1


查看网卡收包信息

netstat -ni


linux在目录查找所有文件包含字符串

grep -r --include="*.php" newstext .


进程下各thread的cpu占用情况

ps  -eLo pid,lwp,pcpu | grep 30222


查看线程bind在哪个core上

 ps -eLF | grep 62362


绑定进程所有线程到一个core上

ps -eLf | grep 47804 | grep -v grep | awk {'print "taskset -pc 3 "$4'} > t.sh

sh t.sh



windows 查看tcp连接

netstat -ano -p tcp|findstr 19099


指定cpu运行

taskset -c 1 ./redis-server 


进程所有thread绑定在一个core上

ps -eLf | grep 47804 | grep -v grep | awk {'print "taskset -pc 3 "$4'} > t.sh


跟踪syscall

strace -o output.txt -T -tt -e trace=all -p 28979


统计syscall


[yugq@hs-10-20-30-132 log]$ strace -c -p 13686
strace: Process 13686 attached
^Cstrace: Process 13686 detached
% time  seconds   usecs/call  calls   errors   syscall
------ ----------- ----------- --------- --------- ----------------
 98.26 0.013926     1     11259         mprotect
 1.68  0.000238    2     121    31      futex
 0.04  0.000006    2     3           mmap
 0.01  0.000002    1     2           munmap
------ ----------- ----------- --------- --------- ----------------
100.00  0.014172          11385   31     total
[yugq@hs-10-20-30-132 log]$



mysqldump -uUser -pPassword   dbname > mysql.sql

tar -zcvf  123.tar.gz  data/


网卡延迟发送

tc qdisc add dev eno8 root netem delay 20ms

tc qdisc del dev eno8 root

Tags:

很赞哦! ()

文章评论

    共有条评论来说两句吧...

    用户名:

    验证码:

本站推荐

站点信息

  • 建站时间:2021-06-18
  • 网站主题:编程技术博客
  • 文章统计50篇文章
  • 标签管理标签云
  • 博主微信号:比目鱼