一.查看内存信息

可以使用free命令显示系统的物理内存和交换分区的总量,以及已使用的、空闲的、共享的、在内核缓冲内的和被缓存的内存数量。

使用free命令可以显示计算机系统的内存容量。

[root@redhat2 ~]# free --help

free: invalid option -- '-'

usage: free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay] [-c count] [-V]

-b,-k,-m,-g show output in bytes, KB, MB, or GB

-l show detailed low and high memory statistics

-o use old format (no -/+buffers/cache line)

-t display total for RAM + swap

-s update every [delay] seconds

-c update [count] times

-V display version information and exit

[root@redhat2 ~]#

例1:查看系统的物理内存和交换分区的总量。

[root@redhat2 ~]# free

total       used       free     shared    buffers     cached

Mem:       1592280     368792    1223488          0      51824     122532

-/+ buffers/cache:     194436    1397844

Swap:      3211256          0    3211256

[root@redhat2 ~]#

例2:以MB为单位查看系统的物理内存和交换分区的总量。

[root@redhat2 ~]# free -m

total       used       free     shared    buffers     cached

Mem:          1554        360       1194          0         50        119

-/+ buffers/cache:        189       1365

Swap:         3135          0       3135

[root@redhat2 ~]#

例3:显示物理内存和交换分区的总和。

[root@redhat2 ~]# free -t

total       used       free     shared    buffers     cached

Mem:       1592280     368792    1223488          0      51880     122532

-/+ buffers/cache:     194380    1397900

Swap:      3211256          0    3211256

Total:     4803536     368792    4434744

二.查看磁盘空间占用情况

使用df命令可以显示磁盘的相关信息。检查文件系统的磁盘空间占用情况,利用该命令获取硬盘占用了多少空间、目前还剩下多少空间等相关信息。

[root@redhat2 ~]# df --help

Usage: df [OPTION]... [FILE]...

Show information about the file system on which each FILE resides,

or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.

-a, --all             include dummy file systems

-B, --block-size=SIZE  use SIZE-byte blocks

--direct          show statistics for a file instead of mount point

--total           produce a grand total

-h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)

-H, --si              likewise, but use powers of 1000 not 1024

-i, --inodes          list inode information instead of block usage

-k                    like --block-size=1K

-l, --local           limit listing to local file systems

--no-sync         do not invoke sync before getting usage info (default)

-P, --portability     use the POSIX output format

--sync            invoke sync before getting usage info

-t, --type=TYPE       limit listing to file systems of type TYPE

-T, --print-type      print file system type

-x, --exclude-type=TYPE   limit listing to file systems not of type TYPE

-v                    (ignored)

--help     display this help and exit

--version  output version information and exit

例1:显示系统的磁盘空间使用量。

[root@redhat2 ~]# df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda3             27499388   6662112  19440388  26% /

tmpfs                   796140        88    796052   1% /dev/shm

/dev/sda1               297485     33069    249056  12% /boot

[root@redhat2 ~]#

例2:以MB或GB为单位显示系统的磁盘空间使用量。

