Tech Junkie Blog - Real World Tutorials, Happy Coding!: Linux Performance: procps-ng Commands, free, pmap, pwdx

Monday, April 4, 2022

Linux Performance: procps-ng Commands, free, pmap, pwdx

 In this post we are going to look at the procps-ng package commands to get some performance related information on our Linux system.

The first command we are going to look at is the free command, which shows the free memory available

[root@cent7 jhuynh]# free
              total        used        free      shared  buff/cache   available
Mem:        1882072      754028      404848       33544      723196      942276
Swap:        978940           0      978940

We can use the free command with the -m option to show the free memory in megabytes

[root@cent7 jhuynh]# free -m
              total        used        free      shared  buff/cache   available
Mem:           1837         734         397          32         706         922
Swap:           955           0         955

Or free -g for gigabytes

[root@cent7 jhuynh]# free -g
              total        used        free      shared  buff/cache   available
Mem:              1           0           0           0           0           0
Swap:             0           0           0

The next command we are going to look at is the pmap command, let's grab a process id for this one with the ps -l  command

[root@cent7 jhuynh]# ps -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S     0  3358  3315  0  80   0 - 68658 poll_s pts/0    00:00:00 sudo
4 S     0  3365  3358  0  80   0 - 58056 do_wai pts/0    00:00:00 su
4 S     0  3368  3365  0  80   0 - 29107 do_wai pts/0    00:00:00 bash
0 R     0  4238  3368  0  80   0 - 38332 -      pts/0    00:00:00 ps

Let's run the pmap command on the bash process, the pmap command displays the memory map of a process, besides the memory usage it's nice to see the shared libraries used for the process

[root@cent7 jhuynh]# pmap 3368
3368:   bash
0000000000400000    888K r-x-- bash
00000000006dd000      4K r---- bash
00000000006de000     36K rw--- bash
00000000006e7000     24K rw---   [ anon ]
00000000021b3000   1144K rw---   [ anon ]
00007f53b0616000     48K r-x-- libnss_files-2.17.so
00007f53b0622000   2044K ----- libnss_files-2.17.so
00007f53b0821000      4K r---- libnss_files-2.17.so
00007f53b0822000      4K rw--- libnss_files-2.17.so

Another useful command is the pwdx command, this command finds the home working directory of a process.  So if we run the command pwdx 3368 we will find out what the home working directory of the bash shell is

[root@cent7 jhuynh]# pwdx 3368
3368: /home/jhuynh
[root@cent7 jhuynh]# ps -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S     0  3358  3315  0  80   0 - 68658 poll_s pts/0    00:00:00 sudo
4 S     0  3365  3358  0  80   0 - 58056 do_wai pts/0    00:00:00 su
4 S     0  3368  3365  0  80   0 - 29107 do_wai pts/0    00:00:00 bash
0 R     0  4345  3368  0  80   0 - 38332 -      pts/0    00:00:00 ps


3 comments:

  1. ทางเข้าslot joker123 สามารถ เข้า ต้องการลงทะเบียนเป็นสมาชิก PG SLOT ตอนไหนก็ได้ สมัครได้เลย การลงทะเบียนสมัครสมาชิกแบบไม่จำกัดเวลา สล็อต ทำให้บรรดานักเล่นการพนันเยอะมาก Gaming

    ReplyDelete
  2. pg slot เว็บใหม่ ในขณะนี้ขอชี้แนะเลยว่าการที่คุณเลือกใช้เกม รวมเว็บไซต์ pg ของพวกเราในวันนี้จะสามารถทำให้ทุกคนส่งผลคุณประโยชน์ และจากนั้นก็ความสนุกสนานร่าเริง สุดมันส์

    ReplyDelete
  3. เกมสล็อตออนไลน์ เกมที่ให้ผลตอบแทนสูง เล่นง่าย ได้เงินไว การันตี 100% เว็บ สล็อต amb สล็อตออนไลน์เว็บตรง ไม่ผ่านเอเย่นต์ เว็บใหญ่ที่สุด เราได้รวมเอาค่ายเกมสล็อตชั้นนำ ทั้งเอเชีย และ ยุโรป มาไว้ในที่เดียว เข้าถึงง่าย ใช้งานสะดวก มีเกมให้เลือกเล่นมากกว่า 1000 เกม เพลิดเพลินตลอดการเดิมพัน ตัวเกมโดดเด่น เป็นเอกลักษณ์ กราฟฟิกสวยงาม เอฟเฟ็กอลังกาล อีกทั้งยังมีฟังก์ชั่นซื้อฟรีสปิน ให้ผู้เล่นได้เข้าถึงโบนัสได้ง่ายยิ่งชึ้น สล็อตไม่มีขั้นต่ำ ถอนได้ไม่อั้น ฝาก-ถอน AUTO ไม่ต้องเเจ้งยอด ไม่ต้องรอคิว.

    ReplyDelete

Search This Blog