linux 命令笔记

查看当前进程打开的进程数:

lsof -n -p 【process id】|wc -l

 

查看当前进程的限制

cat /proc/【process id】/limits
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            ms        
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             2048                 2048                 processes 
Max open files            1024                 1024                 files     
Max locked memory         32768                32768                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       2048                 2048                 signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0
 
  
 
  
------------------------------------------ 检查网络连接信息 ------------------------------------------
检查网络连接信息:
netstat -tano | awk '{print $6}' | sort | uniq -c
ss -s
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'


------------------------------------------ 检查进程所关联的进程信息 ------------------------------------------
检查进程所关联的进程信息:
lsof -n -p PROCESS_ID | wc -l
cat /proc/PROCESS_ID/limits


kmemsize is one of the (many) memory parameters in a virtuozzo vps. Please post the output of this command:
cat /proc/user_beancounters


1、查看apache当前并发访问数:
  netstat -an | grep ESTABLISHED | wc -l


2、查看有多少个进程数:
  ps aux | grep httpd | wc -l


3、可以使用如下参数查看数据
    ps -ef | grep httpd | wc -l
    
------------------------------------------ mrtg ------------------------------------------
/usr/local/mrtg/cfgmaker public@localhost > /etc/mrtg/mrtg.cfg 
indexmaker /etc/mrtg/mrtg.cfg --output=/app/web/_ipub_/diag/mrtg/index.htm --title="MRTG monitor"     
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg


------------------------------------------ 使用文件创建swap分区 ------------------------------------------
二、使用文件创建swap分区
bs  blocksize ,每个块大小为1k.count=2048000。则总大小为2G的文件。
dd if=/dev/zero of=/swapfile bs=1k count=2048000
mkswap /swapfile
swapon /swapfile
修改/etc/fstab使其启动时自动mount:
在/etc/fstab中增加如下语句:
/swapfile  swap  swap    defaults 0 0


------------------------------------------ 查询 Httpd 的主进程 id 号 ------------------------------------------
方法一: ps -ef | grep httpd | grep apache | head -n 1 | awk '{print $3}'
方法二: cat /var/run/httpd.pid
lsof -n -p PROCESS_ID


------------------------------------------ 查询 Httpd 的消耗的内存多少 ------------------------------------------
ps -C httpd -O rss | gawk '{ count ++; sum += $2 }; END {count --; print "Number of processes =",count; print "Memory usage per process =",sum/1024/count, "MB"; print "Total memory usage =", sum/1024, "MB" ;};'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值