10 useful terminal tips for OS X users

A Mac machine is not only known for its graphical user interface and speed, but also for multiple powerful utilities, which can save users’ time as well as perform many different tasks. The Terminal itself is a well-known example of those great utilities. The Terminal is basically included with multiple UNIX utilities and scripts that can perform many actions on your Mac system, like to customize your Mac system preferences, remotely control another Mac, manipulate text files, etc.

The Terminal is a very useful utility for programmers and for those users who are familiar with Linux commands. Mac comes with a number of efficient utilities that no other operating system provides, by which you just can do much better than just managing the Mac ad Terminal is one of them. Here in this write-up let’s discuss some expert tips and tricks about Terminal Shell, which can help you to improve your daily tasks and make you more productive at the command line.

About the Terminal Shell:

Initially you must know that how to run the Terminal utility and the locations on it. To find out Terminal you need to go to Applications → Utilities → Terminal. This utility is basically command based so you need to enter specific text strings and then enter return to execute them.

  • Interface: After launching the Terminal utility, the interface, which you use, is your user’s home directory. To test it you can simply type pwd or ‘Print working directory’ into Terminal and enter, you will be able to see all the recent directory printed on the screen.These directories can be moved by typing the cd path/to/other/directory, you can change this path by replacing it with the path name to the other folder, you want to change. After pressing return you will be taken to that directory. To exit the Terminal you just need to type cd ~/, it will immediately return you to your Home Directory.
  • Structure of Terminal Commands: The Terminal commands are divided into three main parts first is the command (which are specified), second is the options (which can change the command’s output), and third is the argument (it is the specified file or any other item for which the command is running). If you know the basic concepts that how the commands are created, it would be easy for you to remember them.

Customize your Mac with Terminal:

With this powerful app you can change the number of hidden preferences by some default commands. Usually there are too many commands available to do this task, but here you will be able to view some popular ones. Make sure that you have closed the application before modifying its defaults in the shell. In case you want to undo the entered command, replace TRUE with FALSE after executing the same command again.

Disable the Dashboard

With Terminal shell you can remove your Dashboard from OS X with ease. Run the Terminal and enter in the following command:

defaults write com.apple.dashboard mcx-disabled -boolean YES

Press return, and you will be able to see the changes immediately. Execute the following command to restart the Dock and rid your Mac of the Dashboard feature:

killall Dock

In case you are no longer want the above made changes, then simply log out of your system and back in to see the change take effect.

Disable the Auto-Restore Feature

You can easily disable the Auto-restore feature by following terminal command

Run the Terminal and type the following command:

defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false

The above command will disable the preview feature, to disable this feature in QuickTime Player, type the following command as well:

defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false

Now, quit and restart the apps and check the change, to reverse the this change  run the same commands by replacing ‘false’ with ‘true.’

Change the File Format for Screenshots

Change the formats of your saved screenshots by executing the following command in the Terminal:

defaults write com.apple.screencapture type extension

Change the ‘extension’ word with your preferred file extension in the above command line and press enter.

Make changes in default backup periods

Time Machine usually takes backup every hour after connection. It is its default feature, but you can change it through the Terminal shell. Execute it by entering following command

sudo defaults write /System/Library/Launch Daemons/com.apple.backupd-auto StartInterval -int 1800

The above command will change the time of Time Machine backup to every 30 minutes. In case you want to change it, simply replace the 1800 with the interval time in seconds ( For example 15 minutes would be 900 seconds).

Remove free space on your Mac

Whenever you remove unwanted files from trans on your Mac, it does not provide proper information to your operating system so that it can mark that space as empty. This data still stays on your hard drive and keep the space occupied until a fresh data do not replace it. Therefore, to resolve such issue you just need to run a terminal command to wipe the existing space beyond recovery. The command is:

diskutil secureErase freespace 3 /Volumes/drive name

Here you can type the name of your drive by using two other commands:

cd /Volumes/


The above command will list all the available drives, from here you can copy and paste the path of required drive in the “drive name” section of the command.

Check the hidden Files

To see the complete content of all the folders available in the Finder, execute the below mentioned command:

defaults write com.apple.finder AppleShowAllFiles TRUE

Always check all the files properly before deleting as there could be some files which belong to system and any type of edition or deletion might harm your OS.

Secure a file or a folder

The terminal’s zip command can overcome the security that has the ability to encrypt archived files and folders in one go. This encryption power does not match with military or industrial standards, but surely a good way to save your data from nosy people.

The command to create an encrypted archive from a folder in the current directory is:

zip -re archiveName name/of/folder

Here, you just need to replace name/of/folder with the path and name of the relevant folder and archiveName with the name you want to choose for the zipped file. Execute unzip archiveName to retrieve the contents of an encrypted archive.

Disable Auto-restore Feature

 in Lion/Mountain Lion OS

Whenever you open up some app like Preview, then all the recently accessed PDFs start popping up on your screen. Unfortunately, Mac does not provide any of such program or command to disable it for all the OS applications. Therefore, you need to do it for every single program. If you want to disable it for Preview app, then follow the command:

defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false

In you want to do the same for QuickTime app, then again enter:

defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false

Now, restart the apps and see the changes.

Customize File Permissions

The terminal command also allows you to decide the file permissions and ensure the privacy & security of it in case of sharing. You can just resolve this problem by two simple commands chmod and chown.

Where, chmod can assign the role-based permissions to the users other than the owner. Execute the following command to allow that everyone can open and modify a file,

sudo chmod 777 path-to-file

You just need to replace ‘path-to-file’ with the original path & name of the file. This command actually provides full permissions to every user who can access the machine.

To limit the file permissions, run the below mentioned command instead of the above one:

sudo chmod 644 path-to-file

The above command restricts any kind of modification to the file. After running this command every user can open the file, but can’t modify it except the the owner. You can also modify permission on a folder and its complete content by adding the -R after the command name.

Chown, is used to provide ownership of a file to a specific user. In case you do not have access permissions on a copied file, then run the following command:

sudo chown user-name path-to-file

Establish a Shell Connection for Remote Mac

Terminal session can also be run on a remote machine, therefore all the commands can be executed on the remote Terminal instead of the local one. The encrypted connection means none of the traffic is passing between the two systems.

Before starting the session make sure that you have enabled SSH log-ins on the remote session. To do this, open System Preferences and choose Sharing pane, now select the Remote Login check box, and then the SSH service will activate.

Execute the follwing command to run terminal on local machine to connect to a remote computer via SSH, :

ssh -l username remote-address

write your usernal instead of ‘username’ on the remote Mac and type original remote-address and press enter.

Here are the most popular Terminal command you can use to customize your Mac to save your time and increase the performance of your Mac machine.

Author Bio: – This post is written and edited by Vishal. He is writing on Mac data recovery software & solutions from last 3 years. He shares great knowledge on HFS, NTFS, FAT and ExFAT hard disk drive recovery. You can drop him your Mac data recovery queries @facebook