Question

In: Computer Science

Unix / Linux 21. Given the following command pipeline, provide a diagram (ascii art) or detailed...

Unix / Linux

21.

Given the following command pipeline, provide a diagram (ascii art) or detailed description indicating all the Input/Output (I/O) connections. Every stdin, stdout, and stderr for each command will need to connect to something.

grep a < words | wc -l > a_count.txt

22.

Explain what is wrong (if anything) with the following command pipeline.

cd | ls

23.

Stream Editor:

Write a sed command to delete digits, but only on lines that end with a period. Assume a file named exam.txt is used for input and changes will be displayed to the screen and not saved to the file.

24.

ls command

What option is used to format the output in a single column?

25.

ls command:

List two different options that will indicate "file type" in the output. Explain.

Solutions

Expert Solution

21) grep a < words | wc -l > a_count.txt

this command is used to find certain things on file or text. but here angular brackets are used, so the expression evaluated first. there can be two cases... as mentioned here

a) no words file, then it will generate error and display it on the screen that words no such file.

b) there is words file, then the total line will be counted in that file, and then at the end command will generate error. saying that no such token found.

22) cd|ls

since there is not error in the given pipe line, this will simply foward the return code of cd command to the command ls. and this command will only gives the output of ls command which is nothing but the content of the current directory.

23) sed -e '/^[0-9].*$/d' exam.txt

This command will perform said task.

24) ls -1

ls --format=single-column

this command will give output in single column.

25) first option with ls command is "-l"

it will show output along with type of file like as mentioned below:

  1. - : regular file
  2. d : directory
  3. c : character device file
  4. b : block device file
  5. s : local socket file
  6. p : named pipe
  7. l : symbolic link

second option is "-F" it will append * to the file and / to the directory.

So, -l and -F are two ways.

Hope this helps.


Related Solutions

unix/Linux Create a tar command using the man command and the link referred to in To...
unix/Linux Create a tar command using the man command and the link referred to in To Practice and Explore: Text File Utilities #9. Preliminaries Use the man pages to learn more about tar Review the links referred to in To Practice and Explore: Text File Utilities #9 to see examples of using tar command Perform Use tar "to stuff" three files and then "unstuff" them into a new directory. Include the -v option. Task ll to show the original 3...
Unix / Linux 16. Regular Expression: Given the following regular expression, provide a description of the...
Unix / Linux 16. Regular Expression: Given the following regular expression, provide a description of the intended match. ^[^A-Z] 17. Regular Expression: Given the following regular expression, provide a description of the intended match. [^^!] 18. Regular Expression: Given the following regular expression, provide a description of the intended match. ^.\{72\}$ 19. Regular Expression: Given the following regular expression, provide a description of the intended match. [A-Za-z0-9] 20. Regular Expression: Given the following regular expression, provide a description of the...
Unix / Linux 6. vi editor: In vi command mode, what are the keystrokes you would...
Unix / Linux 6. vi editor: In vi command mode, what are the keystrokes you would type to... Quit the vi editor and save any changes? 7. C language source files, by convention, have the suffix ".c". The associated "header" files have the suffix ".h". What is the command to perform the following task: List all the C source and C header files in the current directory. [Hidden files may remain hidden.] 8. C language source files, by convention, have...
In LINUX Provide the command(s) and any additional steps to perform the following tasks. You will...
In LINUX Provide the command(s) and any additional steps to perform the following tasks. You will need to be running with root privileges. Create a symlink to the /etc/openldap/ directory named "ldapconf" in /tmp/. Find all .conf files in the /etc/ directory and its subfolders. Find all directories starting with "gnome" or "GNOME" anywhere under the /usr/share/ directory. Sam and Susan are members of the "sales" group. Sam has been working on a project that has grown too big for...
Unix / Linux 31. Given the first two commands, what is the expected output for the...
Unix / Linux 31. Given the first two commands, what is the expected output for the third command? (single quotes) $ echo * a b c $ x=* $ echo '$x' 32. Given the first two commands, what is the expected output for the third command? (Single quotes inside of double quotes) $ echo * a b c $ x=* $ echo "'$x'" 33. Given the first two commands, what is the expected output for the third command? (double quotes...
QUESTION 1 Match the following LINUX/UNIX commands with what they do. du    whereis users who...
QUESTION 1 Match the following LINUX/UNIX commands with what they do. du    whereis users who am i A. display a compact list of users currently logged in B. locate the binary, source, and manual page files for a command C. summarize disk usage D. who am i currently logged in as on the Linux server. QUESTION 2 What rm command option (flag) would you use to remove a file that begins with a - (hyphen)? -f -p --   ...
Using Linux in VirtualBox Do the Following Exercise: Using the clear command At this point, you...
Using Linux in VirtualBox Do the Following Exercise: Using the clear command At this point, you screen might seem filled with commands and their results. Use the clear command anytime you want a clean slate. This exercise enables you to clear the screen now. To clear the screen: Type clear on the command line, and press Enter. The command prompt is now in the upper-left corner of your screen. [No output or questions for this part.] Viewing manual pages You...
Please provide a detailed answer with justifications to the following question: Given the large number and...
Please provide a detailed answer with justifications to the following question: Given the large number and large population of emerging countries, many economists and environmentalists are genuinely concerned about the depletion of resources, child labor practices, and political tensions within emerging countries. Do you think we should be worried? if so why; if no, why not?
Objective: Practice common UNIX commands. Procedure: The following list of Unix commands are given for self-learning....
Objective: Practice common UNIX commands. Procedure: The following list of Unix commands are given for self-learning. Use 'whatis' or 'man' command to find out about each command. Your document should include the description or screen shots of the output from each of the command. Commands: df du gzip file history wget Changing access rights: chmod u+x Dir1.0             adds execute permission for the owner chmod go-w file1               removes write permission for the group and others chmod ugo=rw testfile      sets...
PLEASE USE LINUX/UNIX 1.Use either pico, vi, or cat to create the following file and name...
PLEASE USE LINUX/UNIX 1.Use either pico, vi, or cat to create the following file and name it as “mysedfile”: Name Class1 Class2 Class3 Tom 92 94 88 Nancy 91 85 95 Lisa 99 77 96 Jerry 84 98 90 2. Please use sed command(s) to complete the following tasks. display Tom’s record. display Lisa’s record. display both Tom’s and Lisa’s records. remove the blank line(s) from “mysedfile.” replace all the digits with *.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT