linux中与系统相关的一些命令

来源:互联网 发布:猪八戒 php模板 编辑:程序博客网 时间:2024/05/29 04:47

http://pppboy.blog.163.com/blog/static/30203796200962402221380/

 

//----------------------------------------------------------------------------------
//转载出处:http://blog.chinaunix.net/u1/38994/showart_1968463.html
//这里备忘仅供本人学习,谢谢。
//-----------------------------------------------------------------------------------

显示内核信息
luther@gliethttp:~$ uname -a

显示当前加载了的模块
luther@gliethttp:~$ lsmod

显示pc所有硬件配置信息
luther@gliethttp:~$ lshw

显示系统pci硬件信息
luther@gliethttp:~$ lspci

显示连接到usb-hub上的所有设备信息
luther@gliethttp:~$ lsusb

显示硬盘,u盘分区信息
luther@gliethttp:~$ sudo fdisk -l

显示磁盘使用情况信息
luther@gliethttp:~$ df -h
luther@gliethttp:~$ df -h / 显示根目录磁盘使用信息

显示当前文件夹占用空间情况
luther@gliethttp:~$ du -sh /vobs/dbus

显示硬盘全部信息
luther@gliethttp:~$ sudo hdparm -i /dev/sda

显示cpu信息
luther@gliethttp:~$ cat /proc/cpuinfo

显示机器信息
luther@gliethttp:~$ dmesg

显示当前内存使用信息
luther@gliethttp:~$ free -m
luther@gliethttp:~$ free -m -s 1 每隔1秒动态显示

显示该进程打开的文件
luther@gliethttp:~$ lsof -p pid

显示所有使用unix通信的程序
luther@gliethttp:~$ lsof -U

显示deb安装包包含的内容
luther@gliethttp:/var/cache/apt/archives$ dpkg -c sysstat_8.1.2-2ubuntu1_i386.deb

显示磁盘负载﹑cpu和进程pid负载信息
luther@gliethttp:~$ sudo apt-get install sysstat
luther@gliethttp:/var/cache/apt/archives$ dpkg -c sysstat_8.1.2-2ubuntu1_i386.deb
一共5个bin文件
/usr/bin/sadf
/usr/bin/iostat
/usr/bin/mpstat
/usr/bin/pidstat
/usr/bin/sar.sysstat
luther@gliethttp:~$ iostat 1 // 每1描显示一次磁盘使用情况

显示网络通信状况
luther@gliethttp:~$ netstat
luther@gliethttp:~$ netstat -n // 显示所有unix通信程序
luther@gliethttp:~$ netstat -s // 查看网络统计信息

显示所有使用ipv4和ipv6通信的程序
luther@gliethttp:~$ lsof -i

显示当前监听80号端口的程序
luther@gliethttp:~$ lsof -i :80

显示指定ip机器的MAC地址
luther@gliethttp:~$ arping 192.168.23.1

显示进程启动过程中发生的所有系统调用
luther@gliethttp:~$ strace /usr/bin/ssh 127.0.0.1

显示系统共享内存﹑共享信号量以及共享队列
luther@gliethttp:~$ ipcs
luther@gliethttp:~$ ipcs -m // 只显示共享内存
luther@gliethttp:~$ ipcs -s // 只显示共享信号量

删除系统共享内存﹑共享信号量以及共享队列
luther@gliethttp:~$ ipcrm -m mem_id // 删除mem_id对应的内存共享区
luther@gliethttp:~$ ipcrm -s sem_id // 删除sem_id对应的信号量共享区

查看系统环境变量
luther@gliethttp:~$ env

查看当前使用的字符集
luther@gliethttp:~$ locale

立即生效.bashrc等shell脚本
luther@gliethttp:~$ . .bashrc // 使用.点操作,或者使用source

前提是必须有sensors传感器
luther@gliethttp:~$ sudo su
root@gliethttp:/home/luther# apt-get install lm-sensors
luther@gliethttp:~$ sudo sensors-detect
也可以添加applet到面板
luther@gliethttp:~$ sudo apt-get install sensors-applet // 然后添加"Hardware Sensors Monitor到面板上

硬盘温度检测
luther@gliethttp:~$ sudo apt-get install hddtemp
luther@gliethttp:~$ sudo hddtemp /dev/sda
/dev/sda: ST3160815AS: 36°C

显示硬盘所有信息工具
luther@gliethttp:~$ sudo apt-get install smartmontools
luther@gliethttp:~$ sudo smartctl --all /dev/sda

AMD处理器降温软件
luther@gliethttp:~$ sudo apt-get install athcool

手工动态设置ip,dns和gateway网关
luther@gliethttp:~$ sudo vim /etc/resolv.conf
nameserver 202.106.0.20
luther@gliethttp:~$ sudo ifconfig eth0 192.168.23.23 netmask 255.255.255.0 up
luther@gliethttp:~$ sudo route add default gw 192.168.23.1 eth0
luther@gliethttp:~$ sudo service networking restart

手工静态永久设置ip,dns和gateway网关
luther@gliethttp:~$ sudo vim /etc/resolv.conf
nameserver 202.106.0.20
luther@gliethttp:~$ sudo vim /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.23.23
netmask 255.255.255.0
gateway 192.168.23.1
luther@gliethttp:~$ sudo service networking restart

//作者网站好多东西,链接下以后常看
//http://blog.chinaunix.net/u1/38994/showart.php?id=1071553

0 0
原创粉丝点击