##透明度
#降低透明度
defaults write com.apple.universalaccess reduceTransparency -bool true
#恢复默认透明度
defaults write com.apple.universalaccess reduceTransparency -bool false

##应用程序
#列出所有从AppStore下载的应用
find /Applications -path '*Contents/_MASReceipt/receipt' -maxdepth 4 -print |\sed 's#.app/Contents/_MASReceipt/receipt#.app#g; s#/Applications/##'

##Safari浏览器
#打开「开发模式菜单」和「Web调试器」
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true && \
defaults write com.apple.Safari IncludeDevelopMenu -bool true && \
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true && \
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true && \
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true

#获取Safari浏览器当前打开页面的URL
osascript -e 'tell application "Safari" to get URL of current tab of front window'

##Xcode
#安装Xcode
xcode-select --install

##文件系统
#弹出挂载的所有磁盘/分区
osascript -e 'tell application "Finder" to eject (every disk whose ejectable is true)'

#查看所有挂载的磁盘/分区
diskutil list

#显示文件系统的使用情况
sudo fs_usage

#挂载/卸载磁盘镜像
hdiutil attach /path/to/diskimage.dmg
hdiutil detach /dev/disk2s1

##文本操作
#将(plain text, rich text and doc/docx)文件转换成HTML格式
textutil -convert html file.ext

##Finder
#将文件夹在Finder中设置成不可见
chflags hidden /path/to/folder/

#显示所有文件的扩展名
defaults write NSGlobalDomain AppleShowAllExtensions -bool true

#显示所有的隐藏文件
defaults write com.apple.finder AppleShowAllFiles true

#恢复默认的文件可见性设置
defaults write com.apple.finder AppleShowAllFiles false

#在Finder中显示用户的Library目录
chflags nohidden ~/Library

#设置Finder的默认开启路径
defaults write com.apple.finder NewWindowTarget -string "PfLo" && \
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}"

#在网络卷上不要自动创建 .DS_Store 这样的文件
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

#在USB设备上不要自动创建 .DS_Store 这样的文件
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

##打开
#在终端上(默认)用Safari浏览器打开URL
open http://www.github.com

#打开文件
open README.md

#打开应用(-a选项)
open -a "Google Chrome" http://www.github.com

#打开目录
open /path/to/folder/

#在Finder中打开当前目录
open .

##硬件信息
#查看所有硬件端口
networksetup -listallhardwareports

#查看剩余电量百分比
pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f1 -d';'

#查看剩余电量可用时间
pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f3 -d';'

#查看连接设备的UDID
system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p'

#查看当前屏幕分辨率
system_profiler SPDisplaysDataType | grep Resolution

#禁至系统(在1小时内)休眠
caffeinate -u -t 3600

#查看所有的电源管理设置
sudo pmset -g

#在系统死机时自动重启
sudo systemsetup -setrestartfreeze on

#将音频文件转换成iPhone铃声的格式
afconvert input.mp3 ringtone.m4r -f m4af

#从文本文件中创建音频内容
say -v Alex -f file.txt -o "output.m4a"

#静音设置
osascript -e 'set volume output muted true'

#朗读
say 'All your base are belong to us!'

#查看dhcp信息
ipconfig getpacket en0

#清除DNS缓存
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

#查看有哪些应用在使用80端口
sudo lsof -i :80

#查看本机IP
ipconfig getifaddr en0

#查看本机的外部IP
dig +short myip.opendns.com @resolver1.opendns.com

#加入Wifi网络
networksetup -setairportnetwork en0 WIFI_SSID WIFI_PASSWORD

#扫描所有的无线接入点
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport
airport -s

#查看当前的SSID
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'

#显示Wifi连接历史
defaults read /Library/Preferences/SystemConfiguration/com.apple.airport.preferences | grep LastConnected -A 7

#包管理器
Homebrew
Fink
MacPorts

#文件/目录(安全)删除
srm /path/to/file
srm -r /path/to/folder/
srm -rf /path/to/complete/destruction

#执行AppleScript
osascript /path/to/script.scpt

#查看系统信息
sw_vers

#查看系统已开机时间
uptime

#剪贴板
pbcopy
pbpaste

#查看内存使用情况
vm_stat
vm_stat -c 10 1

##截屏
#延时截屏
screencapture -T 3 -t jpg -P delayedpic.jpg

#设置截屏文件的保存路径
defaults write com.apple.screencapture location ~/Desktop && \
killall SystemUIServer

##软件更新
sudo softwareupdate -ia
sudo softwareupdate -l