[root@redhat2 ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda3              27G  6.4G   19G  26% /

tmpfs                 778M   88K  778M   1% /dev/shm

/dev/sda1             291M   33M  244M  12% /boot

[root@redhat2 ~]#

例3:显示ext4文件系统类型磁盘空间使用量。

[root@redhat2 ~]# df -t ext4

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda3             27499388   6662112  19440388  26% /

/dev/sda1               297485     33069    249056  12% /boot

[root@redhat2 ~]#

例4:以MB或GB为单位显示磁盘空间使用量时也显示文件系统类型。

[root@redhat2 ~]# df -hT

Filesystem    Type    Size  Used Avail Use% Mounted on

/dev/sda3     ext4     27G  6.4G   19G  26% /

tmpfs        tmpfs    778M   88K  778M   1% /dev/shm

/dev/sda1     ext4    291M   33M  244M  12% /boot

[root@redhat2 ~]#

例5:显示磁盘空间i节点使用情况。

[root@redhat2 ~]# df -i

Filesystem            Inodes   IUsed   IFree IUse% Mounted on

/dev/sda3            1746240  107517 1638723    7% /

tmpfs                 199035       3  199032    1% /dev/shm

/dev/sda1              76912      39   76873    1% /boot

[root@redhat2 ~]#

三.显示目录或文件的大小

使用du命令可以显示目录或文件的大小。

[root@redhat2 ~]# du --help

Usage: du [OPTION]... [FILE]...

or:  du [OPTION]... --files0-from=F

Summarize disk usage of each FILE, recursively for directories.

Mandatory arguments to long options are mandatory for short options too.

-a, --all             write counts for all files, not just directories

--apparent-size   print apparent sizes, rather than disk usage; although

the apparent size is usually smaller, it may be

larger due to holes in (`sparse') files, internal

fragmentation, indirect blocks, and the like

-B, --block-size=SIZE  use SIZE-byte blocks

-b, --bytes           equivalent to `--apparent-size --block-size=1'

-c, --total           produce a grand total

-D, --dereference-args  dereference only symlinks that are listed on the

command line

--files0-from=F   summarize disk usage of the NUL-terminated file

names specified in file F;

If F is - then read names from standard input

-H                    equivalent to --dereference-args (-D)

-h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)

--si              like -h, but use powers of 1000 not 1024

-k                    like --block-size=1K

-l, --count-links     count sizes many times if hard linked

-m                    like --block-size=1M

-L, --dereference     dereference all symbolic links

-P, --no-dereference  don't follow any symbolic links (this is the default)

-0, --null            end each output line with 0 byte rather than newline

-S, --separate-dirs   do not include size of subdirectories

-s, --summarize       display only a total for each argument

-x, --one-file-system    skip directories on different file systems

例1:显示文件/root/a.sh的大小。

[root@redhat2 ~]# du /root/a.sh

4       /root/a.sh

[root@redhat2 ~]#

[root@redhat2 ~]# du -h a.sh

4.0K    a.sh

[root@redhat2 ~]#

linux 查看系统信息的更多相关文章

  1. [转]linux 查看系统信息命令

    linux 查看系统信息命令是linux初学者必备的基础知识, 这些命令也非常有用, 因为进入linux第一件事就可能是首先查看系统信息, 因此必要的系统的学习一下这些linux系统信息命令还是非常有 ...

  2. linux查看系统信息命令

    本文转载自江一<linux查看系统信息命令> # uname -a # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue # 查看操作系统版本 # cat /p ...

  3. linux 查看系统信息命令(比较全)

    linux 查看系统信息命令是linux初学者必备的基础知识, 这些命令也非常有用, 因为进入linux第一件事就可能是首先查看系统信息, 因此必要的系统的学习一下这些linux系统信息命令还是非常有 ...

  4. linux 查看系统信息命令

    linux 查看系统信息命令是linux初学者必备的基础知识, 这些命令也非常有用, 因为进入linux第一件事就可能是首先查看系统信息, 因此必要的系统的学习一下这些linux系统信息命令还是非常有 ...

  5. Linux查看系统信息(CentOS 7中测试通过)

    以下命令运载CentOS7中测试通过 Linux查看服务器系统信息 CentOS版本 [root@blog ~]# cat /etc/os-release NAME="CentOS Linu ...

  6. Linux查看系统信息及系统性能检测命令

    查看系统信息: ~# uname -a (Linux查看版本当前操作系统内核信息)Linux iZ23onhpqvwZ 3.13.0-30-generic #54-Ubuntu SMP Mon Jun ...

  7. 【linux】 linux 查看系统信息

    1.输入"uname -a ",可显示电脑以及操作系统的相关信息. 2.输入"cat /proc/version",说明正在运行的内核版本. 3.输入" ...

  8. Linux查看系统信息的一些命令及查看已安装软件包的命令

    转自:http://cheneyph.iteye.com/blog/824746 系统 # uname -a # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue # 查看 ...

  9. Linux查看系统信息

    系统 # uname -a # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue # 查看操作系统版本 # cat /proc/cpuinfo # 查看CPU信息 # ho ...

  10. Linux查看系统信息的命令及已安装软件包的命令

    系统 uname -a查看内核/操作系统/CPU信息head -n 1 /etc/issue查看操作系统版本cat /proc/cpuinfo查看CPU信息hostname查看计算机名lspci -t ...

随机推荐

  1. ubantu svn 安装、卸载、配置hooks

    1.安装之前先看是否已经安装了 svn -version 若已经安装会有以下提示,若没有安装,进行下一步 若想卸载了执行命令 ( sudo apt-get remove --purge subvers ...

  2. Strategy - 策略模式

    策略模式: 定义了算法族,分别封装起来,让它们之间可以互相替换,此模式让算法的变化独立于使用算法的客户.public interface FlyBehavior { public void fly() ...

  3. Java中的接口

    1.接口概念 <1>接口可以理解一种特殊的类,由全局常量和公共的抽象方法所组成 <2>类是一种具体实现体,而接口定义了某一批类所需要遵守的规范,接口不必关心这些类的内部数据,也 ...

  4. reactjs

    摘自阮一峰博客:http://www.ruanyifeng.com/blog/2015/03/react.html 现在最热门的前端框架,毫无疑问是 React . 上周,基于 React 的 Rea ...

  5. 深度|OpenAI 首批研究成果聚焦无监督学习,生成模型如何高效的理解世界(附论文)

    本文经机器之心(微信公众号:almosthuman2014)授权转载,禁止二次转载,原文. 选自 Open AI 作者:ANDREJ KARPATHY, PIETER ABBEEL, GREG BRO ...

  6. 安装第三方Python模块,增加InfoPi的健壮性

    这3个第三方Python模块是可选的,不安装的话InfoPi也可以运行. 但是如果安装了,会增加InfoPi的健壮性. 目录 1.cchardet    自动检测文本编码 2.lxml    用于解析 ...

  7. 有关vue的总结

    1:使用v-for进行循环渲染: <div v-for="(value, key, index) in object"> {{ index }}. {{ key }} ...

  8. 模拟discuz发帖的类实现

    一直想弄个discuz的数据采集程序,这2天研究了下discuz发帖涉及的几个数据库表,这里分享一下自己的处理方法. discuz发表主题设计的几个表:(这里列出了主要的几个相关的表) 1.主题表 p ...

  9. AngularJs之$scope对象(作用域)

      一.作用域 AngularJs中的$scope对象是模板的域模型,也称为作用域实例.通过为其属性赋值,可以传递数据给模板渲染. 每个$scope都是Scope类的实例,Scope类有很多方法,用于 ...

  10. Android 贝塞尔曲线库

    最近做的一个小项目需要绘制一些折线图,AChartEngine其实里面包含很多图,虽然是开源的,但毕竟不是自己写的,而且项目稍有点庞大,有些东西修改起来还是得花点时间的,所以最后打算自己写一个,参考了 ...