16 Useful MacOS Terminal Commands You Probably Do Not Know

Mac’s are not known for their customization options, but there are lots of hidden terminal commands which can help you to modify settings with just one or two lines of codes.

What is Terminal?

Terminal is an app which is included with MacOS inside Utilities folder that is a text-based way to use your operating system. You can interact with your mac using just Terminal commands instead of a mouse and graphical interface. Most of us don’t use Terminal on daily basis but there are lots of tweaks and settings that can be changed through Terminal.

Using Terminal: Open it up from the utilities folder, type in the command and press return. This will manipulate some files, launch settings, etc. It looks complicated but it is actually not.

Today, we’re going to look at some commands that enable or tweak hidden MacOS options. Just copy and paste the command from this post, paste it into the Terminal, and press Return to try them out. Here are some of our favorite tweaks.

Also Read: 8 Best Alternatives to Notepad++ for Mac OS

Customize MacOS’s Look and Feel

People love to customize their machine’s to work efficiently. Some commands here can help you to modify the position of the dock, the scrollbar, or see hidden files. These are not allowed outright by MacOS.

1. Move Your Mac’s Dock to the Corner

Move your dock from bottom of the screen

Don’t want the dock to be at the center of your screen. You can move it to any corner you want with this Terminal command:

defaults write com.apple.dock pinning -string end 

killall Dock

If you want to move the dock to top or back to the default, just replace the word end with start or middle.

2. Show Hidden Files by Default

see hidden files with command below

MacOS hides a lot of system files so that the users can’t mess up the system. Sometimes, we need to access these hidden files. To see them, the Terminal command is:

defaults write com.apple.finder AppleShowAllFiles true

killall Dock

To hide the files again, just switch true to false.

3. Use Your Screensaver as Your Wallpaper

screensaver as your wallpaper

By using this following command you can convert your screensaver to your current wallpaper. Though, running this command may slow down your Mac as it requires more system resources. The Terminal command is as follows:

/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background

4. Keep your Mac from falling asleep

disable mac to sleep

You Mac automatically sleeps on its own to preserve battery and resources, but sometimes you need to temporarily keep it awake while doing a certain task. To do this, the command is:


To disable this command at any time press Control+C.There is another command:

caffeinate -t 3600

This command will keep your Mac awake for 3600 seconds and the command will disable itself. To disable this command early press Control+C.

Also Read: 10 Super Cool Notepad Tricks You Need to Know

5. Enable Key Repeating

enable key repetition

This command is a fix rather than a trick. As you might know that when you hold down certain predefined keys on the Mac, it displays some special characters if they are assigned some. However, some people may want their key to repeat as previous computers did. The following Terminal command will enable you to do so:

defaults write -g ApplePressAndHoldEnabled -bool false

To disable the same, just replace false to true.

6. Disable the Startup Chime

When Mac boots up there is a loud chime that’s there to tell you that everything is working fine. It is generally not a problem for most of the users but it is often a problem in classes or somewhere where you need to keep your mac quite. To disable the sound permanently, Terminal command is:

sudo nvram SystemAudioVolume=%80

Now your mac will boot silently.

7. Make your Mac Restart Automatically After a Crash

restart mac after crash

We all have had our Mac freeze up or crash at least once in our lifetime. If you want your Mac to restart as soon as the system detects a crash use this Terminal Command:

sudo systemsetup -setrestartfreeze on

8. Add Spacers to Your Dock

blank spaces in the dock

You can manage your dock easily by adding blank spaces with this handy terminal command.

defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'

killall Dock


Repeat this command to add more blank spaces. To remove the spaces just drag it out of the dock till you see poof icon.

9. Create a Custom Login Message

custom login screen message

To add a useful message such as “in case of loss” contact information you can add personalized message using this Terminal command:

sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "In case of loss, call xxx-xxx-xxx."

10. Hide Non-Active Apps in Your Dock

hide non-active dock apps

This Terminal command hides all the non-active apps from the dock:

defaults write com.apple.dock static-only -bool TRUE

killall Dock

11. Change Your Screenshot’s File Format

change screenshot saving format

By default the screenshot’s on Mac are saved as PNG’s but you can also save them as JPG’s or PDF’s using this simple Terminal command:

defaults write com.apple.screencapture type jpg

12. Download Files Without Using Your Browser

No browser needed to download a file

You can directly download a file to your downloads folder or any desired folder if you have the URL of the file using this Terminal command:

cd ~/Downloads/

curl -O http://www.thefilename.com/thefile/url.mp3

The first command moves your current terminal position to the download folder and the second command download files from the web to that folder.

13. Copy the Contents of a Folder From One Place to Another

Drag and drop alternative

Though there is an option of drag and drop but to make the process much simpler you can always use this Terminal command to copy files seamlessly:

ditto -V ~/desktop/android/ ~/desktop/iphone/

14. Enable Single Application Mode (For Older Mac’s)

Single Application View

If you struggle with lots of distraction while working on your Mac, single application mode can be of great help to you. This command lets you see only one application at a time. It is not for everyone but it can be really helpful when you need to focus on a project/work. The command is:

defaults write com.apple.dock single-app -bool true 

killall Dock

To switch to normal view, just change true to false.

HTTP server in a folder

If you are working on some HTML project and want to quickly test it, you can simply start a web server within any folder on your Mac. Navigate to the folder using cd command and enter the following code in Terminal:

$ python -m SimpleHTTPServer 8000

The number at the end is the port number. Open your browser and visit http://localhost:8000 you can use the default port 80 if you want to and remove the port number entirely.

To turn off the server press control+c in the terminal window.

Airdrop for older mac

Airdrop is a great feature which helps you to transfer files between iDevices quickly and easily. It is only through wifi and available on newer Mac’s. To enable this feature on your old Mac, type the following commands on Terminal:

defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool TRUE

You need to restart your finder for this command to take effect using:

killall Finder

To disable this feature, just replace TRUE to FALSE.

Also Read: Simple Way To Unlock Your PC and Mac Using USB Drive


Please enter your comment!
Please enter your name here