Linux open folder from terminal

6 Ways to Open Folders in Ubuntu 20.04 LTS

Opening folders in Ubuntu is one of the basic tasks you will perform as a regular Ubuntu user. Although there are many ways to do so, we all have our preferences in which way to opt for when accessing folders on our system.

In this article, we will explain some ways to:

  • Open a Folder In the File Manager (Nautilus)
  • Search and Open a Folder through the Dash
  • Access a folder In the command line (Terminal)
  • Open a folder in the Terminal through the File Manager
  • Open a folder in the File Manager through the command line
  • Access a Folder as Administrator from the File Manager

We have run the commands and procedures mentioned in this article on a Ubuntu 20.04 LTS system.

Open a Folder In the File Manager (Nautilus)

The latest versions of Ubuntu, like Ubuntu 20.04 LTS or Ubuntu 21.04, come with a default file manager by the name of Nautilus. This open-source file manager created for our GNOME desktops gives us a way to manage our files and folders.

You can access the Nautilus File Manager in the following ways:

1.Searching for the term ‘Nautilus’ from the system Dash:

2. Searching for the term Files or File Manager from the system Dash:

3. Accessing the File Manager from the Files icon in the Ubuntu Dock/Activities panel.

The File Manager opens in your Home folder by default. In Ubuntu you can open your required folder by double-clicking it, or by choosing one of the options from the right-click menu: Advertisement

  • Open
  • Open In New Tab

and,

  • Open In New Window

Search and Open a Folder through Dash

The Dash search lets you open a folder directly, rather than browsing it from the File Manager. Simply type the folder name in the Dash and the search results will display based on your criteria.

Through a simple click, you can open the relevant folder(see the path in case multiple search results show).

Open a folder In the command line (Terminal)

The Ubuntu command line, the Terminal is also a non-UI based approach to access your folders. You can open the Terminal application either through the system Dash or the Ctrl+Alt+T shortcut.

Читайте также:  Максимальное количество оперативной памяти windows server

Here are some of the commands and symbols that will help you in browsing folders in the command line:

The cd or change directory command allows you to change your directory, or in other words, open a new folder. When you open the Terminal, you are in your home directory. The following command will help you in opening the folder of your choice:

In the above image, we have first listed the folders in the current directory through the ls command and then opened the Downloads folder through the cd command. The command prompt of the Terminal, by default, shows the current folder you are in.

