DEV Community

Cover image for Cara mudah mengetahui alokasi RAM di Linux
Erol Joudy
Erol Joudy

Posted on • Originally published at blog.erol.dev

2 2

Cara mudah mengetahui alokasi RAM di Linux

Pertama buat dulu sebuah file (nama file bebas) dengan ekstensi .sh dengan cara, pada terminal ketik command berikut ini.

vi memory-used.sh
Enter fullscreen mode Exit fullscreen mode

Tekan i untuk mengaktifkan mode edit, dan salin perintah dibawah ini. Gunakan Shift+Enter untuk menyalin ke terminal.

#!/bin/bash
ps aux | awk '{print $6/1024 " MB\t\t" $11}' | sort -rn | head -25
view raw memory-used.sh hosted with ❤ by GitHub

Lalu untuk menyimpan file tersebut, tekan Esc kemudian ketik :x tekan Enter.

Untuk mengeksekusi file tersebut, ketik perintah berikut

bash memory-used.sh
Enter fullscreen mode Exit fullscreen mode

Outputnya akan terlihat seperti ini.

# bash memory-used.sh
1232.84 MB              /opt/mssql/bin/sqlservr
37.293 MB               /usr/libexec/mysqld
15.2227 MB              /opt/mssql/bin/sqlservr
10.8477 MB              /usr/sbin/httpd
10.7852 MB              /usr/bin/python2
9.78516 MB              /usr/sbin/httpd
9.78516 MB              /usr/sbin/httpd
9.78516 MB              /usr/sbin/httpd
Enter fullscreen mode Exit fullscreen mode

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more