常用linux命令

1,查看磁盘

      df -h

2,查看内存大小

      free 

      free [-m|g]按MB,GB显示内存

       vmstat

3,查看cpu

     cat /proc/cpuinfo

    只看cpu数量 grep "model name" /proc/cpuinfo | wc -l

4,查看系统内存

    cat /proc/meminfo 

5,查看每个进程的情况

  cat /proc/5346/status   5347是pid

6,查看负载

   w

   uptime

7,查看系统整体状态

   top

   最后一些输出信息的解释:

   load average: 0.090.050.01  

   三个数分别代表不同时间段的系统平均负载(一分钟、五 分钟、以及十五分钟),它们的数字当然是越小越好。“有多少核心即为有多少负荷”法则: 在多核处理中,你的系统均值不应该高于处理器核心的总数量

    进程使用的内存可以用top,有3个列 VIRT RES SHR, 标示了进程使用的内存情况, VIRT标识这个进程可以使用的内存总大小, 包括这个进程真实使用的内存, 映射过的文件, 和别的进程共享的内存等. RES标识这个这个进程真实占用内存的大小. SHR标识可以和别的进程共享的内存和库大小.

8,性能监视sar命令

     sar -u输出显示CPU信息。-u选项是sar的默认选项。该输出以百分比显示CPU的使用情况


CPU

CPU编号

%user

在用户模式中运行进程所花的时间

%nice

运行正常进程所花的时间

%system

在内核模式(系统)中运行进程所花的时间

%iowait

没有进程在该CPU上执行时,处理器等待I/O完成的时间

%idle

没有进程在该CPU上执行的时间


    sar 5 10      sar以5秒钟间隔取得10个样本

    sar -u -p ALL 5 5  分cup显示

    sar -n { DEV | EDEV | NFS | NFSD | SOCK | ALL }

    sar 提供六种不同的语法选项来显示网络信息。-n选项使用6个不同的开关:DEV | EDEV | NFS | NFSD | SOCK | ALL 。DEV显示网络接口信息,EDEV显示关于网络错误的统计数据,NFS统计活动的NFS客户端的信息,NFSD统计NFS服务器的信息,SOCK显示套接字信息,ALL显示所有5个开关。它们可以单独或者一起使用。

    sar -n DEV 各参数含义

IFACE

LAN接口

rxpck/s

每秒钟接收的数据包

txpck/s

每秒钟发送的数据包

rxbyt/s

每秒钟接收的字节数

txbyt/s

每秒钟发送的字节数

rxcmp/s

每秒钟接收的压缩数据包

txcmp/s

每秒钟发送的压缩数据包

rxmcst/s

每秒钟接收的多播数据包

9,查看命令历史(含时间戳)

export HISTTIMEFORMAT='%F %T ';history| more

10,查看文件夹和文件大小

     du -h --max-depth=0  dm 查看dm目录大小

     du -h --max-depth=1 dm 查看dm目录大小,以及dm各文件文件夹的大小

      du -h --max-depth=0  查看当前文件夹大小  

11,查找当前文件夹下所有.mp3文件,并强制删除: find ./ -name "*.mp3" | xargs rm -rf

12,后台运行程序(启动进程)

nohup /usr/local/bin/python /var/log/httpd/PythonCode/3G/3g.py >> nohup-3g.out &

13,ps命令常用参数


[plain]  view plain copy print ?
  1. ps -def  

-d Select all processes except session leaders.

[plain]  view plain copy print ?
  1. Every process group is in a unique session. (When the process is created, it becomes a member of the session of its parent.) By convention, the session ID of a session equals the process ID of the first member of the session, called the session leader. A process finds the ID of its session using the system call getsid().  
  2.   
  3. Every session may have a controlling tty, that then also is called the controlling tty of each of its member processes. A file descriptor for the controlling tty is obtained by opening /dev/tty. (And when that fails, there was no controlling tty.) Given a file descriptor for the controlling tty, one may obtain the SID using tcgetsid(fd).  
  4.   
  5. A session is often set up by a login process. The terminal on which one is logged in then becomes the controlling tty of the session. All processes that are descendants of the login process will in general be members of the session.  

