This post lists a few examples to check the status of your system in macOS and Linux
Generic
Note: The definition of 'generic' is eligible to be executed in any *nix system.
List Specified Informations by Process Id
Bash
$ ps -p 30314,27363,30019 -o pid,uid,user,args --sort user
PID UID USER COMMAND
30019 996 nginx php-fpm: pool www
30314 996 nginx php-fpm: pool www
27323 0 root [kcopyd]Find Process By Port
Bash
$ sudo lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 10293 root 8u IPv4 43576165 0t0 TCP *:http (LISTEN)
nginx 20010 nginx 8u IPv4 43576165 0t0 TCP *:http (LISTEN)
nginx 20011 nginx 8u IPv4 43576165 0t0 TCP *:http (LISTEN)
nginx 20012 nginx 8u IPv4 43576165 0t0 TCP *:http (LISTEN)
nginx 20013 nginx 8u IPv4 43576165 0t0 TCP *:http (LISTEN)macOS
Get Total Memory
Bash
$ sysctl hw.memsize
hw.memsize: 17179869184Get CPU Brand String
Bash
$ sysctl machdep.cpu.brand_string
machdep.cpu.brand_string: Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHzGet CPU Count
Bash
$ sysctl hw.ncpu
hw.ncpu: 8Linux
Get Total Memory
Bash
$ cat /proc/meminfo | grep MemTotal
MemTotal: 8162256 kBGet CPU Brand String
Bash
$ cat /proc/cpuinfo | grep 'model name' | uniq -c
4 model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
$ cat /proc/cpuinfo | grep 'model name' | uniq
model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHzGet CPU Count
Bash
$ cat /proc/cpuinfo | grep 'model name' | wc -l
4
Comments
No comments yet — be the first to write one.