find Flashcards

1
Q

find

A

GNU find searches the directory tree rooted at each given starting-point by evaluating the given expression from left to right, according to the rules of precedence until the outcome is known, at which point find moves on to the next file name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

find [OPTIONS]

  • P
  • L
  • H
  • D
  • 0
A
  • P, Never follow symbolic links.
  • L, Follow symbolic links.
  • H, Do not follow symbolic links, except while processing the command line arguments.
  • D debugopts, Print diagnostic information.
  • 0level, Enables query optimisation.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

find . -name text1

A

Finds files with the name text 1 in the current directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

find /home -name text1

A

Finds files with the name text1 in the /home directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

find /home -iname text1

A

Ignores the case of text1 while trying to find matching files in /home.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

find / -type d -name text1

A

Searches for directories from / named text1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

find . -type f -name text.php

A

Looks for files named text.php in current directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

find . -type f -name “*.php”

A

Finds all php files in current directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

find / -type f -perm 0777 -print

A

Find all the files whose permissions are 777.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

find / -type f ! -perm 777

A

Find all the files without permission 777.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

find / -perm 2644

A

Find all the SGID bit files whose permissions set to 644.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

find / -perm 1551

A

Find all the Sticky Bit set files whose permission are 551.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

find / -perm /u=s

A

Find all SUID set files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

find / -perm /g=s

A

Find all SGID set files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

find / -perm /u=r

A

Find all Read Only files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

find / -perm /a=x

A

Find all Executable files

17
Q

find / -type f -perm 0777 -print -exec chmod 644 {} \;

A

Find all 777 permission files and use chmod command to set permissions to 644.

18
Q

find / -type d -perm 777 -print -exec chmod 755 {} \;

A

Find all 777 permission directories and use chmod command to set permissions to 755

19
Q

find . -type f -name “tecmint.txt” -exec rm -f {} \;

A

To find a single file called tecmint.txt and remove it.

20
Q

find . -type f -name “*.txt” -exec rm -f {} \;

OR

find . -type f -name “*.mp3” -exec rm -f {} \;

A

To find and remove multiple files such as .mp3 or .txt.

21
Q

find /tmp -type f -empty

A

To find all empty files under certain path.

22
Q

find /tmp -type d -empty

A

To file all empty directories under certain path.

23
Q

find /tmp -type f -name “.*”

A

To find all hidden files, use below command.

24
Q

find / -user root -name tecmint.txt

A

To find all or single file called tecmint.txt under / root directory of owner root.

25
Q

find /home -user tecmint

A

To find all files that belongs to user Tecmint under /home directory.

26
Q

find /home -group developer

A

To find all files that belongs to group Developer under /home directory.

27
Q

find /home -user tecmint -iname “*.txt”

A

To find all .txt files of user Tecmint under /home directory.

28
Q
A