How to Check Memory Usage In Linux – 5 Commands

How to Check Memory Usage In Linux – 5 Commands


Linux Articles / All 142 Views comments

Final up to date on December 2nd, 2019 at 08:04 pm

On the subject of managing busy Linux servers each Linux administrator must understand how a lot load server is having and the way they will Verify Reminiscence Utilization on Linux, for instance, in case you are operating a webserver you have to have sufficient reminiscence to entertain your web site guests so it is rather essential to know which service is consuming extra reminiscence, as a Linux admin you will need to know The right way to verify reminiscence utilization in Linux so you'll be able to 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 a superb overview about processes, like how a lot a processes is using system reminiscence and cpu.

When 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

Black Friday Web Hosting Deals

Associated Articles :

Check Memory Usage on Linux

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?

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 retaining above instance in thoughts, lets monitor mysql course of solely:

# prime -p 1595

In case should you don’t know PID, so you possibly can search by identify additionally:

prime -p `pidof -s mysql`

The /proc/meminfo file

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

Now you already know 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 examine 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

In above command -m change exhibits reminiscence utilization in MB and should 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 htop command

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

htop will not be 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

To run htop command

# 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 examine 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 examine your e-mail for additional directions.

Publish Views: 1,192