How to Check Memory Usage In Linux – 5 Commands

How to Check Memory Usage In Linux – 5 Commands

All

Linux Articles / All 48 Views comments

In relation to managing busy Linux servers each Linux administrator must understand how a lot load server is having, for instance, in case you are operating a webserver it's essential to have sufficient reminiscence to entertain your web site guests so it is rather necessary to know which service is consuming extra reminiscence, as a Linux admin it's essential to know How you can verify reminiscence utilization in Linux and run your linux field at an optimum degree.

Instructions to Examine Reminiscence Utilization In Linux

  • The prime command
  • The /proc/meminfo file
  • The free command
  • The vmstat command
  • The htop command

The highest command

Prime command is put in on virtually all Linux distributions and its used to print Reminiscence and CPU utilization of system, it provides and wonderful overview about processes, like how a lot a processes is using system reminiscence and cpu.

In the event you take a look at highlighted one, which is mysql server deamon taking 2.7% of reminiscence and zero.three% of CPU. Whereas in header of under output you possibly can see KiB Mem and KiB Swap enteries displaying free and used reminiscence assets

The highest command’s output is constantly up to date, which lets you monitor all of the processes in real-time. However what if you wish to present output for one processor?

Web Hosting

Present just one course of with prime on Linux

To watch particular course of in linux utilizing prime command you need to know the PID variety of the method, then use the -p flag to specify it. In above image we highlighted mysql course of whic has PID 1595, now holding above instance in thoughts, lets monitor mysql course of solely:

# prime -p 1595

In case in case you accomplished know PID, so you possibly can search by identify additionally:

prime -p `pidof -s mysql`


The /proc/meminfo file

We will additionally examine reminiscence utilization info in linux by immediately studying /proc/meminfo system file. This can be a digital file, which suggests its not actual file however it incorporates real-time, dynamic details about the system.


Now you realize the place different instructions will get reminiscence information? sure some instruments makes use of /proc/meminfo system file to learn reminiscence info.

The free command

An different easy and straightforward to make use of solution to verify reminiscence utilization in linux is utilizing free command, which is a most generally used command. This command is used to verify details about the reminiscence utilization by your system. Right here is the command you'll enter within the Terminal:

# free -m


Web Hosting

In above command -m change exhibits reminiscence utilization in MB and in the event you use -h it exhibits human-readable output

The vmstat command

The vmstat command with the -s choice, exhibits the reminiscence utilization statistics very similar to the proc/meminfo file. Right here is an instance

The htopcommand

That is just like prime command, nevertheless it provides extra element info of cpu and reminiscence utilization.

htop is probably not put in by default, so youc an set up utilizing under command on CentOS/RHEL

# yum set up htop -y

If utilizing Ubuntu

# apt-get set up htop

The header on prime exhibits cpu utilization together with RAM and swap utilization with the corresponding figures.

This information offered a number of methods to verify the reminiscence utilization in Linux system utilizing command line. We discovered that a single line command offers beneficial knowledge for evaluation on system efficiency.

Now you'll be able to administer your Linux servers extra effectively.

Thanks for subscribing! Please verify your e mail for additional directions.

Publish Views: 14

Comments