Got a legacy project in which they didn’t particularly follow the naming and folder arrangement agreements.
I can only assume how the folders and files should be called.

Hence the questions:
1) How to find a folder by name?
For example, find workers -type d doesn't really help. Searches only in the current directory, and is needed throughout the system.

2) How to find a file by part of the name?
Those. part of the name must be _workers.rb , you need to search for it

Search the entire system.

  • four
    find / -type d -iname '*часть имени*' (do not erase stars and quotes) - andreymal
  • How did it happen? ru.wikipedia.org/wiki/Find - diproart
  • @diproart and now there is a legal excuse: the PKN banned me on the wiki! - KAGG Design
  • @andreymal, nice to add -xdev . - 0andriy
  • If there is a database, as of its last update, you can run the locate command. It is many times faster than find . - 0andriy

1 answer 1

1) How to find a folder by name?

find / -type d -name 'workers'

/ - search the entire system, that is, start from the mount point "/"

-type d - search only folders

-name 'workers' - in this case, an exact match with workers

2) How to find a file by part of the name?

find / -type f -name '*_workers.rb'

/ - search the entire system, that is, start from the mount point "/"

-type f - search for files only

-name '*_workers.rb' - in this case, all that ends with "_workers.rb"