Linux

Linux

Linux

 
 

System Information:

Print Kernel and OS Release Versions:

uname -r (or uname -a for all info)
2.6.32-531.29.2.lve1.3.11.1.el6.x86_64 

cat /etc/*release*
CloudLinux Server release 6.6 (Leonid Kizim)

Linux Watch Limit:

/proc/sys/fs/inotify/max_user_watches

 



Process Info:

List Processes Per User:

ps hax -o user | sort | uniq -c |sort -rn| head -n30

Find a Process by PID:

ps aux | grep <pid>

 



Memory Diags & Management:

Drop Memory Caches:

sync; echo 3 > /proc/sys/vm/drop_caches

 



Tips & Tricks:

Leave Command Running After Exit:

nohup <your command or script> &
exit

Locate Files & Grep Contents:

grep 'pattern' $(locate 'filename')

 



File / Folder Manipulation:

Move all Files Up One Folder:

mv * .[^.]* ..

 



Disk Usage:

Find top 30 largest files/directories:

[root@lanka-it ~]# for i in G M K; do du --max-depth=5 -ah --exclude=/proc / | grep [0-9]$i | sort -hr -k1; done | head -n30

Find core dump files with size:

find -maxdepth 6 -type f -name "*core*" | egrep -i "core\.[0-9]+$" |xargs -r du -h

Find core dump files and add up the total size in MB:

find -maxdepth 6 -type f -name "*core*" | egrep -i "core\.[0-9]+$" |xargs -r du -h | cut -s -dM -f1 |awk '{total+=$1} END {print total}'

Remove core dump files that were found:

find -maxdepth 6 -type f -name "*core*" | egrep -i "core\.[0-9]+$" |xargs -r rm

 



The difference among VIRT, RES, and SHR in top output:

VIRT stands for the virtual size of a process, which is the sum of memory it is actually using, memory it has mapped
into itself (for instance the video card’s RAM for the X server), files on disk that have been mapped into it (most notably
shared libraries), and memory shared with other processes. VIRT represents how much memory the program is able to access at the present moment.

RES stands for the resident size, which is an accurate representation of how much actual physical memory a process is consuming.
(This also corresponds directly to the %MEM column.) This will virtually always be less than the VIRT size,  since most programs depend on the C library.

SHR indicates how much of the VIRT size is actually sharable (memory or libraries). In the case of libraries, it does not necessarily
mean that the entire library is resident. For example, if a program only uses a few functions in a library, the whole library is mapped
and will be counted in VIRT and SHR, but only the parts of the library file containing the functions being used will actually be loaded in and be counted under RES.
    • Related Articles

    • New Access Management User setup on Linux

      1) Login to your accounts.cartika.com account 2) Select your access management service (customers with managed infrastructure in both the US and CAD will have two) 3) Navigate to Login to SolidCP -> Click Login 4) Click on Users under your Hosted ...
    • Linux BMR (ReaR)

      Cartika has developed a new Linux BMR tool into our backups/dr and BaaS offerings.  This is more tightly integrated with our GUI and is based on the ReaR *nix server imaging technology. This new Linux BMR replaces the legacy/original Linux BMR. AS ...
    • Managing Repos in Linux

      Removing / Disabling Package/Repos causing conflicts During Yum Update  During yum update if there is a conflict, you need to fix by excluding unwanted 3rd party packages / repos that belongs to a specific repository, use any one of the two methods ...
    • How to install Composer in Linux

      To install Composer onto a Linux server run the following commands to, in order.   Download the installer to the current directory Verify the installer Run the installer Remove the installer 1)php -r "copy('https://getcomposer.org/installer', ...
    • Clear Cached Memory On Linux Without Reboot

      If a Linux server appears to have inodes or dentries filling up cached memory, here is how you can flush it without putting the server through a reboot. This will only work with linux kernels equal to or greater then version 2.6.16+ which was ...