MAC OS X的命令行技巧的更多相关文章

  1. 8个不可不知的Mac OS X专用命令行工具【转】

    OS X的终端下通用很多Unix的工具和脚本.如果从Linux迁移到OS X会发现很多熟悉的命令和脚本工具,其实并没有任何区别. 但是OS X也提供了很多其他系统所没有的特别的命令行工具.我们推荐8个 ...

  2. 8个不可不知的Mac OS X专用命令行工具(转)

    OS X的终端下通用很多Unix的工具和脚本.如果从Linux迁移到OS X会发现很多熟悉的命令和脚本工具,其实并没有任何区别. 但是OS X也提供了很多其他系统所没有的特别的命令行工具.我们推荐8个 ...

  3. 清除mac os svn密码命令行缓存

    删除认证缓存设置即可,如下:rm -rf ~/.subversion/auth by yytong

  4. MAC OS 如何安装命令行工具:Command Line Tools

    打开终端输入:xcode-select --install 回车 安装好了测试结果:gcc -v 显示如下: xcode-select: note: install requested for com ...

  5. iOS - Mac OS X 终端命令

    Mac OS X 终端命令 1)显示当前目录的路径 pwd 2)列出文件 ls 参数 目录名 参数: -w 显示中文,-l 详细信息, -a 包括隐藏文件,每一行开头是 "d" 则 ...

  6. MAC OS X常用命令总结

    附录:UNIX常用命令 ============================================================================ 1.  cd     ...

  7. Linux命令行技巧

    Linux命令行技巧 命令 描述 • apropos whatis 显示和word相关的命令. 参见线程安全 • man -t man | ps2pdf - > man.pdf 生成一个PDF格 ...

  8. 给新手的 10 个有用 Linux 命令行技巧

    我记得我第一次使用 Linux 的时候,我还习惯于 Windows 的图形界面,我真的很讨厌 Linux 终端.那时候我觉得命令难以记忆,不能正确使用它们.随着时间推移,我意识到了 Linux 终端的 ...

  9. mac shell终端编辑命令行快捷键——行首行尾

    mac shell终端编辑命令行快捷键——行首行尾 ctrl+a //移到行首ctrl+e //移到行尾===========linux系统用============alt+a //移到光标所在单词首 ...

随机推荐

  1. JavaWeb配置错误页面

    我们在实际开发过程中经常会遇到程序出错的各种情况,比如最常见的404错误,500错误等等相关错误,服务器默认会将错误的信息直接显示在浏览器的页面上,如下图所示: 不管是谁如果看到这种情况的话,顿时就会 ...

  2. [linux基础学习]默认的目录介绍

    以下用一个表格来罗列linux默认的目录或文件及其用途: 目录/文件 用途 来源 / /处于Linux文件系统树形结构的最顶端,它是Linux文件系统的入口,所有的目录.文件.设备都在/之下. - / ...

  3. golang函数学习笔记

    golang函数特点: a.不支持重载,一个包不能有两个名字一样的函数 b.函数是一等公民,函数也是一种类型,一个函数可以赋值给变量 c.匿名函数 d.多返回值   例子1 func add(a, b ...

  4. iOS版微信6.5.21发布 适配iPhone X

    昨日,iOS版微信迎来v6.5.21正式版发布,本次升级主要适配iPhone X,在聊天中查找聊天内容时,可以查找交易消息.可以给聊天中的消息设置日期提醒.上一个正式版v6.5.16发布于9月13日, ...

  5. 汇智课堂 Node.js相关课程

    Node.js入门 Node.js 是一个基于Chrome JavaScript 运行时建立的一个平台, 用来方便地搭建快速的 易于扩展的网络应用· Node.js 借助事件驱动, 非阻塞I/O 模型 ...

  6. openfire 使用已有的数据库作为用户认证数据库 Custom Database Integration Guide

    http://download.igniterealtime.org/openfire/docs/latest/documentation/db-integration-guide.html Intr ...

  7. Linux下多个.c文件的编译和Makefile文件

    在编程的时候,我们可以把一个完整程序的每个函数分离出来,写成.c文件,最后再一起编译和链接.这样有利于程序功能模块化,也方便检查代码错误. .h文件:里面编辑该程序需要引用的头文件. #ifndef  ...

  8. python全栈开发从入门到放弃之socket并发编程多进程

    1.1 multiprocessing模块介绍 python中的多线程无法利用多核优势,如果想要充分地使用多核CPU的资源(os.cpu_count()查看),在python中大部分情况需要使用多进程 ...

  9. ViewFlipper

    main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xml ...

  10. JAVA_HOME is not defined correctly

    这是个神奇的问题.系统运行着运行着,突然就挂了.各种Java包丢失. 1.检查maven配置 .bash_profile   2.检查运行调取文件  .mavenrc 运行 java -version ...