10 Mac OS Terminal Commands that You Should Know

Do you want to customize your Mac and make it fit your needs completely? Then you are welcome to read this article about the best user and interface tricks you can easily apply to your computer. With these tips, you will get more than original system settings allow.

So let’s see how to get the most of your Mac executing these tips in Terminal.

Set the Finder

Default commands available at your Finder are just a small part of its capabilities. Did you know that you can see the hidden folders and download files from the web without using a browser? Let’s see how.

  • View hidden file content
    If you have a spoiled file on your computer or suspect that there is something hidden in the archive or package, you can apply the following command to open it:cat ~/enter/file/pathBut keep in mind that if you apply this command to a non-text file (like an image or a video file), you are most likely to see a meaningless set of characters.
  • See the invisible
    A command that helps you see the hidden files

    If you want to see what hidden files are there on your computer or if you hid one and cannot find it – make sure to use this command in Terminal:

    defaults write com.apple.finder AppleShowAllFiles -bool TRUE

    killall Finder

    To hide all your files again, change TRUE to FALSE.

  • Download files without using a browser
    To download a file having just an URL and without using Chrome or Safari, you can use the following commands: cd ~/Downloads/curl -O http://www.thefilename.com/thefile/url.mp3

    The first one will move the Terminal to a folder “Downloads” and the second one will download it to that folder directly from a website.

  • Copy and remove the folder content
    A command to help you remove the content from one folder to another

    Of course, you can simply drag the files from one place to another, but if you want to make the process automatic and even more simple, use this command:

    ditto -V ~/original/folder/ ~/new/folder/

Transform the screenshots

Use these commands to modify your screenshots easily.

  • Get rid of the drop shadows
    A command that allows you to make a screenshot without drop shadows

    If you need to make a lot of screenshots and don’t want to waste your time to crop each of them, use this command and get the content displayed in a window only:

    $ defaults write com.apple.screencapture disable-shadow -bool TRUE

    killall SystemUIServer

  • Choose the file format for your screenshots
    You can save your screenshots in different formats using this command

    You can save your screenshots not only as a PNG but also as JPGs, PDFs, and other formats. Change your photographs format the way you want it with this command:

    defaults write com.apple.screencapture type jpg

  • Remove your screenshots
    When you make a screenshot, it is usually saved to the Desktop. There is a trick to help you save it elsewhere:defaults write com.apple.screencapture location ~/your/location/herekillall SystemUIServer

Tricks to make system changes

Use these commands to expand the capabilities of your Mac OS.

  • Find out how long your computer has been active
    If your computer is working drowsily, then the time has come to restart it. Use this command to find out how long your Mac has been working:uptime
  • Change the login message

    Customize a login message

    You can add any message to a login screen to play a funny trick on your friends or add your contact info with the help of this command:

    sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText “In case of loss, call 555-555-5555.”

  • Prevent your Mac from falling asleep
    A command to keep your Mac awake

    Sometimes you need your computer to stay awake for a longer time. So if you are working on a difficult and time-consuming task or need to record your screen, make sure to use the following command:

    caffeinate

    After entering this command, you can work assured that your computer won’t go to sleep until you press Control-C.

    If you don’t want your Mac to suffer from your forgetfulness, make sure to add a number of seconds before it goes to sleep. For example, this one will keep your computer awake for an hour and a half:

    caffeinate -u -t 5400

NEXT  Get It Done Yourself: How to Clean Mac