- 6 Ways to Open Folders in Ubuntu 20.04 LTS
- Open a Folder In the File Manager (Nautilus)
- Search and Open a Folder through Dash
- Open a folder In the command line (Terminal)
- The tilde (`) symbol
- The ‘/’ symbol
- The ‘..’ symbol
- The ‘-’ symbol
- 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
- Install Nautilus Admin
- Opening a Folder as an Administrator
- Karim Buzdar
- Linux: How to Make a Directory Command
- mkdir command Syntax
- Examples
- How to create a new director
- How to create Directories in Linux
- How to create directories in Linux with verbose option
- Setting up permissions when creating a directory
- Setting up SELinux context with mkdir on RHEL or CentOS
- Sample mkdir demo command
- Summing up
- Getting help
- How to find a folder in Linux using the command line
- Command to find a folder in Linux
- How to find folder on Linux using find command
- Finding a folder named Documents
- How to search for case incentive folder names
- How to search a folder named /etc/ in the root (/) file system
- How to hide “Permission denied error messages” when using find command
- How do I find a directory called python.projects?
- Understanding find command options
- Search folder in Linux using locate command
- Conclusion
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.
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.
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
Источник
Linux: How to Make a Directory Command
H ow do I make directory under Linux operating systems using the command prompt or bash shell?
You need to use the mkdir command to create new folders or directories under Linux operating systems. A directory (also known as folder in MS-Windows/macOS
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | No |
Requirements | mkdir on Linux |
Est. reading time | 3 mintues |
mkdir command Syntax
The mkdir command has the following syntax:
mkdir dirname
mkdir dirname1 dirname2
mkdir [option] dieNameHere
mkdir -p dir1/dir2/dir3
Examples
Let us see some commann useful examples.
How to create a new director
Open a terminal and then use the mkdir command to create empty directories. The following command would create a directory called foo:
$ mkdir foo
To list directories, enter:
$ ls
$ ls -l
The following command would create two directories within the current directory:
$ mkdir tom jerry
$ ls -l
How to create Directories in Linux
The -p option allows you to create parent directories as needed (if parent do not already exits). For example, you can create the following directory structure:
$ mkdir -p
/public_html/images/trip
Verify it:
ls -l
/public_html/
ls -l
/public_html/images/
ls -R -l
How to create directories in Linux with verbose option
Pass the -v as follows to display a message for each created directory:
mkdir -v dir1
ls -l
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Setting up permissions when creating a directory
To set directory mode (permission) pass the -m option as follows:
mkdir -m
The -m option is same as giving permissions using the chmod command. For examples:
mkdir data
chmod 0700 data
We can do the same with a single command and save typing time at the command-line:
mkdir -v -m 0700 data
ls -ld data
Setting up SELinux context with mkdir on RHEL or CentOS
The syntax is follows to set up system_u:object_r:httpd_sys_content_t:s0 as SELinux context for foo dir:
How to Create a Directory in Linux with mkdir Command with SELinux
Sample mkdir demo command
Animated gif 01: mkdir in action under Linux / Unix like operating systems
Summing up
The mkdir command in Linux is used to make new directories as per your needs. We create a new directory in current directory or given path:
mkdir my-dir-name-here
ls -l
Also make directories recursively which is useful for creating nested dirs on Linux. For instance:
mkdir -p path/to/dir1/dir2
Getting help
Make sure you read the following man pages:
man mkdir
man ls
mkdir —help
Option | Description | Example |
---|---|---|
-m ( —mode=MODE ) | Set file mode (as in chmod command), not a=rwx – umask. | mkdir -m 0644 sales |
-p ( —parents ) | No error if existing, make parent directories as needed. | mkdir -p one/two/three |
-v ( —verbose ) | Print a message for each created directory. | mkdir -v detla |
-Z | Set SELinux security context of each created directory to the default type. | mkdir -Z dir1 |
—context[=CTX] | Like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX. | See above |
—help | Display this help and exit. | mkdir —help |
—version | output version information and exit. | mkdir —version |
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
How to find a folder in Linux using the command line
Command to find a folder in Linux
- find command – Search for files and folder in a directory hierarchy
- locate command – Find files and folders by name using prebuilt database/index
How to find folder on Linux using find command
The syntax is:
find /where/to/look/up/ criteria action
find /folder/path/to/look/up/ criteria action
find /folder/path/ -name «folder-name-here»
find /search/path/ -name «folder-name-here» -print
find /search/path/ -name «folder-name-here» -ls
find /folder/ -name «pattern»
Finding a folder named Documents
To find a folder named “Documents” in your home directory ($HOME i.e. /home/vivek/ home directory), run:
find $HOME -type d -name «Documents»
OR
find
-type d -name «Documents»
OR
find /home/vivek/ -type d -name «Documents»
find command in action on Linux
How to search for case incentive folder names
You can force find command interpret upper and lowercase letters as being the same. For example match Documents, DOCUMENTS, DocuMEnts and so on by passing the -iname option:
find $HOME -type d -iname «Documents»
OR
find
-type d -iname «Documents»
OR
find /home/vivek/ -type d -iname «Documents»
Sample outputs:
How to search a folder named /etc/ in the root (/) file system
When searching / (root) file system, you need to run the find command as root user:
# find / -type d -name «etc»
OR
$ sudo find / -type d -name «etc»
OR
$ sudo find / -type d -iname «etc»
How to hide “Permission denied error messages” when using find command
The find will show an error message for each directory/file on which you don’t have read permission. To avoid those messages, append 2>/dev/null at the end of each find command:
$ find /where/to/look/ criteria action 2>/dev/null
$ sudo find / -type d -iname «etc» 2>/dev/null
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
How do I find a directory called python.projects?
Try:
find / -type d -iname «python.projects» -ls
OR
find / -type d -name «python.projects» -ls
It is also possible to use the bash shell wild cards, run:
find / -type d -name «python.*»
sudo find / -type d -name «?ython.*»
Understanding find command options
- -name : Base of file name (the path with the leading directories removed) matches shell pattern.
- -iname : Perform a case insensitive search for given pattern
- -print : Print the full file name on the standard output (usually screen), followed by a newline.
- -ls : Display current file in ls -dils format on standard output i.e. your screen.
- -type d : Only list folders or directories.
- -type f : Only list files.
Search folder in Linux using locate command
To search for a folder named exactly dir1 (not *dir1*), type:
$ locate -b ‘\dir1’
$ locate -b ‘\folder2’
Just search for file name matching Pictures, type:
$ locate Pictures
For more info see “UNIX Find A File Command“.
Conclusion
In this tutorial, you learned how to find a folder on the Linux system using find and locate commands. For more info see gnu find command help page here.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник