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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

DEV is better (more customized, reading settings like dark mode etc) when you're signed in!

Okay