You don’t have to be in a sci-fi movie to get in the background of your personal computer and “hack” through the system. For Mac users, Terminal is the part of your Mac that makes you feel this way. By simply adding to your “command line” you are able to manipulate aspects of your Mac to make for an easier or more customized use. We know that it can be “scary” to go into the Terminal and make use of the command line interface, today, we will show you that it really isn’t that difficult.
What is Terminal and Where is It?
The Terminal is an app found in the Utilities section of the Mac. This application is where you are able to enter command and make changes to your system without having to install third-party apps. Through lines of commands, you are able to change everything from how iCal processes events to changes with the login window. It may be ugly, but it is definitely the fastest way to get things done.
There are a couple of things to go over before we look into using some useful commands. First off, when you open terminal, you are presented with a line of code that is pictured above, showing your login and computer name. At the end of the line is a blinking cursor. This is where you will enter the command line.
Some basic commands:
cd: stands for “change directory”. When you open the terminal, the default directory is always your Users home directory. If you want to change the directory to other directory, say “Downloads”, you just use the command:
ls: listing of the files and directories in the current directory. Simply type in
ls in the terminal and it will display all the files and folders in the current directory.
cp: Copy a file/directory from the source to the destination. For examples, if I want to copy the file “video.mp4” from the current directory to the “Video” folder, I just need to use the command:
cp video.mp4 ~/Video/
mkdir: Also stands for “MaKe DIRectory”, this command allows you to create new folder.
mv: is short for “move”, which means to move a file from one place to another. It works exactly the same as “cp” except that the source file is removed after copying.
rm: This command allows you to remove (also known as “delete”) files/folders. For example:
In terms of command rules, there are a couple to remember. First off, Terminal is a text-only environment. This means that you don’t have to use a mouse at all. What if you are going to use one of the commands mentioned below and are wondering what secrets lie behind the specific command? This is done by typing
man before the name of the command. Press Enter and the man(ual) of the specific command appears.
Some useful Terminal commands for Mac
Safari: Open links as second tab:
defaults write com.apple.Safari TargetedClicksCreateTabs -bool TRUE.
Put Safari into debugging mode:
defaults write com.apple.Safari IncludeDebugMenu 1
Change the Dock from 3D to 2D:
defaults write com.apple.dock no-glass -boolean YES killall Dock
Move the Dock to Left Side
defaults write com.apple.dock pinning -string start
Not liking this? You can change the
start in the above command to
middle to restore it to the middle.
Always in plain text in Mail:
defaults write com.apple.mail PreferPlainText -bool TRUE
Enable Half-star iTunes Ratings:
defaults write com.apple.iTunes allow-half-stars -bool TRUE
Shut down remotely:
sudo shutdown -h now
More Screenshot Options:
screencapture -x -t jpg capture.jpg killall SystemUIServer
Change .jpg with whatever format you want screenshots saved as.
Eject an un-ejectable CD:
disktool -e disk
New Screenshot Destination:
defaults write com.apple.screencapture location "/Users/yourusername/screenshots
Enable Desktop Widgets:
defaults write com.apple.dashboard devmode YES
Change the YES to NO to disable it.
Can’t get enough? Here are more useful commands for you.
What other useful commands have we missed out?
Our latest tutorials delivered straight to your inbox