Question

linux operating system 1) Give a command to search the file /etc/passwd for the string “sarwar”...

linux operating system

1) Give a command to search the file /etc/passwd for the string “sarwar”

2) Give the command for deleting the memos directory. How do you know that the directory has been deleted?

3) Give the command for searching a file named fruits for the string “apple”, sending the output of the command to a file called applefreq

Homework Answers

Answer #1

1. We use grep command in linux to search for string in a file. command for that is- grep string filename

Required command is- grep sarwar /etc/passwd

2. :Linux command for deleting memos directory is-

rm -rf /memos

For checking if the directory exists this command is used-

[ -d /memos ]

If success is returned that means the directory still exists else it does not.

3. Command for  searching a file named fruits for the string “apple”, sending the output of the command to a file called applefreq is-

grep apple fruits > applefreq.txt

Know the answer?
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
Similar Questions
Linux Operation SECTION 2 – File and Directory Permissions: FILE PERMISSIONS: What is the command used...
Linux Operation SECTION 2 – File and Directory Permissions: FILE PERMISSIONS: What is the command used to find out which user account you are logged into?      . This command may come in handy in the following exercises. Ensure you are in your home directory of the student1 account. Use the echo command with output redirection to create a file called labfile4 and put the following text in this file: “This is the first line of labfile4”. Using the symbolic notation...
5. Write a bash command that will display the name of every file on the Linux...
5. Write a bash command that will display the name of every file on the Linux system whose file contaent contains the string "doug.jones". The command must run in the background, must redirect standard error to /dev/null, and must redirect standard output to ~/out. 6. Write a bash command that will kill all of the even-numbered processes associated with your userid, and no other processes. 7. Write a bash command that will start the program /home/courses/140u-doug.jones/zombie_maker as a background process,...
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and...
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and the output in a word document and submit it. Part1: 1. Log in to Linux using your user account name and password. 2. If you logged in using a graphical login screen, open a terminal window by clicking on the icon in the lower left corner of the desktop to open the main menu, then selecting System Tools, then Terminal. A terminal window opens....
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2....
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2. Create a file with name “yourLastName.txt” inside the directory created in step.1 3. Write inside the created file exactly the following content (you may use editors such as vim, pico, ….): Linux Lab Lab. ToDo#1 Summer Semester 2019/2020# 4. Display the first 2 lines of the file. 5. Change the permission of the file to read write and execute for owner, groups and others....
Chapter 8: Searching, Extracting, and Archiving Data Exercise 8.a: Using grep, find, and regular expressions (Objective...
Chapter 8: Searching, Extracting, and Archiving Data Exercise 8.a: Using grep, find, and regular expressions (Objective 3.2) Linux Distribution: Fedora (non-root user & password needed) Desktop Environment: GNOME 3 1.   If you have not already done so, boot up your computer (or virtual machine) to start the Fedora Linux distribution. 2.   When the machine has booted up, access the tty2 virtual terminal by pressing Ctrl+Alt+F2. 3.   Log on to a regular user’s account by typing in the username at the...
please use linux/unix command terminal to complete, step 1 1-create a new directory named by inlab4...
please use linux/unix command terminal to complete, step 1 1-create a new directory named by inlab4 enter directory inlab4 create a new file named by reverse.c with the following contents and then close the file: /*reverse.c */ #include <stdio.h> reverse(char *before, char *after); main() { char str[100]; /*Buffer to hold reversed string */ reverse("cat", str); /*Reverse the string "cat" */ printf("reverse(\"cat\")=%s\n", str); /*Display result */ reverse("noon", str); /*Reverse the string "noon" */ printf("reverse(\"noon\")=%s\n", str); /*Display result */ } reverse(char *before,...
Project 10-3 In this hands-on project, you view the configuration of the System Log Daemon and...
Project 10-3 In this hands-on project, you view the configuration of the System Log Daemon and the logrotate utility on Ubuntu Server Linux. 1. Boot your Ubuntu Server Linux virtual machine. After your Linux system has been loaded, log into tty1 using the user name of root and the password of LNXrocks!. 2. At the command prompt, type ls –l /dev/log and press Enter. What is the file type? Which daemon on Ubuntu Server Linux uses this file and what...
1. By convention, how are configuration files separated from regular files? (NOTE: A practical effect of...
1. By convention, how are configuration files separated from regular files? (NOTE: A practical effect of the separation is that they are not displayed by the default version of the ls command)                         a. the prefix "rc" (rc.filename)               c. the extension .cfig                         b. a dot (.) at the beginning                    d. by having the SUID bit set 2. The IP address which is reserved for local loopback (equivalent to "localhost") is:                         a. 255.255.255.0                                   c. 192.168.70.1...
Read Lab2 System Software, then answer the following questions. For answering the questions, you may use...
Read Lab2 System Software, then answer the following questions. For answering the questions, you may use any resource including the lab exercise, the textbook, or the internet. Do we still need to use Terminal? If so, for what? Suppose you are using Terminaland are currently in the Desktopfolder. Write the command to create a folder called: myname Suppose you are using Terminal. Write the Terminalcommand to display the contents of folder myname Suppose you are using Terminal. Write the Terminalcommand...
Description The word bank system maintains all words in a text file named words.txt. Each line...
Description The word bank system maintains all words in a text file named words.txt. Each line in the text file stores a word while all words are kept in an ascending order. You may assume that the word length is less than 20. The system should support the following three functions: Word lookup: to check whether a given word exists in the word bank. Word insertion: to insert a new word into the word bank. No insertion should be made...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT