@@ -122,7 +122,30 @@ alias untar='tar -zxvf '
122122alias aptu=' sudo apt-get update && sudo apt-get upgrade'
123123
124124# # pass options to free ##
125- alias meminfo=' free -m -l -t'
125+ alias meminfo='
126+ echo "--- Physical Memory ---";
127+ sysctl hw.memsize | awk "{printf \"%-15s %10.2f GB\n\", \"Total RAM:\", \$2/(1024^3)}";
128+ vm_stat | perl -ne "/page size of (\d+) bytes/ && (\$s=\$1); /Pages (\w+(?:\s\w+)*): \s+(\d+)/ && printf(\"%-15s %10.2f MB\n\", \$1, \$2*\$s/1024/1024);" | grep -E "free|active|inactive|wired|occupied by compressor" | awk "{
129+ label=\$1;
130+ val=\$(NF-1);
131+ if (\$1==\"occupied\") {label=\"compressed\"}
132+ if (\$1==\"wired\") {label=\"wired\"}
133+
134+ if (val >= 1024) {
135+ printf \"%-15s %10.2f GB\n\", label, val/1024
136+ } else {
137+ printf \"%-15s %10.2f MB\n\", label, val
138+ }
139+ }";
140+ echo "\n--- Logical Calculation ---";
141+ echo "Total RAM ≈ (Active + Inactive + Wired + Compressed + Free)";
142+ echo "\n--- Legend ---";
143+ echo "Active: RAM currently in use by running processes.";
144+ echo "Inactive: Recently used RAM; kept for quick re-opening of apps.";
145+ echo "Wired: Essential system memory that cannot be moved to disk.";
146+ echo "Compressed: Memory zipped to save space; much faster than using SSD swap.";
147+ echo "Free: Empty RAM doing nothing (Wasted RAM).";
148+ '
126149
127150# # get top process eating memory
128151alias psmem=' ps auxf | sort -nr -k 4'
@@ -133,7 +156,21 @@ alias pscpu='ps auxf | sort -nr -k 3'
133156alias pscpu10=' ps auxf | sort -nr -k 3 | head -10'
134157
135158# # Get server cpu info ##
136- alias cpuinfo=' lscpu'
159+ alias cpuinfo='
160+ echo "--- CPU Hardware Information ---";
161+ sysctl -n machdep.cpu.brand_string | awk "{print \"Model: \", \$0}";
162+ sysctl -n machdep.cpu.core_count | awk "{print \"Total Cores: \", \$1}";
163+ sysctl -n machdep.cpu.cores_per_package | awk "{print \"Cores per Package: \", \$1}";
164+ sysctl -n machdep.cpu.thread_count | awk "{print \"Total Threads: \", \$1}";
165+ echo "\n--- Legend ---";
166+ echo "Model: The specific Apple Silicon chip generation.";
167+ echo "Total Cores: The total number of physical processing units.";
168+ echo "Cores per Package: Number of cores inside the physical M4 Max chip.";
169+ echo "Total Threads: Simultaneous tasks the CPU can handle.";
170+ echo "\n--- Note on Apple Silicon ---";
171+ echo "Because Apple uses a System-on-a-Chip (SoC) design, there is only";
172+ echo "ONE package. Therefore, Cores per Package and Total Cores are identical.";
173+ '
137174
138175# # older system use /proc/cpuinfo ##
139176# #alias cpuinfo='less /proc/cpuinfo' ##
0 commit comments