With slabtop I get the following output (50 lines):

$slabtop -sc -o
 Active / Total Objects (% used)    : 110864927 / 111473562 (99.5%)
 Active / Total Slabs (% used)      : 2826375 / 2826375 (100.0%)
 Active / Total Caches (% used)     : 83 / 121 (68.6%)
 Active / Total Size (% used)       : 48207397.02K / 48498057.95K (99.4%)
 Minimum / Average / Maximum Object : 0.01K / 0.43K / 16.00K

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
10855309 10855309 100%    1.07K 374321       29  11978272K zfs_znode_cache
10893059 10893059 100%    0.85K 294407       37   9421024K dnode_t
412694 410756  99%   16.00K 206347        2   6603104K zio_buf_16384
12502304 12290713  98%    0.50K 390697       32   6251152K kmalloc-512
12776610 12743989  99%    0.29K 232302       55   3716832K dmu_buf_impl_t
10855309 10855309 100%    0.27K 374321       29   2994568K sa_cache
370776 370718  99%    8.00K  92694        4   2966208K kmalloc-8192
3269280 3028688  92%    0.32K  66720       49   1067520K taskstats
10898853 10898853 100%    0.08K 213703       51    854812K selinux_inode_security
12161344 12148434  99%    0.06K 190021       64    760084K kmalloc-64
3257058 3255733  99%    0.19K  77549       42    620392K dentry
5577558 5519367  98%    0.09K 132799       42    531196K kmalloc-96
 92872  82421  88%    4.00K  11609        8    371488K kmalloc-4096
1962464 1953470  99%    0.12K  61327       32    245308K kmalloc-128
6021888 6021888 100%    0.03K  47046      128    188184K kmalloc-32
  8356   8346  99%   12.00K   4178        2    133696K zio_buf_12288
1026675 1026675 100%    0.10K  26325       39    105300K blkdev_ioc
7955456 7955456 100%    0.01K  15538      512     62152K kmalloc-8
 31744  23790  74%    1.00K    992       32     31744K kmalloc-1024
  2040   2008  98%   10.00K    680        3     21760K zio_buf_10240
  1332   1318  98%   14.00K    666        2     21312K zio_buf_14336
  3150   3094  98%    5.00K    525        6     16800K zio_buf_5120
  2050   1984  96%    6.00K    410        5     13120K zio_buf_6144
  6480   5958  91%    2.00K    405       16     12960K kmalloc-2048
  1596   1548  96%    7.00K    399        4     12768K zio_buf_7168
 20075  20075 100%    0.58K    365       55     11680K inode_cache
  7413   7279  98%    1.50K    353       21     11296K zio_buf_1536
 15925  15818  99%    0.64K    325       49     10400K proc_inode_cache
  3360   3252  96%    2.50K    280       12      8960K zio_buf_2560
  2660   2574  96%    3.00K    266       10      8512K zio_buf_3072
  8192   8192 100%    1.00K    256       32      8192K xfs_inode
  2295   2208  96%    3.50K    255        9      8160K zio_buf_3584
 67899  66971  98%    0.10K   1741       39      6964K buffer_head
 27008  13057  48%    0.25K    844       32      6752K kmalloc-256
 59904  59904 100%    0.11K   1664       36      6656K sysfs_dir_cache
  2156   2019  93%    2.84K    196       11      6272K task_struct
  2625   2497  95%    2.06K    175       15      5600K sighand_cache
  9072   9005  99%    0.57K    324       28      5184K radix_tree_node
  3584   3341  93%    1.12K    128       28      4096K signal_cache
 19992  18791  93%    0.19K    476       42      3808K kmalloc-192
 16095  15519  96%    0.21K    435       37      3480K vm_area_struct
124440 124440 100%    0.02K    732      170      2928K fsnotify_event_holder
  1798   1305  72%    1.09K     62       29      1984K zio_cache

But when piping to tail I only get 23 lines:

$slabtop -sc -o | tail -n+0
 Active / Total Objects (% used)    : 110863370 / 111473331 (99.5%)
 Active / Total Slabs (% used)      : 2826376 / 2826376 (100.0%)
 Active / Total Caches (% used)     : 83 / 121 (68.6%)
 Active / Total Size (% used)       : 48207346.77K / 48498099.95K (99.4%)
 Minimum / Average / Maximum Object : 0.01K / 0.43K / 16.00K

  OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
10855309 10855309 100%    1.07K 374321       29  11978272K zfs_znode_cache
10893059 10893059 100%    0.85K 294407       37   9421024K dnode_t
412694 410756  99%   16.00K 206347        2   6603104K zio_buf_16384
12502304 12290595  98%    0.50K 390697       32   6251152K kmalloc-512
12776610 12743989  99%    0.29K 232302       55   3716832K dmu_buf_impl_t
10855309 10855309 100%    0.27K 374321       29   2994568K sa_cache
370776 370718  99%    8.00K  92694        4   2966208K kmalloc-8192
3269280 3028688  92%    0.32K  66720       49   1067520K taskstats
10898853 10898853 100%    0.08K 213703       51    854812K selinux_inode_security
12161344 12148483  99%    0.06K 190021       64    760084K kmalloc-64
3257058 3255733  99%    0.19K  77549       42    620392K dentry
5577558 5519367  98%    0.09K 132799       42    531196K kmalloc-96
 92872  82417  88%    4.00K  11609        8    371488K kmalloc-4096
1962464 1953501  99%    0.12K  61327       32    245308K kmalloc-128
6021888 6021888 100%    0.03K  47046      128    188184K kmalloc-32
  8356   8346  99%   12.00K   4178        2    133696K zio_buf_12288

The same can be confirmed by piping to wc directly:

$slabtop -sc -o | tail -n+0 | wc -l
23

Where is the rest of the output?

  • 2
    Note that the number of lines of output you get depends on the size of your terminal window. – terdon Oct 20 '15 at 23:08
  • Yes, I see now that it is limiting to the height of the terminal. When piping it defaults to 23 lines. Is there a way I can override this in a pipe? – Zhro Oct 21 '15 at 10:54
up vote 1 down vote accepted

Most likely, the source program is checking if the output is a TTY, and tailoring it accordingly. If it's well-behaved, there will be an option somewhere to control this explicitly, which you can use to automatically process the full terminal output if you so desire. If not, you can use expect or similar to emulate a terminal and capture the output.

some programs behavior differently if they are interactive or not. if you pipe their output they know this. check its options to tell how many lines you want to see.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.