Browse Docs

Investigate

In this section

  • ๐Ÿ”๏ธ Investigate

    Ressources

    1# in crontab or tmux session - take every hour a track of the memory usage
    2for i in {1..24} ; do echo -n "===================== " ; date ; free -m ; top -b -n1 | head -n 15 ; sleep 3600; done >> /var/log/SYSADM/memory.log &
    

    Hardware

    Logs

    Health Checks

  • ๐Ÿšฉ Compare

    Compare staffs

    • Compare two jar files:
    1diff -W200 -y  <(unzip -vqq file1.jar | awk '{ if ($1 > 0) {printf("%s\t%s\n", $1, $8)}}' | sort -k2) <(unzip -vqq  file2.jar | awk '{ if ($1 > 0) {printf("%s\t%s\n", $1, $8)}}' | sort -k2)
    
  • ๐Ÿšฉ Files

    Find a process blocking a file

    • with fuser:
     1fuser  -m  </dir or /files>  # Find process blocking/using this directory or files. 
     2fuser -cu  </dir or /files>  # Same as above but add the user  
     3fuser -kcu </dir or /files>  # Kill process      
     4fuser -v  -k -HUP -i ./      # Send HUP signal to process
     5			
     6# Output will send you <PID + letter>, here is the meaning:
     7#   c  current directory.
     8#   e  executable being run.
     9#   f  open file.  (omitted in default display mode).
    10#   F  open file for writing. (omitted in default display mode).
    11#   r  root directory.
    12#   m  mmap'ed file or shared library.
    
    • with lsof ( = list open file):
    1lsof +D /var/log          # Find all files blocked with the process and user.
    2lsof -a +L1 <mountpoint>  # Process blocking a FS.
    3lsof -c ssh -c init       # Find files open by thoses processes.
    4lsof -p 1753              # Find files open by PID process.
    5lsof -u root              # Find files open by user.
    6lsof -u ^user             # Find files open by user except this one.
    7kill -9 `lsof -t -u toto` # kill user's processes.  (option -t output only PID).
    
    • MacGyver method:
    1#When you have no fuser or lsof: 
    2find /proc/*/fd -type f -links 0 -exec ls -lrt {} \;
    
Thursday, January 15, 2026 Monday, January 1, 1