

In particular, it has os.walk() module which allows us to perform the same action as above - traverse directory tree and obtain list of files that contain desired string. Python is another scripting language that is used very widely in Ubuntu world.

With a small script, you can traverse directory tree, push files that contain the desired string into array, and then print it like so: #!/usr/bin/env perlĪnd how it works: $. The command line is quite an all-rounder: it can also display a files contents - although it wont do this as elegantly as your favorite editor. Perl has Find module, which allows to perform recursive traversal of directory tree, and via subroutine perform specific action on them. **/* expansion is a file and whether it contains the desired text: bash-4.3$ for f in. All we need to do is test for whether item in the. bashīash has a very nice globstar shell option, which allows for recursive traversal of the directory tree. Meaning, you must be at C:> to get to this prompt, type the following command. If you are unsure where the file may be on the computer, you must be at the root directory of the computer. While find command is simplest way to recursively traverse the directory tree, there are other ways and in particular the two scripting languages that come with Ubuntu by default already have the ability to do so. You can find any file on your computer using MS-DOS providing you know the name of the file or the program that created the file.
