LSX-blog

Feed Rss

【收录】Linux系统信息查看命令大全

06.23.2011, Linux, by .

系统
# 查看内核/操作系统/CPU信息
# uname -a
#cat /proc/version
# 查看Linux版本
# lsb_release -a
# cat /etc/issue
# cat /etc/*release*

# cat /proc/cpuinfo # 查看CPU信息
# hostname # 查看计算机名
# lspci -tv # 列出所有PCI设备
# lsusb -tv # 列出所有USB设备
# lsmod # 列出加载的内核模块
# env # 查看环境变量

资源

# free -m                       # 查看内存使用量和交换区使用量
# df -h                         # 查看各分区使用情况
# du -sh <目录名>                # 查看指定目录的大小
# grep MemTotal /proc/meminfo   # 查看内存总量
# grep MemFree /proc/meminfo    # 查看空闲内存量
# uptime                        # 查看系统运行时间、用户数、负载
# cat /proc/loadavg             # 查看系统负载

磁盘和分区

# mount | column -t      # 查看挂接的分区状态
# fdisk -l               # 查看所有分区
# swapon -s              # 查看所有交换分区
# hdparm -i /dev/hda     # 查看磁盘参数(仅适用于IDE设备)
# dmesg | grep IDE       # 查看启动时IDE设备检测状况

网络

# ifconfig               # 查看所有网络接口的属性
# iptables -L            # 查看防火墙设置
# route -n               # 查看路由表
# netstat -lntp          # 查看所有监听端口
# netstat -antp          # 查看所有已经建立的连接
# netstat -s             # 查看网络统计信息
查看所有80端口的连接数

netstat -nat|grep -i “80″|wc -l

对连接的IP按连接数量进行排序

netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

查看TCP连接状态

netstat -nat |awk ‘{print $6}’|sort|uniq -c|sort -rn
netstat -n | awk ‘/^tcp/ {++S[$NF]};END {for(a in S) print a, S[a]}’
netstat -n | awk ‘/^tcp/ {++state[$NF]}; END {for(key in state) print key,”\t”,state[key]}’
netstat -n | awk ‘/^tcp/ {++arr[$NF]};END {for(k in arr) print k,”\t”,arr[k]}’
netstat -n |awk ‘/^tcp/ {print $NF}’|sort|uniq -c|sort -rn
netstat -ant | awk ‘{print $NF}’ | grep -v ‘[a-z]‘ | sort | uniq -c

查看80端口连接数最多的20个IP

netstat -anlp|grep 80|grep tcp|awk ‘{print $5}’|awk -F: ‘{print $1}’|sort|uniq -c|sort -nr|head -n20
netstat -ant |awk ‘/:80/{split($5,ip,”:”);++A[ip[1]]}END{for(i in A) print A,i}’ |sort -rn|head -n20

用tcpdump嗅探80端口的访问看看谁最高

tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F”.” ‘{print $1″.”$2″.”$3″.”$4}’ | sort | uniq -c | sort -nr |head -20

查找较多time_wait连接

netstat -n|grep TIME_WAIT|awk ‘{print $5}’|sort|uniq -c|sort -rn|head -n20

查找较多的SYN连接

netstat -an | grep SYN | awk ‘{print $5}’ | awk -F: ‘{print $1}’ | sort | uniq -c | sort -nr | more

进程

# ps -ef                 # 查看所有进程
# top                    # 实时显示进程状态

用户

# w                         # 查看活动用户
# id <用户名>                # 查看指定用户信息
# last                      # 查看用户登录日志
# cut -d: -f1 /etc/passwd   # 查看系统所有用户
# cut -d: -f1 /etc/group    # 查看系统所有组
# crontab -l                # 查看当前用户的计划任务

服务

# chkconfig --list              # 列出所有系统服务
# chkconfig --list | grep on    # 列出所有启动的系统服务

程序

# rpm -qa                # 查看所有安装的软件包

