暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
LINUX 服务器基本信息查询.txt
免费下载
#!/bin/bash
#查看服务器 ip
ifconfig |grep -A7 'eth1' |grep 'inet addr' |awk '{print $2}'|sed 's/addr://g'
#查看服务器型号:
dmidecode |grep -A8 'System Information' |grep 'Product Name'|sed 's/^[ \t]*//'
#查看硬件编号:
dmidecode |grep -A8 'System Information' |grep 'Serial Number' |sed 's/^[
\t]*//'
#现有内存数量和容量:
dmidecode |grep -A16 'Memory Device' |grep 'Size' |grep 'MB'|sed 's/^[ \t]*//'|
uniq -c
#最大支持内存容量:
dmidecode |grep 'Maximum Capacity' |sed 's/^[ \t]*//'
#查看 CPU 类型和主频:
cat /proc/cpuinfo |grep 'model name'
#硬盘容量:
fdisk -l |grep 'Disk' |grep 'bytes'|awk '{print $2$3$4}'
1 查看物理 CPU 的个数
#cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc –l
2、 查看逻辑 CPU 的个数
#cat /proc/cpuinfo |grep "processor"|wc –l
3、 查看 CPU 是几核
#cat /proc/cpuinfo |grep "cores"|uniq
4、 查看 CPU 的主频
#cat /proc/cpuinfo |grep MHz|uniq
5# uname -a
6Linux euis1 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686
i386 GNU/Linux
(查看当前操作系统内核信息)
7# cat /etc/issue | grep Linux
8Red Hat Enterprise Linux AS release 4 (Nahant Update 5(查看当前操作系统发行版信
)
9# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
8 Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
(看到有 8 个逻辑 CPU, 也知道了 CPU 型号)
9 # cat /proc/cpuinfo | grep physical | uniq -c
4 physical id : 0
4 physical id : 1
(说明实际上是两颗 4 核的 CPU)
使用率的查询
1、查询 inode ni
find */ -exec stat -c "%n %i" {} \;|awk -F "[/ ]" '{if(! a[$1-$NF]++) l[$1]+
+}END{for (i in l) print i,l[i]}'
find */ ! -type l | cut -d / -f 1 | uniq -c
网卡插上网线
ip addr
ifconfig
2、查询进程 CPU 占用率
ps aux |awk '$3 !~ /0.0|CPU/{print}'|sort -r -k 3
ps aux | awk '$3 !~ /0.0|CPU/{print}'
查不是当前用户运行的进程
ps aux | grep -v `whoami`
查不是当前用户运行的最占用 CPU 时间的前十个程序
ps aux --sort=-%cpu |grep -m 11 -v `whoami`
3、查询进程 Mmeory 占用率
ps aux|awk '{a[$11]+=$4}END{for(i in a)print a[i],i}'|sort -n
ps aux |grep -v '^USER'|sort -r -k 4
ps aux |grep -v '^USER'|grep edw2|grep LOCAL=NO | sort -r -k 3|more
ps -ef |grep oms |awk '{print $2}' | xargs kill -9
ps -ef |grep rdc|grep LOCAL=NO |awk '{print $2}' | xargs kill -9
4、查找 21 天前的文件,并删除
find /tmp -type f -name "*.trc" -mtime +21| xargs rm -f
find /BOCC_BACKUP -type f -name "backup_log*" -mtime +30|xargs rm -f
5How to use date
CST = China Standard Time /etc/sysconfige/clock
ZONE="Asia/Shanghai"
date -s "12:12:12 2004-04-07"
date -s 12:12:12
date -s 20040407
获取前一天日期:
date -d yesterday
date -d yesterday +%Y%m%d
date -d '3 days ago'
date -d tomorrow
date -d '3 days'
卸载文件系统
Kill the process on nfs file system
df |grep home |awk’{print “fuser -ck “ $5}’
If right then execute the output
Umount file system
df |grep home |awk’{print “umount “ $5}’
If right then execute the output
++++++++++++华丽的分界线+++++++++++++++++
修改主机名称
通过配置文件/etc/sysconfig/network 修改。
--------------------------------------------------------
# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
How to set auto startup service
suse 中没有 rc.local 如何在开机时启动某个服务?
1./etc/init.d 目录下创建一个脚本文件, haha.sh
(内容为:
#!/bin/sh
ping -c 30 192.168.0.1 &
)
注意:#!/bin/sh 一定要有. 如果要执行的命令不在/bin ,则需要写全路径,或者设置 PATH.
2.chmod +x haha.sh
3.cd /etc/init.d/rc3.d
of 9
免费下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