Pipingthe use of pipes — is a technique that can be used to connect the standard output channel (stdout) of a command to the standard input channel (stdin) of another command. If we assume that the current directory contains the text file numbers.txt1, give commands that perform the following tasks (one command per task):

  1. Output the last 25 lines from numbers.txt2 to stdout.

  2. Write out lines 25 to 75 from numbers.txt3 to stdout.

  3. Write the second line from numbers.txt4 to stdout.

  4. Execute a command that counts the total number of files in your home directory, including the hidden files (files whose name starts with a dot).

    Note

    By default, Dodona does not run your commands from your home directory, but from a different working directory.

Tips

  • The tail command shows the last few lines of a file. The head command does something similar, as the name of the command might already suggest. More information about the operation of the tail and head commands can be found their man pages.

  • The wc command counts the number of lines, words and characters on stdin or in the files whose location is passed as an argument to the command.