Search all the files/folder with that name and remove them
1
find . -name "FILE-TO-FIND"-exec rm -rf {} \;
Find all files having .bak (*.bak) extension in current directory and remove them:
1
find . -type f -name "*.bak" -exec rm -f {} \;
Find all core files and remove them
1
find / -name core -exec rm -f {} \;
Find all *.bak files in current directory and removes them with confirmation from user:
1
find . -type f -name "*.bak" -exec rm -i {} \;
Find all pdf files and copy them in DestinationFolder:
1
find . -type f -name "*.pdf" -exec cp {} DestinationPath \;
Searching
Search for pattern in files
1
|
|
Search recursively for pattern in dir
1
|
|
Search for pattern in the output of command
1
|
|
Locate file – Find all instances of file
Starting with the root directory, look for the file called filename
1
|
|
Starting with the root directory, look for the file containing the string filename
1
|
|
Starting with the directory called dir, look for and list all files containing TextStringToFind
1
|
|
Create symbolic link link to file
1
|
|
Create or update file
1
|
|
Places standard input into file
1
|
|
Display the file called file one page at a time, proceed to next page using the spacebar
1
|
|
Output the first 10 lines of file
1
|
|
Display the first 20 lines of the file called file
1
|
|
Output the last 10 lines of file
1
|
|
Display the last 20 lines of the file called file
1
|
|
Output the contents of file as it grows, starting with the last 10 lines
1
|
|
Compression
Compression
Create a tar named file.tar containing files
1
|
|
Extract the files from file.tar
1
|
|
Create a tar with Gzip compression
1
|
|
Extract a tar using Gzip
1
|
|
Create a tar with Bzip2 compression
1
|
|
Extract a tar using Bzip2
1
|
|
Compresses file and renames it to file.gz
1
|
|
Decompresses file.gz back to file
1
|
|