Quiz 2. Meta-characters and redirections.

Quiz 2. Meta-characters andredirections.

Student name ___

  1. What will the following command match?

$ ls???[!a-z]*[0-9]t

This will list files containing 0 to 9 that do not start withalphabets a to z

For the questions 2, 3 and 4 tell what was changed: STDIN, STDOUTor STDERR?

  1. $ cat file1

STDOUT

  1. $ mailx user11 &lt letter

STDIN

  1. $ cat .profile &gt newprofile 2&gt&amp1

STDOUT

For the questions 5, 6 and 7 use the command cat filea, and perform the following:

  1. Place the output of the command cat filea into the fileb and the errors into the filec.

$ catfileafileb

  1. Place the output of the command cat filea into the fileb and associate errors with the output.

$ catfileafileb2&gt fileb

Place the output of the command cat filea into the fileb and discard any error messages(do not display or store error messages)

$ cat filea fileb 2&gt /dev/null

  1. Create a file named file22 using the command cat and redirections.

$ cat &gt file22

  1. Create a file named ls.out using the command ls and redirections.

$ ls &gt ls.out

  1. Create a file named date.out using the command date and redirections.

$ date &gt date.out

  1. Calculate the number of files in your current directory using the ls and wc commands.

  1. Calculate the number of files in the /usr directory using the ls and wc commands.

ls -1 /usr/ | wc -l

  1. Calculate the number of users logged in using the who and wc commands.

who -l | wc -l

  1. Create a message on the screen “This is the # of users on the system” using the result of the previous command.

$ cat Newfile

This is the who -l |wc -l of users on thesystem

  1. Create a message on the screen “This is the # of files in the directory” using the result of the command in question 11.

$ cat Newfile

This is the ls -1 /usr/ | wc -l of files in the directory