Skip to content

Instantly share code, notes, and snippets.

@hewumars
Last active December 10, 2020 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hewumars/eda47f8b0832ce1be0e72b988f4a9ae2 to your computer and use it in GitHub Desktop.
Save hewumars/eda47f8b0832ce1be0e72b988f4a9ae2 to your computer and use it in GitHub Desktop.
  1. 获取PID进程的内存信息 pmap -x ${pid} | sed 's/[//;s/]//' | grep rw | awk '{total[$7]+=$2}END{for(v in total){print total[v],v}}' | sort -n
  2. 查看进程内存 cat /proc/${pid}/status
  3. 系统内存信息 cat /proc/meminfo
  4. ffmpeg -i test.mp4 -vcodec h264 -bf 0 -g 25 -r 10 -s 1280*720 -an -f h264 test1.264 //-bf B帧数目控制,-g 关键帧间隔控制, -s 分辨率控制 -an关闭音频,-r 指定帧率
  5. gcc编译器预定义宏 gcc -dM -E -x c /dev/null
  6. 查看程序编译器版本 objdump -s --section=.comment your_program
  7. 写硬盘速度 time dd if=/dev/zero of=/tmp/test bs=8k count=1000000
  8. 读硬盘速度 time dd if=/tmp/test of=/dev/null bs=8k
  9. 读写ddr速度 -n 10表示运行10次,256表示测试所用的内存大小,单位为MB apt-get install mbw mbw -q -n 10 256
  10. 新建用户及用户管理 进入root权限:su adduser 用户名 密码 visudo 添加用户权限 限制用户sudo下使用下面的命令:其中data是用户名,加!的命令无法使用 %data ALL=/usr/sbin/,/sbin/,/usr/bin/*,!/bin/chmod,!/bin/chown,!/usr/bin/passwd,!/usr/sbin/visudo,!/usr/sbin/useradd,!/usr/sbin/user$
  11. 查找图片并拷贝到新的目录 find ../20180925_datasets/ -name '*.jpg' -exec cp {} ./20190501_datasets/ ;
  12. 安装rpm包 rpm -ivh **.rpm
  13. 提取rpm包中的文件 rpm2cpio **.rpm | cpio -idmv
  14. 终端保活设置:1.终端设置keep action,2.命令行TMOUT=0
  15. 查看详细软硬件信息 dmidecode
  16. 临时关闭selinux,重启失效 setenforce 0
  17. 通过“perf top -g -p pid”命令查看一下调用栈
  18. 用linux ps查询进程的开始时间\持续时间 ps -eo pid,lstart,etime | grep ${PID}
  19. 同步合并文件夹 rsync -av ${src} ${dst}
  20. windows到Linux拷贝中文文件时出现文件名乱码解决方法,转成utf-8格式 sudo apt-get install convmv convmv -r -f GBK -t UTF-8 --notest * 另外再代码里面可用#include"iconv.h"来进行转码。转成和.cpp和.h编译时使用的编码方式,字符就能对上。
  21. cp替代 alias cp="rsync -avh --progress"
  22. 查看libc/libc++库的版本 strings "/lib/libc.so.6" | grep LIBC
  23. 查看elf文件需要的库的版本 readelf -s lib/exe | grep -oP "GLIBC_[\d.]*" | sort | uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment