Get tricksy with Terminal
Feeling brave? Try these tips and tricks to speed up the way you use your Mac
Many people baulk at the idea of using the Mac’s Terminal but, as long as you’re careful, it’s nothing to be afraid of. Open Terminal – it’s in Applications > Utilities, or open App Launcher and find it in the Other folder. The Terminal window shows your username and a cursor. To use one of the Terminal commands in this section, type it in exactly as it is here, with no spaces at the end, and press Enter.
If you’ve used a Wi-Fi password before but can’t find it on your Mac, in Terminal, type
security find-generic-password -wa “Wifi”
changing ‘Wifi’ to the name of the Wi-Fi SSID in question.
You then have to type in your administrator’s name and password. You’re shown the password in question, provided it’s been used on your Mac before. To list actively running processes on your Mac, type
top
in Terminal. You’ll see the running processes listed. If you’ve typed in a lot of Terminal commands, and it’s all looking too cluttered, you can wipe the window clean by typing
clear
A good way to learn about Terminal is to type
man “command”
changing ‘command’ to the command you wish to learn about. A page from the Terminal manual is displayed for your perusal.
To change the default name for screenshots taken on your Mac, in Terminal, type
defaults write com.apple. screencapture name “filename”
changing ‘filename’ to the screenshot title you want to use. To revert back to the default way of naming screenshots, type
defaults write com.apple. screencapture name “Screenshot”.
If you want to capture screenshots without the date and time in the file name, type
defaults write com.apple. screencapture “include-date” 0
and press Enter. If you change your mind, type the above code again, replacing the 0 (zero) at the end with a 1 (one), then press Enter. The date and time are restored.
You can force quit an app from Terminal using the killall command. To do this, type
killall app
replacing ‘app’ with the name of the application you want to quit. For example,
killall Numbers
forces the Numbers app to quit. Make sure the name of the app is offered exactly as it is on the app, including capitalisation.
If you want your Mac to stay awake, use the command
caffeinate
You can also specify the time for which this is active. Just type
caffeinate -t seconds,
replacing ‘seconds’ with the number of seconds for which you want your Mac to stay awake. For example,
[courier]caffeinate -t 3600[/
courier]
keeps your Mac awake for 3,600 seconds, that is, one hour. If you do this often, we recommend you install the free Caffeine app from the App Store.
If you’re using El Capitan or later, you can flush the Mac’s DNS cache from the Terminal. Type
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
and press Enter, then type your admin password and press Enter. Note; when entering your password, the cursor doesn’t move and nothing appears on the screen. Just type it in full and press Enter; it’s working even if you don’t see anything in the Terminal window.