Linux: Listing of files
Example: ls m*
(Displays files in the current directory which starts with the character m and the rest of the characters can be anything and any number of characters)
Example: ls ?gm
(Displays files in the current directory which starts with any one character and the rest of the character should be g and m . So total length of the file name will be three characters)
Example: ls /mgm/*a
(Displays the files in the current directory which end with character a and which is in the directory mgm)
Example: ls [aeiou]*
(Displays files in the current directory which starts with any of the characters a,e,I,o or u and the rest of the characters can be anything)
Example: ls [!aeiou]*
(Displays files in the current directory which does not starts with any of the characters a,e,I,o or u and the rest of the characters can be anything)
Example: ls [a-m][c-z][4-9]??
(Displays list of all 5 character filenames in the current directory whose first character is in the range of a to m, the second character is in the range of c to z, the third character is in the range of 4 to 9, whereas the fourth and fifth characters are any valid character)
Linux: Managing Directories << Previous
Next>> Linux:Pattern searching command
Our aim is to provide information to the knowledge seekers.