Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have some question of ubuntu system. 1.Redirect *all* the printout of command

ID: 3805689 • Letter: I

Question

I have some question of ubuntu system.

1.Redirect *all* the printout of command `(echo t; rm ttt)` to a file with name `f`. Hint `(A; B)` means executing two commands `A` and `B` in sequence (without piping).

2.Print all the processes in the system with name `bash`; hint: `ps aux` is the command to print all the processes in the system.

3.When running two commands `top &`, `vim f &` in the background, how will you bring the `vim` command to the screen. Describe the command you will use and the command-line argument.

4.`wc f` is a command that prints the word count in file `f`. In particular, `wc -l f` prints the number of lines in file `f`. Using `ls` and `wc` commands, write a piped command to print out the number of files in the current directory.

Explanation / Answer

1.To redirect the output in unix ,'>'(greater than) operator is used as follows:

The given command is echo t; rm ttt.So the required outpus is echo t; rm ttt >f

2. ps ‘bash’

3.fg command can be used to bring the vim f to execute first .The syntax is as follows:

fg <job-id>

4. ‘ls| grep ‘^_’ |wc –l

Here grep is optional ,if you want the count for all types of files (files/directory) and ’_’ indicates the regular files/text files.