Linux_内存查询

查询磁盘使用情况:

[root@css-management ~]# df -hl 文件系统 容量 已用 可用 已用% 挂载点 Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_cssmanagement-lv_root 24G 8.0G 15G 37% / tmpfs 3.9G 112K 3.9G 1% /dev/shm /dev/sda1 485M 37M 423M 8% /boot /dev/sdb1 99G 9.8G 84G 11% /cssdata


查询内存使用情况:

[root@css-management ~]# free -m

             total       used       free     shared    buffers     cached

Mem:          7873       6621       1251          0        176       4697

-/+ buffers/cache:       1747       6126

Swap:         6015         96       5919

查看以上 内存使用较大,需要注意

第二行(mem)的used/free与第三行(-/+ buffers/cache) used/free的区别。

这两个的区别在于使用的角度来看,第一行是从OS的角度来看,因为对于OS,buffers/cached 都是属于被使用,所以他的可用内存是8908KB,已用内存是377116KB,其中包括,内核(OS)使用+Application(X,oracle,etc)使用的+buffers+cached. 

第三行所指的是从应用程序角度来看,对于应用程序来说,buffers/cached 是等于可用的,因为buffer/cached是为了提高文件读取的性能,当应用程序需在用到内存的时候,buffer/cached会很快地被回收。

所以从应用程序的角度来说,可用内存=系统free memory+buffers+cached.



当前可用=1251  + 176 + 4697 = 6124



详见:http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=615686
备注

Mem:表示物理内存统计

-/+ buffers/cached:表示物理内存的缓存统计


top命令使用:
  可查看cpu 内存 磁盘等 大小 使用率
[root@css-management ~]# top

top - 10:28:55 up 118 days, 13:05,  2 users,  load average: 0.00, 0.00, 0.00

Tasks: 267 total,   1 running, 266 sleeping,   0 stopped,   0 zombie

Cpu(s):  0.1%us,  0.1%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Mem:   8062328k total,  6783128k used,  1279200k free,   182008k buffers

Swap:  6160376k total,    98936k used,  6061440k free,  4811328k cached



  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND

18612 root      20   0 6829m 1.1g  10m S  0.7 14.1   4:11.84 java

23063 root      20   0 15172 1380  948 R  0.7  0.0   0:00.11 top

    1 root      20   0 19348 1260 1032 S  0.0  0.0   0:16.85 init

    2 root      20   0     0    0    0 S  0.0  0.0   0:01.34 kthreadd

    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.02 migration/0

    4 root      20   0     0    0    0 S  0.0  0.0   0:00.83 ksoftirqd/0

    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0

    6 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0

    7 root      RT   0     0    0    0 S  0.0  0.0   0:01.38 migration/1

    8 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/1

    9 root      20   0     0    0    0 S  0.0  0.0   0:08.30 ksoftirqd/1

   10 root      RT   0     0    0    0 S  0.0  0.0   1:07.86 watchdog/1

   11 root      RT   0     0    0    0 S  0.0  0.0   0:00.60 migration/2

   12 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/2

   13 root      20   0     0    0    0 S  0.0  0.0   0:04.83 ksoftirqd/2

   14 root      RT   0     0    0    0 S  0.0  0.0   0:03.98 watchdog/2

   15 root      RT   0     0    0    0 S  0.0  0.0   0:00.04 migration/3

   16 root      RT   0     0    0    0 S  0.0  0.0   0:00.01 migration/3

   17 root      20   0     0    0    0 S  0.0  0.0   0:01.93 ksoftirqd/3

   18 root      RT   0     0    0    0 S  0.0  0.0   0:00.02 watchdog/3

   19 root      RT   0     0    0    0 S  0.0  0.0   0:00.03 migration/4

   20 root      RT   0     0    0    0 S  0.0  0.0   0:00.01 migration/4

   21 root      20   0     0    0    0 S  0.0  0.0   0:01.64 ksoftirqd/4

   22 root      RT   0     0    0    0 S  0.0  0.0   0:00.01 watchdog/4

   23 root      RT   0     0    0    0 S  0.0  0.0   0:02.14 migration/5

   24 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/5

   25 root      20   0     0    0    0 S  0.0  0.0   0:05.71 ksoftirqd/5

   26 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/5

   27 root      RT   0     0    0    0 S  0.0  0.0   0:00.10 migration/6

   28 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/6

   29 root      20   0     0    0    0 S  0.0  0.0   0:01.32 ksoftirqd/6

   30 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/6

   31 root      RT   0     0    0    0 S  0.0  0.0   0:00.03 migration/7

   32 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/7

   33 root      20   0     0    0    0 S  0.0  0.0   0:01.13 ksoftirqd/7

   34 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/7

   35 root      20   0     0    0    0 S  0.0  0.0   0:01.78 events/0



你可能感兴趣的:(linux)