Apple's macOS platform includes Terminal, which is equivalent to Command Prompt in Windows OS. Since the macOS is based on UNIX, Terminal might give you a vibe of a dangerous tool where one wrong command can wreck your system. Sure, it is valid only to an extent. There are a bunch of harmless commands that are usable in customizing the interface and other settings of macOS.
List of my most used commands and shortcuts in the terminal for Mac - 0nn0/terminal-mac-cheatsheet. List of my most used commands and shortcuts in the terminal for Mac - 0nn0/terminal-mac-cheatsheet. List of my most used commands and shortcuts in the terminal for Mac 131 commits 1 branch 0 releases Fetching contributors Branch.
- Feb 06, 2017 Getting Info & Explanation for Each Terminal Command. You can easily retrieve information and an explanation on any of the shown commands by using the handy open man page trick, which will launch a manual for the chosen command into a new terminal window.Here’s how it works in the context of the all inclusive commands list on Mac OS.
- Using Mac terminal is a straightforward process, just enter the command and hit ‘Return’ to execute. With Terminal application, a simple command is all required to spill every function on mac. Source: gadgethacks.
- This tutorial will teach you how to to run commands from the command line on mac. Check out DevMountain's website: Windows command cheat.
- The Terminal application in your Mac is a window to the internal working of the system, and it can allow you to change a lot of settings, and access a multitude of features, if you know how to do it.
The Terminal on macOS can be extremely useful in tweaking the performance of your Mac. Now it entirely depends on what you want to achieve. In case you have been dreading to use it, you can always get comfortable by using simpler tricks. Here are the top 11 terminal command tricks to try on your Mac.
Also on Guiding Tech
How To Speed Up a Slow Mac
Read MoreNote: While selecting/copying a command, make sure you scroll all the way towards right to select the complete command in the gray box. Otherwise partial commands will not work as intended.1. Open Folders
One of the coolest ways to get familiar with the Terminal is to use it to open files and folders. I know that clicking on Finder will do the same. However, using Terminal, you can open a specific folder or a file without exposing your file structure to anyone.
Let's say you want to open your Documents folder. Then you can type the following command and then hit Enter.
And that opens my Documents folder. There's a DOCX file in there. I can use Terminal to open that too. For that, you need to type out the command with some requirements — the path of the respective file:
Open -a 'Application Name' /Path/to/File
So for opening the DOCX file in the Documents folder of my Mac, I typed in the command below and then hit Enter:
That opens up the specific file using the predefined program. You can also use the wildcard character (*.extension) instead of the full filename. However, if you have more than one file in carrying the same extension, then it might freeze your Mac for a bit.
2. Change Default Save Screenshot Location
By default, the macOS Mojave stores the screenshots on the Mac's desktop. Now if you have iCloud sync enabled, which I am sure you do, then it keeps uploading to your account. Thankfully, you can change the save location for the screenshots instead of crowding your desktop.
Here's the command you need to type before hitting Enter:
In the above command, you can provide any specific file location instead of ~/Downloads as shown.
After hitting Enter, I need to reset the SystemUIServer for the changes to take effect immediately. So feed in the following command.
Though it is not required, I would recommend restarting your Mac.
3. Change Screenshot Image Type
The macOS saves the screenshots in JPG format by default. You can change that to save them in PNG or PDF formats too. Here's how to do that quickly with this specific command:
After that, you need to kill the SystemUIServer again.
Most commands which require some system changes shall mandate shutting down the SystemUIServer. So do that quickly.
Now, your new screenshots will save in the PNG format. Do note that PNG files are generally larger than JPG files. So keep an eye on how much storage space they consume.
4. Show Hidden Files
Have you tried looking for the option to let the Finder show hidden files? Well, it is tougher than picking the show hidden files on Windows. I always forget how to enable that. Thankfully there is a helpful command that makes it happen in a few seconds.
After that, you need to force shut the Finder.
Now you should see a lot of hidden files in the Finder. They would be greyed out but still visible. If you roll back this change, then you need to change TRUE to FALSE in the command.
5. Switch Off the Dashboard
Apple promoted the Dashboard view to access calculator and sticky notes quickly. I bet you rarely use that one for you can launch the Calculator app or Sticky Notes app using Mission Control of Spotlight. So you can switch it off and don't have to worry about opening it by mistake.
Here's the command to turn off the Dashboard.
Next, you must kill the Dock so that the changes are correctly applied.
Now I don't have to worry about accidentally opening the Dashboard. If you want to switch it on again, then change TRUE to FALSE in the command.
Also on Guiding Tech
How to Install New Fonts in Mac OS X
Read More6. Download Files
https://zlpfbn.weebly.com/free-recovery-software-for-mac.html. Did you know that you can download files using the Terminal? Yes, you don't need to keep the browser running just for that file. The only requirement here is that you must have the file's download link. So the command syntax is:
curl -0 downloadlink
First, navigate to the folder where you want to download the file. For that, you need to switch to the Downloads directory.
After that, you can feed the command to download the VLC for macOS from the official site. It would appear something like this:
Note: There is a letter O in the command and not the 0 (zero).7. Ditto for Backups
Copying files and taking backups on macOS is quite swift — thanks to the SSDs and the flash storage. However, it does take a while to copy a large amount of data. Thankfully, Terminal offers a useful command to copy files. Here's how you can do it while watching the name of files that the command copies.
ditto -V /currentpath/ /new/path/
So I want to copy the DMG downloaded in the previous section to the desktop.
That should do the needful. If you want to copy the files to an external drive, then you need to provide the destination path correctly.
8. Always Show File Path in the Finder
If you have switched from Windows recently, you would have noticed that the Finder on macOS doesn't show file path like the Explorer in Windows. However, you can force Finder to show you the file path with this command:
After hitting enter, you need to stop the Finder.
After you hit Enter, the Finder will relaunch. Then you should see the file paths at the top of the Finder window.
9. Power Chime on Connecting the Charger
Has it ever happened that you've connected the MagSafe charger to your Mac but forgot to flip on the power switch? I have lost the count. Thankfully, I stumbled upon this useful command that provides an audio feedback chime whenever I connect the MagSafe charger.
Feed this command in the Terminal and hit Enter.
10. Stop Your Mac from Sleeping
Often you are downloading a massive file, and you don't want your Mac go to sleep. If it is a temporary requirement, then a simple command can make it happen. Just type the following command, hit Enter and walk away from your Mac.
In this command, the number 600 signifies seconds. So with this command, the Mac won't sleep until 10 minutes (600 seconds). You can enter a relevant number of seconds or just the word 'caffeinate' to prevent your Mac from sleeping.
However, if you close that Terminal window, then the command will stop executing and the Mac will go to sleep on a predefined time.
11. Check Your Mac's Uptime
Wondering how long it has been since you've restarted your Mac? A simple restart can sort a lot of things in order and boost your Mac's performance. Here's a command to check your how long your Mac has been running without a Restart or a Shutdown
That should give you all the details with a timestamp.
![Address Address](/uploads/1/3/4/0/134050817/111529704.jpg)
Also on Guiding Tech
#productivity
Click here to see our productivity articles pageUsing Terminal Is Fun
The Terminal is an absolute delight to use and tinker around in the macOS. However, we would strictly advise against using random commands provided by unverified sources or strangers. Other than that, these commands should run on latest macOS Mojave update till last few versions.
You should always double-check the Terminal commands that involve removing, deleting or disabling any service. If you stick to our list, then you would be confident of using Terminal like a pro.
Next up: Are you bored of the same old Lock Screen on your Mac? Here is a nifty guide that will show how to customize the lock screen on your macOS Mojave running Mac.
Read NextHow to Customize the Lock Screen on macOS 10.14 MojaveAlso See#terminal #macos Did You Know
Apple Watch can be used to unlock your Mac.
More in Mac
13 Best Apple Pages Templates to Increase Your Productivity
Honestly, command line belongs to long gone days; when people use to control computers by typing mystical commands into a black & white interface. If you are someone who has used computers for decades but never touched command prompt than *high five*.
No wonder, it actually sounds scary and overwhelming! But recently when I encountered the situation where I had to learn basics of Mac command line, I discovered it quite friendly and useful.
If we talk about today’s scenario there are several use cases, where command line is still an absolute requirement!
For readers, who have little or no idea about what Mac Terminal is, here’s a small gist for you. Continuing with 10 Best Terminal Commands, every mac user should know:
Introduction to Mac Terminal
Mac Terminal is nothing but a replica of Windows Command Prompt. It allows users to modify various characteristics of their Mac systems, fonts, files and functions more beyond the standard OS X (GUI).
It’s a text interface, a program that takes in commands for your computer to run. Using Mac terminal is a straightforward process, just enter the command and hit ‘Return’ to execute.
With Terminal application, a simple command is all required to spill every function on mac.
How To Open Terminal On Mac?
Terminal allows you to access the UNIX part of macOS, so you can run scripts, manage files and edit settings using text commands. To launch the Terminal application, use Launchpad, Spotlight or Finder.
Open Terminal On Mac: Using Launchpad
Launchpad is a silver rocket icon present in the Dock. Dock is a panel of menus generally located at the bottom of the screen. Either click on the icon or press F4 to open Launchpad. Once you open it > Click on ‘Other’ folder > Click on ‘Terminal’ app to launch the command prompt of Mac.
If you are unable to find the application through Launchpad you can try other methods mentioned below.
Open Terminal On Mac: Using Spotlight
Spotlight looks like a magnifying glass icon; either you can find it in the dock or use shortcut cmd + space bar. Type ‘Terminal’ into the search box > Terminal will appear in the search results, click it & proceed with the command prompt.
Open Terminal On Mac: Using Finder
Finder is alike Windows Explorer; it organizes your files, folder, apps, and documents and helps you to locate them when you misplace them. Present at the bottom of the screen and looks like a two-toned smiling face icon. Once it’s opened, locate ‘Applications’ folder in the left panel. If you don’t find their head towards the top, choose ‘Applications’. Now, click on ‘Utilities’ & scroll down to find ‘Terminal app > Double-click to launch it.
When launched, Terminal provides a line interface that gives you access of the UNIX features that lie beyond the world of macOS.
How to Get Airdrop on Your MacOS Dock?Airdrop is a very frequent for Apple users. For those who are not familiar with how to use Airdrop and..
Basic Utilities You Will Use On A Regular Basis
Using mac terminal commands are super-easy. What is the default browser for mac os x?. Anything written in capital letters with dollar sign ($), like for example “$THIS” is an argument, you have to replace it with the actual argument you want to run.
Argument | Use |
man $UTIL | man – manual, $UTIL is used to get information about all the utilities in your machine. |
ls $DIR | ls – list, list of contents of the directories. |
cd $DIR | cd – change directories, if you want to change current working directory. |
cp $FILE $LOCATION | cp – copies, it copies $FILE to $LOCATION |
mkdir | Mkdir – make new directory. |
pwd | pwd – print working directory, if you ever get lost on your mac, run this command to see where you are. |
mv $FILE $LOCATION | mv – move, it moves $FILE to $LOCATION |
rm $FILE | rm – remove, to remove a file permanently. |
sudo $CMD | sudo – super user do, in simple language it allows users to perform root tasks on a case by case basis. |
killall | If you want to force stop certain commands from running. |
How To Use Terminal On Mac?
Now that you have learnt ‘How to open Terminal on mac’, here are some useful Mac terminal commands & tricks that every user should know:
A command consists of three elements: First, the command itself which calls a particular tool, an option which modifies the output, and an argument which calls the resource on which the command will operate.
So, for an instance if you want to move a file from one place to another, you would use the command move “mv” followed by the file and location where you want to move.
So, you have to enter the following command:
mv ~/Desktop/MyFolder /Volumes/Backup
Here are 10 Mac Terminal Commands:
So, without further ado try these Mac terminal tricks:
1. Want to See Hidden Files/Folders
By default, Mac machines hide stuff for a variety of reasons. Most of the time, there’s no reason for users to know about them. But in case you want to track down those hidden files or folders you can do it using Mac command line.
Enter the following command:
defaults write com.apple.finder AppleShowAllFiles -bool TRUE
killall Finder
2. Download Files Without Using Browser
Terminal can help in downloading files when you don’t want to use web browsers. If you have the URL of the file you wish to download, just enter the following commands.
You have to execute two simple commands, first ‘set the location’ where you want to store your downloaded files. Second, ‘download the file’.
Note: To add the location, either type the full path of the location or you can drag and drop folder as well.
First Command: Set the Location
cd ~/Downloads/
(Change ‘Downloads’ to a different folder if you want)
Second Command: Download File
curl -O (Enter the URL of the file you want to download)
3. Keep your Mac Awake
Prevent your Mac machine from sleeping. How? Give it some caffeine. Yeah not kidding! Caffeinate is our next command. Just use the command and specify an elapsed period of time you want your system to be active!
Run: caffeinate – u – t 5400 ( 5400 are the number of seconds)
4. Ditto
Key Commands For Mac
The most popular command used in OS X is Ditto. It’s an incredibly useful command when it comes to copying huge amount of data from one folder to another.
Just type: Ditto – v / Old Folder / New Folder
At the place of ‘old folder’ and ‘new folder’ you have to add the paths of the source and destination of the files. You can see each file in the terminal window as they’re copied from one place to another.
5. Change Location for Screenshots
If you don’t want your system to save screenshots on your Desktop, you can change its location using terminal application. To do so, run the following commands:
– Type: defaults write com.apple.screencapture location (path of the folder where you want screenshots to be saved)
– Click Return
– Type: killall SystemUIServer
How To Download iPhone Apps Not Available in..There is a brand-new app launched, you want to download it, but the ‘item you requested is currently not available..
Notebook for mac. 6. Change Screenshot File Format
Want to change the file format of screenshots? Using this Mac command line, you can change the default PNG format into PDF, JPEG and more. In the following example we’re changing the default format to PDF.
Execute the following command:
defaults write com.apple.screencapture type PDF
Basic Terminal Commands For Mac
To revert the changes, run the same command again and type PNG in place of PDF.
7. Make your Mac to Automatically Restart After a Crash
We all have faced the issue when our Mac suddenly freezes or crashes. If you don’t want to waste time while it crashes and faces long time system freeze. Then, the following command can help you to reboot your system automatically.
Type: sudo systemsetup – setrestartfreeze on
Remember whenever you’ll use ‘sudo’ command the system will ask you for your Mac username and password. Enter it and proceed.
8. Have a Speaking Mac
Yes, you can make your system to speak. To do so just use the command ‘say’.
say (type whatever you want your Mac to say)
Click ‘Return’ button and it will speak whatever you’ve typed.
9. Play Tetris, Pong and Other Retro Games
You know there are several hidden games in your Mac including Tetris, Snake, Towers of Hanoi, Pong, Solitaire and more.
Want to play them, follow the instructions below:
– Type Emacs and click Enter
– Hit Fn key
– Hit F10
– Then ‘t’ and then ‘g’
![For For](/uploads/1/3/4/0/134050817/358320642.jpg)
You will be presented with all the available games on your machine. Use cursor to select them and Start Playing!
10. Securely Erase Data
Everyone has to certainly delete all the data at some point. After all, a securely deleted data ensures safety of personal information. Even, when you delete data from your system, it leaves fragments of files all over your hard disk drive. In case you want to safely remove all the remaining fragments, then you can execute the coming command.
diskutil secureErase freespace 3 / volumes / name-of-drive
At place of ‘name-of-drive’ you have to type the name of the drive you want to erase data from.
Another Alternative to Securely Erase System Data
If your goal is to permanently delete files and folders from your system or securely delete them in a way to save them from privacy breaches, it’s far better to use an app designed for the purpose. Systweak’s TuneupMyMac is one such app. It’s one-stop solution to all your Mac’s problems. From cleaning junk files to optimizing mac’s performance, it does every task for you.
A major functionality of this multipurpose tool is the Shredder utility. It not only securely removes the sensitive information from your system, but also recovers valuable disk space. This permanent data removal feature ensures all data fragments are permanently deleted making recovery impossible. The software uses powerful wiping algorithms that remove all the deleted data from Mac machine.
Apart from this, TuneupMyMac has several other features as well that enhance your Mac performance in just few clicks. You can download the app from here.
Is there any Mac terminal command you find very useful and we didn’t mention? Do write us in the comment section! Also, please feel free to share interesting Mac terminal tricks on our social media handles.