![]() ![]() Here is an example drwxrwxr-x 2 root ubuntu 4096 Dec 9 06:02 /projectĭrwxrwxr-x 2 root ubuntu 4096 Dec 9 05:03 /dataĭrwxrwxr-x 2 root ubuntu 4096 Dec 9 03:04 /files This is because the permissions of directory start with ‘d’ character. We pass this to grep command which searches for results beginning with ‘d’ character in Linux. Ls -lR command recursively lists all files and folders of specified folder, along with their permissions. projects $ sudo ls -lR /home/ubuntu | grep '^d' | grep '/projects' In this approach, we use ls command to list all contents of search location recursively, and pass its output to grep command to look for required folder e.g. ![]() In the above command, replace /home/ubuntu with your choice of search location and ‘project’ with your choice of folder name. ![]() In the above command the find command finds all directories in /home/ubuntu folder, and passes its output to grep command, which searches for ‘projects’ in it and lists only matching records. Here is an example to find directory with name ‘projects’ in Linux in /home/ubuntu directory $ sudo find /home/ubuntu -type d | grep 'projects' In this approach, we use a combination of find and grep commands to find directory in Linux. Here are the different ways to find folder name in Linux. There are a couple of different ways to find folder name in Linux. In this article, we will look at how to find directory name in Linux. But sometimes you may need to find directory name in Linux or find folder name in Linux. Typically, we search for filenames using grep or find command in Linux. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |