[Mac OS X] 如何在终端查看 Mac OS 版本信息

article/2025/9/23 8:07:16

本文转载至:https://www.cyberciti.biz/faq/mac-osx-find-tell-operating-system-version-from-bash-prompt/

use ssh client to login into my Mac Min server without GUI. How can I tell what version of Mac OS X operating system am I using command prompt? How do I find out Mac OS X version from Terminal app bash shell?


On Apple Mac OS X you need to use the following command to find out operating system version:

  1. system_profiler command – Show Apple hardware and software configuration.
  2. sw_vers command – Show Mac OS X operating system version.
  3. uname command – Show operating system name and more.

Determine OS X version from the command line

Open the terminal app and type the following command:
$ sw_vers
Sample outputs:

Fig. 01: Find OS X version from the command line

Fig. 01: Find OS X version from the command line


Where, you can pass the following options:

  1. -productName – Print just the value of the ProductName property.
  2. -productVersion – Print just the value of the ProductVersion property.
  3. -buildVersion – Print just the value of the BuildVersion property.

Say hello to system_profiler

You can use the system_profiler command as follows to get the same information:
$ system_profiler | less
$ system_profiler SPSoftwareDataType

Sample outputs:

Fig.02: Tell what version of OS X you are using on from the command line

Fig.02: Tell what version of OS X you are using on from the command line

Using SystemVersion.plist file

The above commands use /System/Library/CoreServices/SystemVersion.plist file. One can print the version info as follows:
$ cat /System/Library/CoreServices/SystemVersion.plist
Sample outputs:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict><key>ProductBuildVersion</key><string>15B42</string><key>ProductCopyright</key><string>1983-2015 Apple Inc.</string><key>ProductName</key><string>Mac OS X</string><key>ProductUserVisibleVersion</key><string>10.11.1</string><key>ProductVersion</key><string>10.11.1</string>
</dict>
</plist>

On Mac OS X server, try:
$ cat /System/Library/CoreServices/ServerVersion.plist

How do I find out OS X Darwin kernel version?

Simply type the following uname command to see operating system name including the machine hardware name, the nodename, the machine processor architecture name, the operating system release, the operating system name, and the operating system version:
$ uname -av
Sample outputs:

Darwin Viveks-MacBook-Pro.local 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64

Tip: Read OS X version in audio format

Type the following bash command to hear OS X version using the say command on OS X:

say $(sw_vers) 
say $(sw_vers -productName && sw_vers -productVersion | sed 's/10//')


http://chatgpt.dhexx.cn/article/2ENOu1RP.shtml

相关文章

如何在控制台中查看mac系统的操作系统是什么?

【提要】 在下载软件时不知道该选择哪个对应的操作系统&#xff1a; 【解决】 打开终端&#xff0c;输入uname -a&#xff0c;回车后 x86_64 表示系统为64位 i686 表示系统32位的 我的是macOS ARM64位操作系统

苹果操作系统 Mac OS 查看网络中电脑的端口是否开放

需求 在服务器开了一个端口&#xff0c;因为电脑是MAC OS &#xff0c;所以不通过命令不知道怎么能不能在网络中看这个端口是否已经开放了&#xff1f; 通过Ping指定是行不通的 方法1&#xff1a; 安装telnet 推荐 方法2&#xff1a; 通过命令 nc -zv -w 2 -u 192.168.1.9 237…

Mac 查看本机密钥

1、 查看本地是否存在SSH密钥 命令&#xff1a;ls -al ~/.ssh 如果在输出的文件列表中发现id_rsa和id_rsa.pub的存在&#xff0c;证明本地已经存在SSH密钥&#xff0c;请执行第3步 2、 生成SSH密钥 命令&#xff1a;ssh-keygen -t rsa -C “自己的Email地址” 注意&#…

PHP文件处理--读取文件

读取文件 利用PHP提供的文件处理函数&#xff0c;可以读取一个字符、一行字符串或者整个文件&#xff0c;也可以读取任意长度的字串。 1。读取一个字符&#xff1a;fgetc() 在对某一个字符进行查找、替换时&#xff0c;就需要有针对的对某个字符进行读取&#xff0c;在PHP中…

PHP文件写入和读取

“r”:只能读取文件&#xff0c;不能写入文件&#xff08;写入操作被忽略&#xff09; “w”:只能写入文件&#xff0c;不能读取文件&#xff08;读取操作被忽略&#xff09; “a”:只追加文件&#xff0c;与“w”类似&#xff0c;区别是“w”删除原有的内容&#xff0c;“a”不…

php读取txt文件内容,并且按照格式输出。

我遇到个很初级的需求&#xff0c;大概就是给了一个txt里面内容是 然后要求在页面原样输出&#xff0c;不换行&#xff0c;不要格式的话 直接 file_get_contents就完事&#xff0c;要是按照格式的话 就得用file函数了&#xff0c;下面说下file函数是干什么的。 file() 函数把整…

PHP—文件打开/读取

https://www.cnblogs.com/penghuwan/p/6884932.html 文章提纲&#xff1a; 一&#xff0e;实现文件读取和写入的基本思路二&#xff0e;使用fopen方法打开文件三&#xff0e;文件读取和文件写入操作四&#xff0e;使用fclose方法关闭文件五&#xff0e;文件指针的移动六&…

php读取文件内容(入门)

第一种方法&#xff08;整体&#xff09; 干脆利索($myfile接收数据流),注意fread第二个参数是设置读取的长度&#xff0c;这里直接获取文件内容的长度&#xff0c;然后根据文件内容长度直接读出文件内容。 <?php $myfilefopen(file1,"r") or die("Cannot…

【实例】php读取整个文本文件中的内容

实例说明 在开发网站过程中&#xff0c;很多服务条款、协议等都是以文本文件的形式存储。如果要读取这些文件中的内容就需要使用文件系统函数。 代码 &#xff08;1&#xff09;使用 file()函数读取文件中的内容&#xff1a; <?php // 使用 file()函数读取文件内容 $ar…

php案例:把文件内容读取到字符串中

作者&#xff1a;陈业贵 华为云享专家 51cto(专家博主 明日之星 TOP红人) 阿里云专家博主 文章目录 代码&#xff1a;效果&#xff1a; 代码&#xff1a; <?php $peoplefile_get_contents("./cyg1.php");//读取当前路径下的cyg.php文件 print $people;//输出文件…

PHP 文件写入和读取

“r”:只能读取文件&#xff0c;不能写入文件&#xff08;写入操作被忽略&#xff09; “w”:只能写入文件&#xff0c;不能读取文件&#xff08;读取操作被忽略&#xff09; “a”:只追加文件&#xff0c;与“w”类似&#xff0c;区别是“w”删除原有的内容&#xff0c;“a”不…

【PHP】文件写入和读取详解

一&#xff0e;实现文件读取和写入的基本思路&#xff1a; 1&#xff0e;通过fopen方法打开文件&#xff1a;$fp fopen(/*参数&#xff0c;参数*/)&#xff0c;fp为Resource类型 2&#xff0e;进行文件读取或者文件写入操作&#xff08;这里使用的函数以1中返回的$fp作为参数…

fliplr 函数 matlab

fliplr(B)&#xff1a;左右翻转矩阵B

MATLAB行向量顺序颠倒函数 - fliplr

fliplr(A)只可用于行向量&#xff0c;列向量不行&#xff01; 实例: (1) 行向量 (2) 列向量

Matlab篇(四)MATLAB中fliplr和flipud实现向量顺序翻转

%% 翻转行向量就用fliplr&#xff0c;翻转列向量就用flipud a1 [1,2,3,4,5,6]b fliplr(a1)a2 [1,2,3 ; 4,5,6]c a2;c1 fliplr(c)c2 flipud(c) 运行结果&#xff1a;

matlab中fliplr函数

fliplr函数 fliplr函数主要的作用是将矩阵进行左右翻转。 官网上的解释是&#xff1a; 如果是行向量&#xff08;或一维矩阵&#xff09; 可以将其左右翻转&#xff0c;即对折后置换的效果 如果是多维向量 可以看成每一行进行左右对称交换 书写者&#xff1a;小飞侠 参…

fliplr函数对时间序列进行反转

代码 n -2:5; x exp(-0.5*n); x1 fliplr(x); n1 -fliplr(n); subplot(211) stem(n,x,filled,r); title(x(n); subplot(212) stem(n1,x1,filled,b); title(x(-n)); figure stem(n,x,filled,r); hold on stem(n1,x1,filled,b);结果

【Matlab】笔记:数组反转顺序函数 fliplr()

对于cell array中包含多层数据的&#xff0c;fliplr只会对于最外面一层进行反转顺序&#xff0c;且反转顺序后的不会影响原始数据&#xff0c;需要将其重新放到新的变量里。 obj{1, 1}(1, 1)ans 包含以下字段的 struct:color: "#99ffff66"density: 30points: {121 …

MATLAB如何得到回文数(用fliplr函数)

示例&#xff1a; clc;clear; Nnum2str(12345); Sfliplr(N);disp(S);

python:np.fliplr()

一、np.fliplr() fliplr()是Numpy库中的函数。 作用是将数组在左右方向上翻转。 fliplr()在左右方向上翻转每行的元素&#xff0c;列保持不变&#xff0c;但是列的显示顺序变了。 参考&#xff1a;https://github.com/numpy/numpy/blob/v1.15.0/numpy/lib/twodim_base.py#L…