How to start Remote Login on the command line?
sudo /usr/bin/sshd. You may need to generate a passphrase if this is run for the first time. Simply go to System Prefences, Sharing, and check mark Remote Login, will automatically generate the passphrase.
How to start Windows File Sharing on the command line?
sudo smbd restart or
sudo nmbd restart.
How to launch a Mac GUI application using command line tool?
Use “open”. ⁖
open /Applications/iTunes.app. Note that the “open” command behaves as if doubling clicking on finder. In particular, if a application is already running, it will just switch to it, not launch a new process.
How to launch a GUI application while passing it a command line argument?
Sometimes, you want to launch a separate process of Carbon Emacs or Aquamacs, and want to pass it command line arguments. You can do like this:
nohup /Applications/Emacs.app/Contents/MacOS/Emacs -q &.
Note, however, Terminal has a feature such that if you close the window, it'll quit all command launched from it, even if you have used “nohub”. The “nohub” will only prevent the app from quitting if you exit the shell by 【Ctrl+d】.
How to open a URL in a running browser?
open -a safari myUrlStr. This will open the URL in a currently running Safari browser if one has been launched. To specify other browsers, use “firefox” or “icab” for example.
How to make Finder show hidden files?
In Terminal, type:
defaults write com.apple.finder AppleShowAllFiles TRUE killall Finder
This will set a config and restart Finder.
How to make the mouse speed faster?
defaults write -g com.apple.mouse.scaling
The above will show your current scaling value. To make it faster, do:
defaults read -g com.apple.mouse.scaling 5
You need to relog for this to take effect.
What's the command to put system to sleep?
Use applescript, like this:
osascript -e 'tell application "System Events" to sleep'.
What's the command to turn on screen saver?
You can make a bash shell alias, like this:
alias ssaver="…"; and put in
You can also run the screen saver on your Desktop's background. Give the command the “-background” argument.
How to do a screenshot with command line?
How to kill the Dashboard?
You can use the command line to set a preference, then you need to relaunch Dock. Type the following code in Terminal.
defaults write com.apple.dashboard mcx-disabled -boolean YES killall Dock