Spruce Up tools to view amount of Free Memory and Disk Usage

Spruce Up tools to view amount of Free Memory and Disk Usage

URLs:

https://puppylinux-or-pcbsd.blogspot.com/   Here is my source list of Free Memory Tools

Tools to check Free Memory available and How much SWAP memory is used

Use a perl shell script made for BSDs:

You can use this script.

# fetch http://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt
# mv freebsd-memory.pl.txt /usr/local/bin/free
# chmod +x /usr/local/bin/free
# perl --version
# whereis perl
# vi /usr/local/bin/free        change first line #!/usr/bin/perl   to #!/usr/local/bin/perl
# free

Linux like free command for my FreeBSD server

Freecolor is a free replacement that displays free memory graphically as a bargraph. It supports the same options as free. Install freecolor, enter:
# cd /usr/ports/sysutils/freecolor
# make install clean

OR
# pkg install freecolor
To see memory details, enter:
$ freecolor -m -o



 source: http://www.cyberciti.biz/faq/freebsd-command-to-get-ram-information/
 # freecolor
-sh: freecolor: not found
 # pkg install freecolor
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        freecolor: 0.9.3
        libstatgrab: 0.92.1

Number of packages to be installed: 2

130 KiB to be downloaded.

Proceed with this action? [y/N]: y
[1/2] Fetching libstatgrab-0.92.1.pkg: 100%  124 KiB 126.5kB/s    00:01    
[2/2] Fetching freecolor-0.9.3.pkg: 100%    6 KiB   6.5kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/2] Installing libstatgrab-0.92.1...
[1/2] Extracting libstatgrab-0.92.1: 100%
[2/2] Installing freecolor-0.9.3...
[2/2] Extracting freecolor-0.9.3: 100%
root@Fred_RasPi4B:/usr/local/bin # freecolor
Physical  : [#############################......] 85%      (6839320/8014612)
Swap      : [###################################] 100%     (8388608/8388608)
root@Fred_RasPi4B:/usr/local/bin # freecolor --help
freecolor: illegal option -- -
usage: freecolor [-b|-k|-m] [-o] [-t] [-s delay] [-V]
root@Fred_RasPi4B:/usr/local/bin # freecolor -m
Physical  : [#############################......] 85%      (6679/7826)
Swap      : [###################################] 100%     (8192/8192)
# sysctl -a | grep -i memory      Use the sysctl command

# sysctl -a | grep -i memory 
real memory  = 8441999360 (8050 MB)
avail memory = 8205201408 (7825 MB)
      Memory Model Features 0 = <TGran4,TGran64,SNSMem,BigEnd,16bit ASID,16TB PA>
      Memory Model Features 1 = <8bit VMID>
      Memory Model Features 2 = <32bit CCIDX,48bit VA>
Virtual Memory:         (Total: 448472K Active: 437196K)
Real Memory:            (Total: 26584K Active: 25720K)
Shared Virtual Memory:  (Total: 20240K Active: 13068K)
Shared Real Memory:     (Total: 9176K Active: 8520K)
Free Memory:    211504K
vfs.tmpfs.memory_reserved: 4194304
p1003_1b.memory_protection: 0
p1003_1b.shared_memory_objects: 200112
top & htop commands for display memory use  and processes running
top
 # htop
-sh: htop: not found
 # pkg install htop
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        htop: 3.2.1

Number of packages to be installed: 1

101 KiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching htop-3.2.1.pkg: 100%  101 KiB 103.8kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/1] Installing htop-3.2.1...
[1/1] Extracting htop-3.2.1: 100%
Generating GTK icon cache for /usr/local/share/icons/hicolor
Building cache database of MIME types

Use top command

The top display and update information about the top cpu processes including "Physical Memory Stats" as follows (from top(1) man page):

  1. Active: number of bytes active.
  2. Inact: number of bytes inactive.
  3. Wired: number of bytes wired down, including BIO-level cached file data pages.
  4. Cache: number of clean bytes caching data that are available for immediate reallocation.
  5. Buf: number of bytes used for BIO-level disk caching.
  6. Free: number of bytes free.

$ top


Installing htop on FreeBSD

First, make sure you system is up to date (see how to install sudo on FreeBSD or use the su - command to gain root access):
sudo pkg update
sudo pkg upgrade

Finally, run the following to install htop on FreeBSD:
sudo pkg install htop



 # vmstat
 procs    memory    page                      disks     faults       cpu
 r  b  w  avm  fre  flt  re  pi  po   fr   sr da0 pa0   in   sy   cs us sy id
 0  0  0 417M 207M   15   0   0   0   20   13   0   0   55   64  127  0  0 100
# vmstat -s
 

You can avoid Perl based code and use standard sh shell to get same info using freebsd-memory.sh script:
$ fetch https://raw.githubusercontent.com/ocochard/myscripts/master/FreeBSD/freebsd-memory.sh
## or use curl command ##
## $ curl -O https://raw.githubusercontent.com/ocochard/myscripts/master/FreeBSD/freebsd-memory.sh
$ sh freebsd-memory.sh

Outputs from my FreeBSD based home router:

SYSTEM MEMORY INFORMATION:
mem_wire:          70152192 (     66MB) [ 14%] Wired: disabled for paging out
mem_active:  +     44515328 (     42MB) [  9%] Active: recently referenced
mem_inactive:+    333316096 (    317MB) [ 67%] Inactive: recently not referenced
mem_cache:   +       798720 (      0MB) [  0%] Cached: almost avail. for allocation
mem_free:    +     44724224 (     42MB) [  9%] Free: fully available for allocation
mem_gap_vm:  +       -45056 (      0MB) [  0%] Memory gap: UNKNOWN
______________ ____________ ___________ ______
mem_all:     =    493461504 (    470MB) [100%] Total real memory managed
mem_gap_sys: +      9297920 (      8MB)        Memory gap: Kernel?!
______________ ____________ ___________
mem_phys:    =    502759424 (    479MB)        Total real memory available
mem_gap_hw:  +     34111488 (     32MB)        Memory gap: Segment Mappings?!
______________ ____________ ___________
mem_hw:      =    536870912 (    512MB)        Total real memory installed
 
SYSTEM MEMORY SUMMARY:
mem_used:         158031872 (    150MB) [ 29%] Logically used memory
mem_avail:   +    378839040 (    361MB) [ 70%] Logically available memory
______________ ____________ __________ _______
mem_total:   =    536870912 (    512MB) [100%] Logically total memory

#  fetch https://raw.githubusercontent.com/ocochard/myscripts/master/FreeBSD/freebsd-memory.sh
freebsd-memory.sh                                     6645  B 4726 kBps    00s
root@Fred_RasPi4B:~ # sh freebsd-memory.sh
SYSTEM MEMORY INFORMATION:
mem_wire:        1185275904 (   1130MB) [ 14%] Wired: disabled for paging out
mem_active:  +      2195456 (      2MB) [  0%] Active: recently referenced
mem_inactive:+   6786375680 (   6471MB) [ 82%] Inactive: recently not referenced
mem_cache:   +            0 (      0MB) [  0%] Cached: almost avail. for allocation
mem_free:    +    217026560 (    206MB) [  2%] Free: fully available for allocation
mem_gap_vm:  +     16089088 (     15MB) [  0%] Memory gap: UNKNOWN
______________ ____________ ___________ ______
mem_all:     =   8206962688 (   7826MB) [100%] Total real memory managed
mem_gap_sys: +    211877888 (    202MB)        Memory gap: Kernel?!
______________ ____________ ___________
mem_phys:    =   8418840576 (   8028MB)        Total real memory available
mem_gap_hw:  +    171094016 (    163MB)        Memory gap: Segment Mappings?!
______________ ____________ ___________
mem_hw:      =   8589934592 (   8192MB)        Total real memory installed

SYSTEM MEMORY SUMMARY:
mem_used:        1586532352 (   1513MB) [ 18%] Logically used memory
mem_avail:   +   7003402240 (   6678MB) [ 81%] Logically available memory
______________ ____________ __________ _______
mem_total:   =   8589934592 (   8192MB) [100%] Logically total memory

SWAP SUMMARY:
swap_used:                0 (      0MB) [  0%] Used
swap_avail:  +   8589934592 (   8192MB) [100%] Available
______________ ____________ ___________
swap_total:  =   8589934592 (   8192MB) [100%] Total


mv freebsd-memory.sh /usr/local/bin/freebsd-memory
chmod +x /usr/local/bin/freebsd-memory

freebsd-memory

Home » duf – Disk usage/ free utility for linux, BSD, macOS & windows
Obtain DUF command information on installation here.

BSD

  • FreeBSD: pkg install duf
# pkg install duf
# duf --help

 # duf --version
duf 0.8.1 (3c55411)

# duf
╭────────────────────────────────────────────────────────────────────────────────────────────╮
│ 2 local devices                                                                            │
├────────────┬───────┬───────┬───────┬───────────────────────────────┬─────────┬─────────────┤
│ MOUNTED ON │  SIZE │  USED │ AVAIL │              USE%             │ TYPE    │ FILESYSTEM  │
├────────────┼───────┼───────┼───────┼───────────────────────────────┼─────────┼─────────────┤
│ /          │ 94.0G │ 37.8G │ 48.6G │ [########............]  40.2% │ ufs     │ /dev/da0p10 │
│ /mnt/msdos │  5.0G │ 69.1M │  4.9G │ [....................]   1.4% │ msdosfs │ /dev/da0p1  │
╰────────────┴───────┴───────┴───────────────────────────────┴─────────┴─────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────╮
│ 1 special device                                                                      │
├────────────┬──────┬──────┬───────┬───────────────────────────────┬───────┬────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │              USE%             │ TYPE  │ FILESYSTEM │
├────────────┼──────┼──────┼───────┼───────────────────────────────┼───────┼────────────┤
│ /dev       │ 1.0K │ 1.0K │    0B │ [####################] 100.0% │ devfs │ devfs      │
╰────────────┴──────┴──────┴───────┴───────────────────────────────┴───────┴────────────╯

Comments

Popular posts from this blog

FreeBSD 14.0 Compiling kernel for Raspberry Pi 4B

HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024

How to install GhostBSD-Arm64 into a USB Flash Drive stick April 24, 2024 update edition.