Pitfalls

From LQWiki
Jump to navigation Jump to search

Using Linux daily can provide some pitfalls. This chapter is here to make you aware.

Searching file content

If you want to search a folder for files containing a given string, you cannot use

grep -ir "whatever" *

Because this will not include hidden files. Make use of the find command to build a accurate list of all files:

find ./ -type f -exec grep -iH "whatever" {} \;

However, for simple tasks, you can take advantage of the fact that 'hidden files' are only a naming convention, and tell grep to read all files in a directory itself:

grep -ir "whatever" .

Tab completion

For tab completion problems, see tab Completion.

See also