Find Memory Or RAM And Swap Usage In Linux

0 comments

RAM plays an important role in the performance of a system. So we should monitor this memory usage to troubleshoot system. free is the basic command to get details of RAM and swap usage.

#free

Example :

# free
total used free shared buffers cached
Mem: 3059872 2842016 217856 0 33936 2012684
-/+ buffers/cache: 795396 2264476
Swap: 2000052 67672 1932380


When you see its giving total size, used and free size in bytes. If you want to see in MB specify

-m option in free

#free -m

Example :

# free -m
total used free shared buffers cached
Mem: 2988 2784 203 0 33 1974
-/+ buffers/cache: 776 2211
Swap: 1953 66 1887


Any other commands to check RAM?
The answer for this is yes.
1. Use proc file system to get detailed RAM usage of the system.

#cat /proc/meminfo

2. Use top command to see RAM usage



So with top too you can see RAM usage live.

  • Like the post? Please Subscribe to free RSS feed to get updates
  • How To Find And Remove Core Files In Linux?

    0 comments

    What is a"Core file" ? Ans : A core file is created when a program is crashed/stoped abnormally due to some bug. This will be huge size which contains all the memory info, crash info which is used for programmers to debug the issue and find a solution or patch to that bug.

    Why we system administrators are interested in that core files?
    Ans : This is because of their size. As we do monitoring of systems on daily basis but suddenly your disk is full one day when you came to office, you are total blank thinking how come disk is full though there is no much user activity etc. So core files are one reason which will eat up our disk. Which you have to check for when sudden disk activity is observed.

    How to find core files ?
    #find / -name core

    This find command will search entire filesystem for core files.. once you find them use rm command to remove those files..
    #rm -rf core

    So how it got its name?
    A core dump file gets its name from an old memory technology using tiny magnetic cores for storage.

  • Like the post? Please Subscribe to free RSS feed to get updates
  • How To Kill Defunct Or Zombie Process?

    1 comments

    A "defunct" processes is also known as a "zombie" processes. A Zombie process is referred as dead process which is receding on your system thought its completed executing. In one shot we can say its a dead processes. This process will be in your process table and consuming your memory. Having more defunct process will consume your memory which intern slows your system. We have to kill the defunct process in order to free RAM and make system stable.

    Why defunct process are created?
    Ans :
    When ever a process ends all the memory used by that process are cleared and assigned to new process but due to programming errors/bugs some processes are still left in process table. These are created when there is no proper communication between parent process and child process.

    Some FAQ?

    1. How to find a defunct process?
    And : Grep defunct value in ps -ef output
    #ps -ef grep defunct

    2. How can i kill a defunct process?
    And :
    Just use kill command
    #kill defunct-pid

    3. Still not able to kill?

    Ans : Then use kill -9 to force kill that process
    #kill -9 defunct-pid

    4. Still have an issue in killing it?

    Ans : Then try to kill its parent id and then defunct.
    #kill parent-id-of-defunct-pid
    Then

    #kill -9 parent-id-of-defunct-pid

    5. Still having defunct?

    Ans : If you still find defunct process eating up RAM then last and final solution is to reboot your machine.

    6.What is orphan process?
    Ans : An orphan process is said to be a process which runs though parent process is terminated, these process do not know what to do and when to terminate.

    7. What is difference between orphan and defunct processes?
    Ans :
    A defunct process is a dead process where there is no execution happening where as orphan process is a live process which is still in execution state but don't have parent process

    I am having a system which daily creates defunct process, I cannot sit and kill these process on daily basis.


    How to get rid of this problem?
    Ans : Just write a shell script to grep defunct process and kill them by putting this script in corntab.

  • Like the post? Please Subscribe to free RSS feed to get updates
  • Archive

    Translate this page

     

    The Linux Juggernaut | Copyright 2006-2009 Surendra Kumar Anne | Surendra's Home Page | Give us feedback how we are doing, Click here