find
The find command is handy tool to manage files inside the file system, the command structure is:
find dir criteria [action]Where:
diris the starting dircriteriais a filter for the element that have to matchactionis the action to perform on the elements that matches thecriteria
Limit file search
In order to limit the depth level of the search the -maxdepth option can be used
find dir -maxdepth <VALUE> criteria [action]Oneliners
- remove files only in current dir with confirmation
find . -maxdepth 1 -type f -exec rm -i {} \;- exclude elements by regex
find . -not -regex 'REGEX'- filter by element name
find . -name 'REGEX'