Linux 101 : Useful Shell Tips - Tricks -find, mv, subcommands, ... -



The below example will list all the files that start with a letter, has a digit and ends with an underscore:


The below example will match any file starting with the letter "h" and followed by two characters - letters or digits -:


The below command creates the files - file1, ..., file5 -:


To find all the file in our current directory, we use the following:


To find all the subdirectories in our current directory, we use the following:


To find a file in our current directory, we use:


To move files to a different "destination" directory, we could use the below - the result of the "find" command will be the input of "mv" -:


We could also use the "exec" command, that take its input from the command preceding it.
The below command looks for a file named "filename" and displays it:


Remark:

The "." refers to the current directory.

Comments

Leave as a comment:

Archive