Linux shell几个比较有用的命令,测试系统性能和软件运行状况

https://blog.51cto.com/rachy/1888949

一、查看CPU的一些信息

cat /proc/cpuinfo 

processor : 0
model name : ARMv8 Processor rev 1 (v8l)
BogoMIPS : 62.50
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp uscat ilrcpc flagm
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd42
CPU revision : 1

processor : 1
model name : ARMv8 Processor rev 1 (v8l)
BogoMIPS : 62.50
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp uscat ilrcpc flagm
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd42
CPU revision : 1

1、看当前Linux系统有几颗物理CPU

cat /proc/cpuinfo|grep -c 'physical id'

4
2、看当前Linux系统每颗CPU的核数

cat /proc/cpuinfo|grep -c 'processor'

4
二、 查看系统运行进程的情况

vmstat

procs -----------memory---------- —swap-- -----io---- --system-- -----cpu-----

r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 1783964 13172 106056 0 0 29 7 15 11 0 0 99 0 0

r 即running,表示正在跑的任务数
b 即blocked,表示被阻塞的任务数
si 表示有多少数据从交换分区读入内存
so 表示有多少数据从内存写入交换分区
bi 表示有多少数据从磁盘读入内存
bo 表示有多少数据从内存写入磁盘

三、查看系统资源占用情况,可以知道cpu使用率,内存使用情况
1、

top

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

301 root 20 0 0 0 0 S 0.3 0.0 0:00.08 jbd2/sda3-8
1 root 20 0 2900 1428 1216 S 0.0 0.1 0:01.28 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0

VIRT 虚拟内存用量
RES 物理内存用量
SHR 共享内存用量

2、

free

total used free shared buff/cache available
Mem: 29519088 644420 28441736 17472 432932 28504328
Swap: 0 0 0

四、查看当前系统都有哪些进程

ps -aux 或者ps -elf

1、
ps -aux

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

root 1 0.0 0.0 2900 1428 ? Ss 10:43 0:01 /sbin/init
root 2 0.0 0.0 0 0 ? S 10:43 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 10:43 0:00 [migration/0]
root 4 0.0 0.0 0 0 ? S 10:43 0:00 [ksoftirqd/0]

2、
ps -elf

F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD

4 S root 1 0 0 80 0 - 725 - 10:43 ? 00:00:01 /sbin/init
1 S root 2 0 0 80 0 - 0 - 10:43 ? 00:00:00 [kthreadd]
1 S root 3 2 0 -40 - - 0 - 10:43 ? 00:00:00 [migration/0]
1 S root 4 2 0 80 0 - 0 - 10:43 ? 00:00:00 [ksoftirqd/0]
1 S root 5 2 0 -40 - - 0 - 10:43 ? 00:00:00 [migration/0]

ps 查看系统进程时,有一列为STAT, S表示正在休眠;s表示主进程;Z表示僵尸进程。

六、查看文件系统,挂载,分区情况

df -h

Filesystem Size Used Avail Use% Mounted on
/dev/vblkdev0p1 11G 6.3G 3.9G 63% /
none 14G 0 14G 0% /dev
tmpfs 15G 7.8M 15G 1% /dev/shm
tmpfs 2.9G 7.7M 2.9G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 15G 0 15G 0% /sys/fs/cgroup
/dev/vblkdev5 1008M 84K 940M 1% /svp

六、查看终端命令记录

history

可以看到以往输入的记录
make all
ls
cat Makefile
echo ${FLASH_PYTHON}
history
ls
make flash_bsp
grep -rn “B_kernel” ./
cd …
ls

六、对比两个文件夹文件差异,类似beyond compare

要先安装此应用命令,sudo apt-get install meld

安装完,meld filename1 filename2

对比差异

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值