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
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
Get Answers For Free
Most questions answered within 1 hours.