The tilde (`) symbol

The tilde symbol represents our home directory. You can use this symbol in the cd command to move to a folder in your /home/[user]/ directory.

In the following image, I will open the snap folder from my home directory, and then directly open the Downloads folder from my home directory by using tilde:

The tilde symbol here has helped me in avoiding going back to the home folder first and then opening the Downloads folder.

The pwd command stands for print working directory. If you want to know the exact directory path you are currently in, simply use the following command to do so:

The ‘/’ symbol

The / symbol with the cd command helps you in directly opening the root folder.

The ‘..’ symbol

The ‘..’ symbol with the cd command helps you in navigating up one directory level:

The ‘-’ symbol

The ‘-’ symbol with the cd command helps you in going back to the previous folder you were in, before navigating to the current folder. You can think of this command as the ‘Previous Channel’ button on your tv remote control.

In the following example, I was in the /home/user/Downloads folder. Then I used the ‘..’ symbol to go back to my home folder. Now if I want to go back to the Downloads folder, I can use the following command to go back to the Downloads folder:

Open a folder in the Terminal through the File Manager

In order to open a folder from the File Manager to your Terminal application:

Right-click the selected folder and select Open in Terminal from the menu as follows:

Open a folder in the File Manager through the command line

If you are in the Ubuntu command line and want to open a specific folder in the UI File Manager, you can use one of the following two ways:


or

Access a Folder as Administrator from the File Manager

While working with files and folders as a Linux Administrator, we frequently need to access and edit files and folders that require root permissions. We usually perform this task through the Ubuntu Terminal(the command line utility) using the sudo function. Here is a workaround to do the same through Nautilus Admin application.

Читайте также:  Focusrite scarlett 2i2 1st gen driver windows 10

Install Nautilus Admin

The following steps will help you in installing the Nautilus file manager to your Ubuntu system:

Open the Terminal through Ctrl+Alt+T or through the Ubuntu dash.

Run the following command as an administrator:

Enter Y when prompted about the use of additional disk space.

Nautilus Admin will be installed on your system. You can open it by entering Nautilus in your Ubuntu Dash as follows:

The file manager in your system is now Nautilus Admin.

Opening a Folder as an Administrator

Let us suppose that you need to open a folder that requires root permission. You can access the folder through the UI file manager; right-click and then select Open as Administrator from the menu.

In this example, we want to access the root folder from Other Locations. Since this folder requires root privileges, we will access it as follows:

You will be asked to provide authentication information, after which you will be able to access the contents of the folder.

By now, you must have mastered accessing your Ubuntu folders both through the command line and the UI. You are now even able to open sensitive folders as administrators in Ubuntu.

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Источник

Open a Command Prompt or Terminal to a Specific Folder in Windows, Mac or Linux

Work with folders and files often in the Command or Terminal window in Windows, Mac or Linux? You’ll save time by opening it directly to a specific folder.

To go to a specific folder on the command line, generally, you must use the cd command and know the exact complete path to the folder you want. But there’s an easier way. You can open a PowerShell window, Command Prompt window, or a Terminal window to a specific folder from within the file manager. Today, we’ll show you how to do this in Windows, Mac, and Ubuntu Linux.

Windows 10

On Windows, you can press the Shift key and right-click on a folder to open a PowerShell window directly to that folder.

The article linked to above also shows you how to add the “Open command window here” option to the context menu when you’re in a folder.

A Command Prompt (or PowerShell) window opens directly to the selected folder.

macOS

To open a Terminal window to a specific folder from Finder, you must make sure the New Terminal at Folder and New Terminal Tab at Folder services are activated.

To activate these two services, select System Preferences from the Apple menu.

Click Keyboard on the System Preferences dialog box.

On the Keyboard dialog box, click the Shortcuts tab at the top and then select Services on the left.

Читайте также:  Stsw stm32102 windows 10

Under Files and Folders on the right, check the New Terminal at Folder and New Terminal Tab at Folder boxes.

You can add shortcuts to these two services to make it faster to open a Terminal window to a folder. Click None to the right of the service you want to add a shortcut to.

Click Add Shortcut and then press the shortcut you want to use for the service. Make sure you select a shortcut not used by the system. We found it hard to find a unique shortcut because there are so many shortcuts already set up in macOS.

Also, you may have to click Add Shortcut again and then press Enter to get your shortcut to stick.

To open a Terminal window from within a folder in Finder, navigate to the folder you want. Do not go into the folder.

Select the folder, right-click on it, and go to Services > New Terminal at Folder to open a new Terminal window to the selected folder. If you want to open a new tab in an open Terminal window, go to Services > New Terminal Tab at Folder on the right-click menu. Opening a new tab on an existing Terminal window requires the window to be active, not minimized.

If you set up shortcuts for the two options, select the folder and press the shortcut for the option you want to use.

A new Terminal window opens directly to the selected folder if you selected the New Terminal at Folder option.

Selecting the New Terminal Tab at Folder option opens a new tab on the active Terminal window directly to the selected folder.

To remove the New Terminal options from the Services menu, go back to Apple menu > System Preferences > Keyboard > Shortcuts > Services and uncheck the two options on the right.

Linux

Here I’m using Ubuntu to open a Terminal window to a specific folder in Linux. The procedure may vary a bit on other Linux distros like Linux Mint, Zorin, and Fedora.

Open the Files app (which used to be called Nautilus), from the left sidebar. Go to the folder you want to open in a Terminal window, but don’t go into the folder.

Select the folder, right-click on it, and then select Open in Terminal.

A new Terminal window opens directly to the selected folder.

Save Time Navigating to Folders in a Command or Terminal Window

You can use the cd command to navigate to a folder on all three systems. Or, you can copy a full path to a folder and paste it into the Command or Terminal window. But if you do that, remember to insert backslashes in front of all the spaces in the path.

But the options we showed you here are easier and faster. And if you work with folders and files often in the Command or Terminal window, you’ll save time and be more productive.

Источник

Оцените статью