You are on page 1of 7

Al J ouf University ‫ﻑﻮﺠﻟﺍ ﺔﻌﻣﺎﺟ‬

Colleges of Comput er &


Informat ion Sciences ‫ﺕﺎﻣﻮﻠﻌﻤﻟﺍﻭ ﺐﺳﺎﺤﻟﺍ ﻡﻮﻠﻋ ﺔﻴﻠﻛ‬

Academic Year 2020/2021 1442‫ـھ‬ 1: ‫ﻲﺳﺍﺭﺪﻟﺍ ﻡﺎﻌﻟﺍ‬

Homework #2
System Programming

1. Give the command which shows all four-character files beginning with "f" and
ending by "e","t" or "r".

$ find

2. Give the command which shows all files of at least four characters not starting with
"b" and ending with a number.

$ ls -d [![b]]*[0-9]

3. Give the command which lists the content of the file /etc/passwd between the 10th
and the 15th lines by enumerating the line number (use the pipelines).

$ cat /etc/passwd | sed -n 10,15p

4. Give two commands which list the system processes with details

$ sudo
or
$ ps

5. Suppose we want to launch a program called "zoom" with a nice value 10. We
should execute the following command

1/5
ˆ A. nice +10 zoom &

ˆ B. nice -10 zoom & √

ˆ C. nice 10 zoom

Choose the correct response.

6. To launch the program "zoom" in the background we should execute the following
command

ˆ A. zoom | bg

ˆ B. zoom & √

ˆ C. bg zoom &

ˆ D. zoom
Then Ctrl z and bg command

Choose the correct responses.

7. The default nice value of a launched process in the background without using
the nice command is
ˆ
A. 0 √

B. 10
ˆ

C. -10

Choose the correct response.

8. The default nice value of a launched process in the background when using the
nice command is
ˆ A. 0 √

ˆ B. 10

ˆ
C. -10

Choose the correct response.


9. Suppose we launch the zoom program in the background and we obtain the
PID 2 / 5
2500 for the process ID (PID). Give the command which changes the nice value to
15 instead of the default value.

$ sudo nice -n 15 tar -czf zoom

10. Suppose we launch the zoom program in the background and we obtain the
PID 2500 for the process ID (PID). The command which terminates the process
2500 if possible is

ˆ A. $ kill -2 2500

ˆ A. $ kill -9 2500 √

ˆ A. $ kill -15 2500

Choose the correct response.

11. The command which kill the launched program zoom by name is

ˆ A. $ killall zoom √

ˆ A. $ kill -name zoom

ˆ A. $ kill -1 zoom

Choose the correct response.

12. A user executes the following

command $renice -n -10 2500

where 2500 is the PID of a given process. What will be happen?

ˆ A. The system denies the change as -10 nice value is restricted to root

ˆ B. the nice value of the process 2500 will be changed to -10

ˆ C. The nice value of the process 2500 will be changed to 10

Choose the correct response.

13. Give the command which searches all ordinary file beginning with "core" in the
system created before 10 days and delete them.

$ find " core*" -mtime +10

3/5
14. Give the command which searches all files in the home director beginning with
"log" of size larger than 100MB and list them with details.

$ find /home/ -size +100M

15. Give the command which lists the content of the home directory on the screen and at
the same time stores it in the file file.txt.

$ cat

16. Suppose we execute the following command.


$ (date ; ls -l file.txt) 2 > /dev/NULL

where the file file.txt does not exit. After the execution of the command

ˆ A. $ The date and an error will be putted in the file /dev/NULL (Trash)

ˆ B. $ The date will be displayed on the screen and an error will be saved in
the file /dev/NULL
ˆ C. $ The date and an error will be displayed on the screen

Choose the correct response.

17. How to create a file called "test" with the command cat using the input redirection

$ cat < test

18. Suppose we execute the following command

$ find . -name "logs*" -print > file.logs 2 > &1

After the execution of this command,

ˆ A. $ All founded files beginning with logs and errors will be stored in the le
le.logs

ˆ B. $ All founded files beginning with logs will be stored in the file file.logs
and errors will be displayed on the screen.

ˆ C. $ Errors will be stored in the file file.logs and founded files will be
displayed on the screen.

Choose the correct response.

4/5
19. Suppose we execute the following command (Here document)

$ wc -l << END
> we enjoy linux
>let's work with shell
END

After the execution of this command, the following will be displayed

ˆ
A. 2 √
ˆ
B. 6

ˆ C.2635

Choose the correct response.

20. Suppose we execute the following command

$ tr "l" "L" << END


> we enjoy linux
>let's work with shell
END

What will be displayed after the execution of the aforementioned command.


.
.
we enjoy Linux
Let's work with sheLL
5/5

You might also like