Some Linux commands about the service and files check up

Here are some commands we common used in Ubuntu linux service and files monitor and check up:

  • Check what service is running in system
service --status-all

Or a GUI tool called bum

sudo apt install bum
sudo bum

Screenshot 2018-02-02 10:44:30

  • List all network interfaces
ifconfig -a

 

  • How to check max files OS could open ?
sysctl -a | grep fs.file-max
       fs.file-max = 3266932

This number normally is around 10% of your system memory in KB number; Such as for my Linux I can get my RAM by top command:

KiB Mem : 32873324 total,

And by default the max files one process can open is 1024. just use this cmd to check:

ulimit -n

 

  • How to check one process’ real limit in the the system for the files and others?
 xw@xwi-HP-Z420-Workstation:~$ ps aux | grep mysql
mysql 1189 0.0 0.4 1246964 160748 ? Ssl Jan30 2:20 /usr/sbin/mysqld
 xw@xwi-HP-Z420-Workstation:~$ cat /proc/1189/limits
Limit Soft Limit Hard Limit Units 
Max cpu time unlimited unlimited seconds 
Max file size unlimited unlimited bytes 
Max data size unlimited unlimited bytes 
Max stack size 8388608 unlimited bytes 
Max core file size 0 unlimited bytes 
Max resident set unlimited unlimited bytes 
Max processes 127918 127918 processes 
Max open files 1024 4096 files 
Max locked memory 65536 65536 bytes 
Max address space unlimited unlimited bytes 
Max file locks unlimited unlimited locks 
Max pending signals 127918 127918 signals 
Max msgqueue size 819200 819200 bytes 
Max nice priority 0 0 
Max realtime priority 0 0 
Max realtime timeout unlimited unlimited us

 

  • How to check one file’s access time stamp info?

xw@xw-HP-Z420-Workstation:~$ stat testFile.txt
File: ‘testFile.txt’
Size: 28 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 8998339 Links: 1
Access: (0664/-rw-rw-r–) Uid: ( 1000/ xiaowei) Gid: ( 1000/ xiaowei)
Access: 2017-12-05 16:17:42.221584809 -0800
Modify: 2017-04-17 11:35:38.000000000 -0700
Change: 2017-04-17 14:40:44.639165159 -0700
Birth: –

Advertisements