Dec 16, 2024 • Filed to: Solve Mac Problems • Proven solutions
When people heard the word Mac Terminal, they get scared thinking that using Terminal is very hard. But the truth is quite the opposite. Once you get a hold of Terminal commands, it will become easy for you to carry out even the complex task on Mac easily. So, in this article, you will learn how to open and use Terminal on Mac.
Just like the Windows command line, Mac Terminal is the command-line system that helps the users to take control of the operating system and make changes in it. The best thing you can do to learn using Terminal is to start using it. The most important thing you need to learn is commands.
All you need to do is to type the command and hit Return to execute it. Every command has three components, the command itself, an argument, and an option. The command is self-explanatory; the argument tells the command the source where it should operate and the options work as a modifier for the output.
For example, if you want to move a file from one folder to another, the command used will be- mv. Then type the location where the file exists and add file name and location where you want to move it.
While you are using the Mac Terminal, you should know about the basic rules too.
The macOS terminal is a tool that requires skills and intelligence to learn. You will have to pay attention to even the smallest detail to ensure that you don't make mistakes. From learning how to open the file via Mac terminal to terminal deletion, every single command matters. Here are some basic commands that you need to understand if you want to improve your terminal knowledge.
If we start learning, the macOS terminal commands won't come to an end. So, in this article, we will only learn using some basic commands like deleting files, show hidden files, change folder permissions, etc.
There is no doubt that Terminal is a handy tool for Mac users. Therefore, it is vital that you know all the ways there is on how to open a terminal on Mac. Here are all the ways that are used to open Terminal. Take a look and use the one which suits you best.
It is one of the quickest and easiest ways to open Terminal on Mac. If you have the Spotlight search button in the menu bar, then click on it directly. Or use the keyboard shortcut by pressing the Command + Space keys. Type terminal in the space and you will see the Terminal utility in the result. Double-click on the option and the Terminal will open up.
Another method to open the terminal is using the Finder. Click on the Go option from the Utilities and you will find the Terminal option in the Utilities folder. Simply double-click on the application and it will open.
You can also use the Finder to open the applications folder and access Terminal from there. Open Finder and click on the Application option from the left side panel. Expand the Utilities folder and there you will find the Terminal option. Double click on it and the Terminal will open up.
If you have a shortcut for the Applications folder on Mac, then you can directly locate the Terminal application from the list.
You can also use Launchpad to open Terminal. It depends on whether you have organized the Launchpad or not. There are two ways to open the Terminal using Launchpad.
By default, the "Other" folder of Launchpad contains the Terminal application. You can open Launchpad from Dock or by using a keyboard shortcut, i.e. Fn+ F4 keys. Find the other folder and you will find terminal inside the folder.
If you have arranged the Launchpad in a different way, then you will have to type Terminal in the search box. As soon as the terminal icon appears on the screen, click on it and it will open up.
A big thanks to Apple Inc, now users can use Siri to find anything on their Mac too. All you need to do is to open Siri and say "Open Terminal". Siri will take care of the job and terminal will open up on your Mac. You can easily access Siri from the shortcut button or find Siri in the Applications folder.
If you use Terminal more often, then it will be better if you create a shortcut on the desktop or Dock for it. This way, opening a Terminal will be more convenient for you. Select the Terminal application from Utilities or from the "Recent" applications in Dock and right-click on it. It will open some options in a small pop-up window. Scroll the mouse pointer over "Options" and you will see few options. Pick whether you want to keep Terminal in Dock, show it in finder, or open it at login.
All of these methods are simple and easy. So, pick whichever is more comfortable and you will be able to access Terminal with just one click.
Here is a list of some common commands used in Terminal. These commands will provide you a short and precise method to carry out the task.
Removing files using the terminal is a much more convenient method to delete files and folders permanently. You can delete multiple files quickly and efficiently. The terminal can also be used to delete files from Trash.
To delete files from Mac, the rm command is used. As you launch the terminal and type cd ~/Desktop to get to the desktop directory, find the file that you want to delete and enter its name. For example, if you want to delete MyFile.rtf, then you will pass the command as- rm MyFile.rtf and the file will be gone forever. To delete multiple files, just leave space between the file names and hit the Return key and Terminal will take care of the rest.
Some people would say why they need to learn how to open a finder from the terminal. Well, it comes in handy when the OS is not working properly or you have to find the hidden files. For this, the command passed will contain the following components:
Just type open. and press the Return key and a Finder window will open up.
If you want to view hidden files and folder in the macOS, you'll have to use the show hidden files Mac terminal command. Write the command as-
$ defaults write com.apple.finderAppleShowAllFiles –bool TRUE
$ killall Finder
As you hit Enter, the command will execute and you will see a lot of files in the Finder window that you can't see because of privacy. To reverse the process, you just have to change TRUE into FALSE and the files will become hidden again.
As we discussed above, Terminal can be used to empty trash too. To empty trash using a Mac terminal, you will have to follow some different steps.
Step 1: Type the command as sudo rm –R without pressing the Enter key and control-click on the Trash icon to open it.
Step 2: This will open the Trash folder. Select all the files that you want to delete and drag them to the terminal window. Then press the Enter key and provide the admin password.
When you enter the password, you won't see any change in the Terminal screen. After that, press the Enter key again and the trash files will be deleted from your Mac.
It is possible to change the file permission of a file and folder using the Finder, but Terminal gives you better control and flexibility. Permissions are assigned considering user, Group, or others and have attributes such as read, write, and execute. To change permissions, you will have to use the chmod command. It runs in two modes, i.e. absolute and symbolic. For beginners, it is better if they stick to the symbolic mode as Absolute mode is for advanced users. This is how you can change folder permissions using the Mac terminal.
For a file or folder, you will have to specify the category (user, group, others, or all three), type of operation (e.g. add permissions, delete permissions, clear permission, or use the default), and the permission itself, i.e. read, write, or execute. Suppose you have a folder which has permission like- drwxr-xr-x and it means:
Type cd and drag the folder whose permissions you want to change. This way, you won't have to specify the location of the folder as it will copy the path.
Type the command ls –l in the terminal to reveal all the subfiles, sub-folders, and their permissions. Now to change the permission of any folder or file, type- chmod 01234567 and the path file folder such as type chmod 755/bin which gives the bin folder Read/Write/Execute permission to the folder.
To repair disk using a Mac terminal, you will have to follow a simple procedure. The command to repair disk is direct- diskutil repairvolume /. Before you get to this, it is important that you determine the repair your disk needs.
You simply have to type the command with the location of directed at other volumes such as- diskutil repairvolume /Volumes/ExternalBackups/ and hit the Return key to execute the command. The repair disk command will resolve all the issues on the disk.
Here are some tips for opening and using a Mac terminal so that you can avoid common mishaps.
If you somehow end up making a mistake while using the Terminal and end up losing your files, then you still have an option to get them back. If you use Recoverit data recovery software for Mac, you can retrieve all files that are lost or deleted from Mac with just one-click.
In this article, we learned how to open and use Mac Terminal in detail. As the commands and use of Terminals extend to the limit of words of this article, you can always learn a new thing. All the things you have learned from this guide will surely come in handy. And if you happen to fall prey to data loss situations, then you will still have access to Recoverit Mac Data Recovery to get the important files back on the device. Recommend this Mac Data Recovery tool to your friends and family and help them to retrieve their lost or deleted files.
Sue Wayne
staff Editor