进程是按照进程组管理的,进程组又属于session。关系如下:

每个session拥有一个或者多个进程组,每个进程组拥有一个或多个进程。第一个属于某个session的进程id就是这个session的 leader, session id就用它的进程id。

和进程相关的id有几种,

进程id, 父进程id, 进程组id 和 session id.

参考:http://unix.stackexchange.com/questions/18166/what-are-session-leaders-in-ps


-e 参数等同于 -A,

[plain]  view plain copy print ?
  1. -e     Select all processes.  Identical to -A.  


-f 参数 显示完整格式
[plain]  view plain copy print ?
  1. -f     Do full-format listing. This option can be combined with many other UNIX-style options to add additional columns.  It also causes the command arguments to be  
  2.               printed.  When used with -L, the NLWP (number of threads) and LWP (thread ID) columns will be added.  See the c option, the format keyword args, and the  
  3.               format keyword comm.  

不过还有个常用的方式:

ps axu

不同于ps -def 用标准风格,这是BSD风格(不用-作为引导参数), BSD风格会在另一篇博客中介绍。

-a 参数

[plain]  view plain copy print ?
  1. -a     Select all processes except both session leaders (see getsid(2)) and processes not associated with a terminal.  
-x 参数 和tty有关,tty会在另一篇文章中解释

[plain]  view plain copy print ?
  1. x      Lift the BSD-style "must have a tty" restriction, which is imposed upon the set of all processes when some BSD-style (without "-") options are used or when  
  2.               the ps personality setting is BSD-like.  The set of processes selected in this manner is in addition to the set of processes selected by other means.  An  
  3.               alternate description is that this option causes ps to list all processes owned by you (same EUID as ps), or to list all processes when used together with the  
  4.               a option.  
-u 参数

[plain]  view plain copy print ?
  1. -u userlist  
  2.               Select by effective user ID (EUID) or name.  This selects the processes whose effective user name or ID is in userlist.  
  3.   
  4.               The effective user ID describes the user whose file access permissions are used by the process (see geteuid(2)).  Identical to U and --user.  



还有一种,通过直接输入命令查找,用-C参数,比如

[plain]  view plain copy print ?
  1. $ UNIX95= ps -C nginx  
  2.   PID TTY          TIME CMD  
  3.  1258 ?        00:00:00 nginx  
  4.  1259 ?        00:00:00 nginx  
  5. CHN\shu6889@sloop2:~$ ps aux | grep nginx  
  6. root      1258  0.0  0.0  31188  1028 ?        Ss   09:24   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf  
  7. root      1259  0.0  0.0  47312  2708 ?        S    09:24   0:00 nginx: worker process                     
  8. 70780027  4336  0.0  0.0  13652   976 pts/1    S+   10:40   0:00 grep --color=auto nginx  

要注意,前面需要输入UNIX95=




内容概要:《2024年中国城市低空经济发展指数报告》由36氪研究院发布,指出低空经济作为新质生产力的代表,已成为中国经济新的增长点。报告从发展环境、资金投入、创新能力、基础支撑和发展成效五个维度构建了综合指数评价体系,评估了全国重点城市的低空经济发展状况。北京和深圳在总指数中名列前茅,分别以91.26和84.53的得分领先,展现出强大的资金投入、创新能力和基础支撑。低空经济主要涉及无人机、eVTOL(电动垂直起降飞行器)和直升机等产品,广泛应用于农业、物流、交通、应急救援等领域。政策支持、市场需求和技术进步共同推动了低空经济的快速发展,预计到2026年市场规模将突破万亿元。 适用人群:对低空经济发展感兴趣的政策制定者、投资者、企业和研究人员。 使用场景及目标:①了解低空经济的定义、分类和发展驱动力;②掌握低空经济的主要应用场景和市场规模预测;③评估各城市在低空经济发展中的表现和潜力;④为政策制定、投资决策和企业发展提供参考依据。 其他说明:报告强调了政策监管、产业生态建设和区域融合错位的重要性,提出了加强法律法规建设、人才储备和基础设施建设等建议。低空经济正加速向网络化、智能化、规模化和集聚化方向发展,各地应找准自身比较优势,实现差异化发展。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值