* 'master' of https://github.com/herrbischoff/awesome-osx-command-line:
  Change code for keys
  Fix typos, again
  Add System Integrity Protection category and entries
  Add Clear All ACLs command
  Correct header
  Add Remove Protected Flag command
  Cleanup duplicate entry
  Fix typo
  Add Dock category and entry
  Added a Recent Apps stack
  Update the FileVault auth-restart command with comments from pull request.
  Add sudo to Bonjour commands
  Added FileVault command to restart machine and skip initial unlock
  Added remaining battery time and percentage to hardware information
  Update README.md
  Fix capitalization
  Give every command a new line
  Capitalize properly
  Make features more descriptive
  Add commands to change screenshot location, type and shadow
This commit is contained in:
Shivendra Dayal 2015-10-25 22:29:02 +05:30
commit 169839e908

View File

@ -28,6 +28,7 @@ If you want to contribute, you are highly encouraged to do so. Please read the [
- [Xcode](#xcode) - [Xcode](#xcode)
- [Disks and Volumes](#disks-and-volumes) - [Disks and Volumes](#disks-and-volumes)
- [Disk Images](#disk-images) - [Disk Images](#disk-images)
- [Dock](#dock)
- [Documents](#documents) - [Documents](#documents)
- [Finder](#finder) - [Finder](#finder)
- [Files and Folders](#files-and-folders) - [Files and Folders](#files-and-folders)
@ -76,9 +77,11 @@ If you want to contribute, you are highly encouraged to do so. Please read the [
- [QuickLook](#quicklook) - [QuickLook](#quicklook)
- [Root User](#root-user) - [Root User](#root-user)
- [Safe Mode Boot](#safe-mode-boot) - [Safe Mode Boot](#safe-mode-boot)
- [Screenshots](#screenshots)
- [Software Installation](#software-installation) - [Software Installation](#software-installation)
- [Software Update](#software-update) - [Software Update](#software-update)
- [Spotlight](#spotlight) - [Spotlight](#spotlight)
- [System Integrity Protection](#system-integrity-protection)
- [Terminal](#terminal) - [Terminal](#terminal)
- [Alternative Terminals](#alternative-terminals) - [Alternative Terminals](#alternative-terminals)
- [Shells](#shells) - [Shells](#shells)
@ -307,6 +310,15 @@ sudo asr -restore -noverify -source /path/to/diskimage.dmg -target /Volumes/Volu
``` ```
## Dock
#### Add a Stack with Recent Applications
```bash
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && \
killall Dock
```
## Documents ## Documents
#### Convert File to HTML #### Convert File to HTML
@ -320,6 +332,11 @@ textutil -convert html file.ext
### Files and Folders ### Files and Folders
#### Clear All ACLs
```bash
sudo chmod -RN /path/to/folder
```
#### Hide Folder in Finder #### Hide Folder in Finder
```bash ```bash
chflags hidden /path/to/folder/ chflags hidden /path/to/folder/
@ -339,6 +356,11 @@ defaults write com.apple.finder AppleShowAllFiles true
defaults write com.apple.finder AppleShowAllFiles false defaults write com.apple.finder AppleShowAllFiles false
``` ```
#### Remove Protected Flag
```bash
sudo chflags -R nouchg /path/to/file/or/folder
```
#### Show Full Path in Finder Title #### Show Full Path in Finder Title
```bash ```bash
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
@ -497,6 +519,16 @@ atsutil server -ping
networksetup -listallhardwareports networksetup -listallhardwareports
``` ```
#### Remaining Battery Percentage
```bash
pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f1 -d';'
```
#### Remaining Battery Time
```bash
pmset -g batt | egrep "([0-9]+\%).*" -o --colour=auto | cut -f3 -d';'
```
#### Show Connected Device's UDID #### Show Connected Device's UDID
```bash ```bash
system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p'
@ -644,12 +676,12 @@ defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1
#### Disable Bonjour #### Disable Bonjour
```bash ```bash
defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ProgramArguments -array-add "-NoMulticastAdvertisements" sudo defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ProgramArguments -array-add "-NoMulticastAdvertisements"
``` ```
#### Enable Bonjour #### Enable Bonjour
```bash ```bash
defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ProgramArguments -array "/usr/sbin/mDNSResponder" "-launchd" sudo defaults write /System/Library/LaunchDaemons/com.apple.mDNSResponder ProgramArguments -array "/usr/sbin/mDNSResponder" "-launchd"
``` ```
### DHCP ### DHCP
@ -899,6 +931,12 @@ pbpaste | sort | uniq | pbcopy
### FileVault ### FileVault
#### Automatically Unlock FileVault on Restart
If FileVault is enabled on the current volume, it restarts the system, bypassing the initial unlock. The command may not work on all systems.
```bash
sudo fdesetup authrestart
```
#### Check FileVault Status #### Check FileVault Status
```bash ```bash
sudo fdesetup status sudo fdesetup status
@ -1059,6 +1097,27 @@ sudo nvram boot-args="-x"
sudo nvram boot-args="" sudo nvram boot-args=""
``` ```
### Screenshots
#### Save Screenshots to Given Location
Sets location to `~/Desktop`.
```bash
defaults write com.apple.screencapture location ~/Desktop && \
killall SystemUIServer
```
#### Save Screenshots in Given Format
Sets format to `png`. Other options are `bmp`, `gif`, `jpg`, `jpeg`, `pdf`, `tiff`.
```bash
defaults write com.apple.screencapture type -string "png"
```
#### Disable Shadow in Screenshots
```bash
defaults write com.apple.screencapture disable-shadow -bool true && \
killall SystemUIServer
```
### Software Installation ### Software Installation
#### Install PKG #### Install PKG
@ -1106,6 +1165,20 @@ mdutil -E /path/to/volume
mdfind -name 'searchterm' mdfind -name 'searchterm'
``` ```
### System Integrity Protection
#### Disable System Integrity Protection
Reboot while holding <kbd>Cmd</kbd> + <kbd>R</kbd>, open the Terminal application and enter:
```bash
csrutil disable && reboot
```
#### Enable System Integrity Protection
Reboot while holding <kbd>Cmd</kbd> + <kbd>R</kbd>, open the Terminal application and enter:
```bash
csrutil enable && reboot
```
## Terminal ## Terminal