ls - List information about files.
ls -l -c -r
-l Show all file details
-t Sort by modification time
-r Reverse
-a include hidden files
-c Use time of last modification of the i-node
Directory Abbreviations
You can use directory abbreviations to shorten the pathnames of a complex directory structure. The following list shows some useful abbreviations:
~ Your home directory
.. Parent directory-the directory just above your current directory
. Current directory
.. Parent directory-the directory just above your current directory
. Current directory
count files in a directory
ls -l | wc -l
ls -la | wc -l (To include hidden files)
ls -la | wc -l (To include hidden files)
count files in a directory recursively
find . -type f | wc -l
count subdirectories in a directory recursively
find . -type d | wc -l
Recursively change the owner of all files in a directory
chown -R webmaster html
Recursively change the owner and group of all files in a directory
chown -R webmaster:webgroup html
Recursively change files to rwx for owner and r for the rest.
find . -type f -exec chmod u=rwx,go=r {} \;
find . -type d -exec chmod u=rwx,go=rx {} \;
find . -type d -exec chmod u=rwx,go=rx {} \;
Recursively delete files with given pattern.
find . -name '*.pdb' -exec rm {} \;
Locate a binary, source, and manual page files for a command.
whereis filename