Question

Create a find command string that will locate the file called resolv.conf and once found, grep...

Create a find command string that will locate the file called resolv.conf and once found, grep for the number of lines that the string nameserver appears in within the file.

Begin your find search within the /etc directory.

Complete the find command string by replacing the ## with the required characters. Enter only the characters below.

find /etc -name 'resolv.conf' -exec grep ##'nameserver' {} \;

(The output of the find command will be a number. Ignore the warnings)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

Below is the command , -C option in grep will count the no of times of the word repeated in file resolv.conf.

If we need to ignore warnings just ouput it to 2>/dev/null.

find /etc -name 'resolv.conf' -exec grep -c 'nameserver' {} \;

Suppose if i have nameserver word in file resolv.conf 2 times.

Output:

2

Add a comment
Know the answer?
Add Answer to:
Create a find command string that will locate the file called resolv.conf and once found, grep...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUESTION 1 From YOUR home directory, execute a find command string that will locate the file...

    QUESTION 1 From YOUR home directory, execute a find command string that will locate the file called resolv.conf. Include the -exec flag in the find command to cat the file to the screen. Begin your find search from the letc directory Select the correct find command string below that will accomplish this. find /etc-name 'resolv.conf -cat D find /etc-name 'resolv.conf -exec cat 0 find. -name 'resolv.conf -exec cat 0\ find /-name 'resolv.conf' -exec cat 0 QUESTION 2 What find command...

  • QUESTION 1 From YOUR home directory, execute a find command string that will locate the file...

    QUESTION 1 From YOUR home directory, execute a find command string that will locate the file called resolv.conf. Include the -exec flag in the find command to cat the file to the screen. Begin your find search from the letc directory. Select the correct find command string below that will accomplish this. find /etc -name 'resolv.conf-cat f} \; find /etc -name 'resolv.conf' -exec cat {} \; find . -name 'resolv.conf' -exec cat {} \; O find / -name 'resolv.conf' -exec...

  • Using Ubuntu OS... help is greatly needed! Thank you. Create an alias called "home" that does...

    Using Ubuntu OS... help is greatly needed! Thank you. Create an alias called "home" that does two things... returns you to your home directory, then does a long listing of all files found there Create a file called "Output.txt" that contains the output of the "ls /etc" command Using "cat", create a file called "poem.txt" where you enter at least one line of text ("Mary had a little lamb" will do...) Using "cat", pipe the contents of poem.txt into the...

  • Question 1) Copy file called sortfile from my home directory. The file contains three columns of...

    Question 1) Copy file called sortfile from my home directory. The file contains three columns of information : username, uid number and group name respectively, separated by a field separator. Will the following command sort the file on the group name field? sort -t! -k3 sortfile A) Yes B) No Question 2) Copy the file called sortfile from my home directory. The file contains three columns of information : username, uid number and group name respectively, separated by a field...

  • LINUX 140U Create a file named script1.sh that contains a bash script that: Accepts NO command...

    LINUX 140U Create a file named script1.sh that contains a bash script that: Accepts NO command line arguments and does NOT use the read command. I will give you no credit if your bash script includes a read command. Also, you need to have at least one for..in loop in your code even if there may be other ways to do this problem. The script will go through a list of entries in the current directory (do not process subdirectories):...

  • linux help Create a file called trees, containing the following individual lines: Oak tree Pine Tree...

    linux help Create a file called trees, containing the following individual lines: Oak tree Pine Tree Spruce tree Cottonwood Maple tree Pine Tree Copy in the contents of the trees to more_trees file. Next, add the following trees at the end of the list. Redwood Willow tree Use a command to compare the trees and more_trees files and show the differences in terms of individual lines that differ. Determine the number of bytes in both the trees and more trees...

  • 1.Write a find command that will display the inode number of all files in the working...

    1.Write a find command that will display the inode number of all files in the working directory (only) that contain the string "#include". 2.Write an ls command with a glob specification that will list the names of all files in the working directory that are exactly 10 characters long, begin with w, x, y, or z, and do not contain a "." character (i.e. no file extension). 3.Write an ls command with a glob specification that will list the names...

  • used Linss file systems d FAT nd NTFS NTFS and est3 h ReiserFS and ext3 15....

    used Linss file systems d FAT nd NTFS NTFS and est3 h ReiserFS and ext3 15. A fie a hem ppicaly you might possibly sreae entries for all the ie than enongheir that file sy stemtains ore than enough 16. To create a syesbolic link, use the a. In command h In command with the -s optiorn d. symlink command You can learn numerous details about any file using the 17 s brip2 and buenion etitities in Linux? d. gzip...

  • A filename con comprise multiple embedded dots (e.g., a.b.c.d.e). True False A device file is not...

    A filename con comprise multiple embedded dots (e.g., a.b.c.d.e). True False A device file is not really a stream of characters and doesn't contain anything at all. True False Relative pathnames begin with the root directory. True False Running the ls -a command uniquely identifies directories and binary executables. True False What is the result of running mkdir -p share/man/cat1 from the command line? a. It creates the directory share. b. It creates the directory share/man. c. It creates the...

  • In this exercise, you will create a script called file_ops.sh that uses the various file operators...

    In this exercise, you will create a script called file_ops.sh that uses the various file operators The file_ops.sh script will Use one command line argument Use four IF THEN statement to compare the first command line argument Determine which file operators to use that produces the following output when the script run with the arguments shown WARNING: In the IF THEN statements, to avoid syntax error messages, there must be a space before and after each bracket and also between...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT