DEV Community

Fega Suseno
Fega Suseno

Posted on • Edited on

1

Basic Linux Syntax Frequently Used by Writer

Hallo world!
Postingan ini akan membahas beberapa syntax dasar yg sering penulis gunakan. Post ini penulis gunakan untuk reminder saja, agar dapat menjadi acuan.

Melihat Spesifikasi Server

  • Melihat Server Model:
cat /sys/class/dmi/id/product_name
Enter fullscreen mode Exit fullscreen mode

atau dengan install inxi

apt install inxi
inxi -M
Enter fullscreen mode Exit fullscreen mode
  • Melihat Memory:
free -h
Enter fullscreen mode Exit fullscreen mode

Atau dengan

cat /proc/meminfo
Enter fullscreen mode Exit fullscreen mode

Kombinasikan dengan grep

  • Melihat CPU & Processor:
lscpu 
Enter fullscreen mode Exit fullscreen mode

mengecek core cpu

nprox 
Enter fullscreen mode Exit fullscreen mode
htop
Enter fullscreen mode Exit fullscreen mode
top
Enter fullscreen mode Exit fullscreen mode

Rumus hitung persentasenya dengan
100 - id = persentasenya, id = Idle

  • Melihat Storage
lsblk
Enter fullscreen mode Exit fullscreen mode
df -h
Enter fullscreen mode Exit fullscreen mode

untuk melihat partisinya dengan

fdisk
Enter fullscreen mode Exit fullscreen mode

Untuk melihat ukuran folder bisa dengan cara berikut

du -sh /path/to/folder
Enter fullscreen mode Exit fullscreen mode

Atau dengan menggunakan perintah berikut

du -h /path/to/folder | grep 'total'
Enter fullscreen mode Exit fullscreen mode

Mengetahui tiap-tiap foldernya

du -h /path
Enter fullscreen mode Exit fullscreen mode

Melihat dan mengurutkan file dari yang terkecil sampai yang terbesar

du -h | sort -h
Enter fullscreen mode Exit fullscreen mode

Melihat pemakaian disk yag membebani server

du -h / --max-depth=1 2>/dev/null | sort -hr | head -n 10
Enter fullscreen mode Exit fullscreen mode

Melihat Service Server

Melihat port standar yang sering di gunakan di linux

less /etc/services
Enter fullscreen mode Exit fullscreen mode

Melihat layanan yg active di linux

Dengan systemd

systemctl list-units --type=service --state=running
Enter fullscreen mode Exit fullscreen mode

atau dengan menggunakan Sysvinit

service --status-all
Enter fullscreen mode Exit fullscreen mode

Cek portnya dengan menggunakan

netstat -plunt
Enter fullscreen mode Exit fullscreen mode

Atau dengan

ss -plunt
Enter fullscreen mode Exit fullscreen mode

Melihat Operating System Server

Cek OS untuk redhat dan turunanya

cat /etc/os-release
Enter fullscreen mode Exit fullscreen mode

Cek OS Debian dan turunanya

lsb_release -a
Enter fullscreen mode Exit fullscreen mode

Speedtest Server

Speed test dengan menggunakan iperf. Pada server jalankan perintah berikut:

iperf3 -s -p 1337
Enter fullscreen mode Exit fullscreen mode

Pada sisi client jalankan perintah berikut, anggaplah server IP pada sisi Server adalah 192.168.10.1

iperf3 -c 192.168.10.1 -b 10G -t 30 -P 4 -p 1337
Enter fullscreen mode Exit fullscreen mode

Untuk memaksimalkan MTU agar full 10GB

ip link set dev eno12399np0 mtu 9000
Enter fullscreen mode Exit fullscreen mode

Lalu untuk cek interface apakah sudah 10GB

ethtool eth0 | grep Speed
Enter fullscreen mode Exit fullscreen mode

Resource Server

Mengetahui pemakaian file atau folder terbesar yg membuat penyimpanan penuh.

du -ahx / | sort -rh | head -10
Enter fullscreen mode Exit fullscreen mode

atau menggunakan find

find / -xdev -type f -size +50M -exec du -sh {} \; | sort -rh | head -n 10
Enter fullscreen mode Exit fullscreen mode

Mengecek proses yang menggunakan mount point

lsof +D /path/to/mount
Enter fullscreen mode Exit fullscreen mode

Terimakasih.

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (3)

Collapse
 
raphaelproject001 profile image
Rafael Barbosa da Silva • Edited

Much good my friend!👍

Collapse
 
seno21 profile image
Fega Suseno • Edited

Not finished yet, friend

Collapse
 
raphaelproject001 profile image
Rafael Barbosa da Silva

Sorry friend! Made a mistake in the posto!

Billboard image

Try REST API Generation for MS SQL Server.

DreamFactory generates live REST APIs from database schemas with standardized endpoints for tables, views, and procedures in OpenAPI format. We support on-prem deployment with firewall security and include RBAC for secure, granular security controls.

See more!

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay