In a Linux-based operating system, navigating through directories is challenging. A directory is a path where your subdirectories or files are stored.  Ubuntu 22.04 provides the facility of the terminal as a command line interface tool for interacting with directories and has a GUI File Manager (Files) to open and interact with the directories directly.

In this article, we’ll explain how you can interact with the directories.

How do I list only directories in Linux ls (Ubuntu)?

To enlist the directories only we use terminal and GUI File Manager in Ubuntu. If you want to list only the directories in Ubuntu 22 follow these two methods:

Method 1: Using Terminal

Open your terminal window and execute the following command

$ ls -l | grep ^d

The command will list down all the directories of the parent directory

If you want to list down all hidden directories as well, type and execute the following command

$ ls -al | grep ^d

Method 2: Using GUI

Click on the Files icon on the Ubuntu desktop:

It will open the directories in it:

It will not display the hidden directories, To display hidden directories proceed with the following step:

Click on the Hamburger menu on the right side of the window:

Check the Show Hidden Files option:

But keep in mind it will also display the files and the directories. These were some methods to list down directories in Linux Ubuntu 22.04.

Conclusion

To list down directories use the terminal with the command “ls -l | grep ^d” and to view hidden directories use the command “ls -al | grep ^d”. You can also use the Files folder to navigate through the directories, and list down the directories. In this article, we have learned how to list down directories with different commands.  

Frequently Asked Questions

How do I list only directories in Linux using ls command in Ubuntu terminal?

To list only directories in Ubuntu terminal, you can use the command 'ls -l | grep ^d'. This command will display all directories in the current directory.

What is the command to list hidden directories in Linux using ls in Ubuntu?

To list hidden directories in Ubuntu using ls command, you can execute 'ls -al | grep ^d'. This command will show both visible and hidden directories.

How can I view directories in Linux using GUI in Ubuntu 22.04?

To view directories in Ubuntu using GUI, click on the Files icon on the desktop. It will open the directories. To display hidden directories, click on the Hamburger menu and check the 'Show Hidden Files' option.

What method can I use to list down directories in Linux Ubuntu 22.04?

You can use the terminal with the command 'ls -l | grep ^d' to list directories in Ubuntu 22.04. Alternatively, you can use the GUI Files folder to navigate through directories.

How do I list only directories in Ubuntu terminal without displaying files?

To list only directories in Ubuntu terminal without displaying files, use the command 'ls -l | grep ^d'. This command filters out only directories from the output.

What is the easiest way to find directories in Linux Ubuntu?

The easiest way to find directories in Ubuntu is to use the 'ls -l | grep ^d' command in the terminal. This command specifically lists only directories.

Can I use a shortcut to list directories in Ubuntu terminal?

Yes, you can use the shortcut 'ls -l | grep ^d' to quickly list directories in Ubuntu terminal. This command provides a concise way to view only directories.

How do I navigate through directories in Ubuntu without using the terminal?

You can navigate through directories in Ubuntu without the terminal by using the GUI Files folder. Simply click on the Files icon on the desktop to access and interact with directories.