Filter ls -la
to only show files that start with “gu”
You can use the following command to filter the output of ls -la
to only show files that start with “gu“:
ls -la | grep '^-\|^l' | grep '\<gu'
Explanation:
ls -la
: Lists all files, including hidden ones, with details.grep '^-\|^l'
: Filters out only regular files (-
) and symbolic links (l
), excluding directories (d
).grep '\<gu'
: Ensures that the file name starts with “gu”.