How to open a folder on a Mac using a command in Terminal
The most common and basic way to open any folder in macOS is to go to Finder and navigate to its specific location on your hard drive.
There's also another way you can open whatever folder you want on your Mac: using Terminal.
Admittedly, accessing folders using Terminal is more complicated than navigating in Finder. So why spend more effort doing the same job? There are a few key benefits to using Terminal to open folders - things the Finder can't offer - at least in some specific situations.
How to open a folder from Terminal
To get started, open Terminal by navigating to the ' Application -> Utilities ' folder , or by typing 'Terminal' in Spotlight.
After the Terminal opens, you should basically be able to open any folder from the Mac Terminal using specific commands. The general syntax is as follows:
open /đường dẫn/đến/thư mục/
For example, to open the Pictures folder, you would use the following command:
open /Users/tênngườidùng/Pictures
This command will open the Pictures folder in a Finder window. You can then use it to access the files contained in the folder.
There are also a bunch of other short commands you can use to access specific directories. For example:
To open the Root folder, use the command:
open /
For your Home folder (i.e. the folder containing Desktop, Documents, and other user-specific folders), type:
open ~
To open the current working folder in Finder, use the command:
open .
Alternatively, you can also launch and update Mac apps from the Terminal without using Finder. For example, to open Safari, type:
open /Applications/Safari.app
You can of course replace Safari with any app on your system as long as you know its corresponding filename.
Open a folder in Terminal from the Shortcut Menu
Maybe you want to 'reverse the situation' and open a Finder folder in Terminal. In other words, make it your current working directory. This can be done by adding a shortcut that will appear when you right click.
Navigate to System ' Preferences -> Keyboard '.
Next, navigate to the Shortcuts tab . Here, click on the Services menu and scroll down to find the ' New Terminal at Folder ' option.
If you selected any of the folders in the Finder, open the Services menu from the Toolbar and choose ' New Terminal at Folder '.
This is especially useful if you frequently have to switch between the GUI and Terminal.
You should read it
May be interested
- How to clean, speed up your Macfeeling that your mac is much slower than when you first bought it, here are ways to help you speed up your mac quickly and easily to get it running at top speed.
- How to turn off 'Change File Extension' Alerts on Macif you frequently change the file extension on mac, you might get the message 'are you sure you want to change the extension?'.
- How to hide the 'Recents' folder on a Macby default, macos will automatically open the 'recents' folder when you open a new finder window. if you don't want to review your recently opened files every time you open a finder window (or see it in the sidebar), you can completely hide it or turn it off. here's how to do it.
- 5 ways to securely disconnect a removable hard drive on a Macjust like on windows, when you no longer need to use a hard drive or removable storage device, you need to safely disconnect (eject) it from your mac to avoid it. error phenomenon, data misplacement.
- Apple released macOS Big Sur 11.2.2: Fixed a hardware failure when used with a 3rd party USB-C hubapple today rolled out the new macos big sur 11.2.2 update. this is the 4th updated version of macos big sur since it was officially introduced last november.
- How to quickly lock your Maclocking your mac is one of the simple but effective ways to protect your mac against prying eyes when you are forced to leave your work but don't want to shut it down.