225k views
3 votes
Write the command that can be used to answer the following questions. (Hint: Try each out on the system to check your results. )

a. Find all files on the system that have the word "test" as part of their filename.

b. Search the PATH variable for the pathname to the awk command.

c. Find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size.

d. Find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size.

e. Find all files in the / directory and subdirectories that are symbolic links.

f. Find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago.

g. Find all files in the /var directory and subdirectories that were accessed less than six days ago. H. Find all files in the /home directory and subdirectories that are empty. I. Find all files in the /etc directory and subdirectories that are owned by the group bin

User Archit
by
8.1k points

1 Answer

5 votes
a. To find all files on the system that have the word "test" as part of their filename, use the command:

```
find / -name "*test*"
```

b. To search the PATH variable for the pathname to the awk command, use the command:

```
which awk
```

c. To find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size, use the command:

```
find /usr -type f -size +50k
```

d. To find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size, use the command:

```
find /usr -type f -size -70k
```

e. To find all files in the / directory and subdirectories that are symbolic links, use the command:

```
find / -type l
```

f. To find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago, use the command:

```
find /var -type f -amin -60
```

g. To find all files in the /var directory and subdirectories that were accessed less than six days ago, use the command:

```
find /var -type f -atime -6
```

h. To find all files in the /home directory and subdirectories that are empty, use the command:

```
find /home -type f -empty
```

i. To find all files in the /etc directory and subdirectories that are owned by the group bin, use the command:

```
find /etc -type f -group bin
```
User Gaspard Merten
by
8.5k points