【收录】Linux系统信息查看命令大全 有 71 条回应

  1. Article writing is also a excitement, if you be familiar with after that you can write if not it
    is difficult to write.

    回复
  2. Great, thanks for sharing this post.Thanks Again. Cool.

    回复
  3. I was recommended this website by way of my cousin. I am now not sure whether this submit is written by means
    of him as nobody else recognize such distinctive
    approximately my trouble. You’re amazing! Thanks!

    回复
  4. Pretty element of content. I just stumbled upon your web site and in accession capital to claim that I get actually loved account your blog posts.
    Anyway I’ll be subscribing for your augment and even I
    success you access constantly quickly.

    回复
  5. Hey! Would you mind if I share your blog with my zynga group?
    There’s a lot of people that I think would really appreciate your content.
    Please let me know. Many thanks

    回复
  6. Hey I am so thrilled I found your blog, I really found you by
    accident, while I was browsing on Digg for something else,
    Anyways I am here now and would just like to say kudos for a remarkable post and a all round entertaining blog (I also love the
    theme/design), I don’t have time to read through it all at the moment but I have book-marked it and
    also added your RSS feeds, so when I have time I will be back to read more, Please do keep up the superb
    work.

    回复
  7. I think this is among the most vital information for
    me. And i’m glad reading your article. But should remark
    on some general things, The website style is great, the articles is really nice :
    D. Good job, cheers

    回复
  8. I like the helpful information you provide in your articles.
    I’ll bookmark your blog and check again here regularly. I am quite sure I will learn many new stuff right here!
    Good luck for the next!

    回复
  9. Hi to every one, the contents existing at this web site
    are in fact remarkable for people experience, well,
    keep up the good work fellows.

    回复
  10. Terrific work! This is the type of information that are meant
    to be shared across the internet. Shame on the search engines for not positioning this submit higher!
    Come on over and talk over with my website . Thank you =)

    回复
  11. bookmarked!!, I like your site!

    回复
  12. Wonderful article! We will be linking to this great article on our website.
    Keep up the great writing.

    回复
  13. It’s appropriate time to make a few plans for the future and it’s time to be happy.
    I’ve learn this put up and if I may I desire to suggest you
    few fascinating issues or suggestions. Perhaps you could write subsequent articles relating to
    this article. I want to read more things about it!

    回复
  14. I was suggested this blog via my cousin. I am not sure whether this put up is written via him as
    no one else recognize such detailed approximately my problem.
    You are incredible! Thanks!

    回复
  15. Write more, thats all I have to say. Literally, it seems as
    though you relied on the video to make your point.
    You clearly know what youre talking about, why throw away your intelligence on just posting videos to your
    site when you could be giving us something enlightening to read?

    回复
  16. Hey just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading correctly.

    I’m not sure why but I think its a linking issue. I’ve tried it in two different
    web browsers and both show the same results.

    回复
  17. My brother recommended I would possibly like this web site.
    He used to be totally right. This publish truly made my day.
    You cann’t consider just how so much time I had spent
    for this info! Thanks!

    回复
  18. I think what you said made a bunch of sense. However, think on this, suppose you composed a catchier title?
    I mean, I don’t want to tell you how to run your blog, however what if you added a title to possibly get a person’s attention? I mean 【收录】Linux系统信息查看命令大全 –
    LSX-blog is a little vanilla. You might glance at
    Yahoo’s front page and note how they create post
    headlines to grab viewers to click. You might try adding a video or a pic
    or two to grab readers excited about everything’ve written. Just my opinion, it could make your
    posts a little bit more interesting.

    回复
  19. Great article.

    回复
  20. We are a gaggle of volunteers and opening a new scheme in our
    community. Your site offered us with useful information to work on. You’ve
    performed an impressive job and our whole group shall be thankful to you.

    回复
  21. Hi there, I enjoy reading all of your article post.
    I like to write a little comment to support you.

    回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注