sh macOS命令片段
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh macOS命令片段相关的知识,希望对你有一定的参考价值。
# Retrieve the Serial Number
ioreg -c IOPlatformExpertDevice -d 2 | awk -F\" '/IOPlatformSerialNumber/{print $(NF-1)}'
# Retrieve the Hardware UUID
ioreg -c IOPlatformExpertDevice -d 2 | awk -F\" '/IOPlatformUUID/{print $(NF-1)}'
# Retrieve the Model Identifier, e.g. iMac16,1; Macmini7,1' VMware7,1
sysctl -n hw.model
# Convert macOS SMB path to UNC path
echo "smb://myserver.example.com/sharename" | sed -e 's_smb://\(.*\)_\\\\\1_g' -e 's_\/_\\_g'
# \\myserver.example.com\sharename
# Convert UNC path to macOS SMB path
echo "\\myserver.example.com\sharename" | sed -e 's_\(.*\)_smb:\\\1_g' -e 's_\\_\/_g'
# smb://myserver.example.com/sharename
# Retrieve the Darwin Cache or Temp dir variables
getconf DARWIN_USER_CACHE_DIR
getconf DARWIN_USER_TEMP_DIR
# Root Defaults
# Cache: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/
# Temp: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/
# User Example
# Cache: /var/folders/wt/c230x4391yn3qmb9j2sb90v40000gn/C/
# Temp: /var/folders/wt/c230x4391yn3qmb9j2sb90v40000gn/T/
# Determine the home directory for all users on a machine
USERS=$(dscl /Local/Default -list /Users uid | awk '($2>=500) && ($2<=10000) {print $1}')
for USERNAME in $USERS; do
USER_HOME=$(eval echo "~$USERNAME")
echo $USER_HOME
done
以上是关于sh macOS命令片段的主要内容,如果未能解决你的问题,请参考以下文章
sh [sh - 网络命令] #macOS
sh macOS锁屏1行命令
sh 从命令行macOS,OSX,Linux重启,启动,停止MySQL
sh 在macOS Mojave上重新安装Brew的XCode命令行工具
sh [macOS disk utility和dd命令]使用此创建USB磁盘映像并从映像还原#usb #macOS #disk_utility #dd #image #restore#
使用macOS中的命令行向文件添加(Spotlight)注释