Professional Documents
Culture Documents
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).
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 &
C. nice 10 zoom
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
7. The default nice value of a launched process in the background without using
the nice command is
A. 0 √
B. 10
C. -10
8. The default nice value of a launched process in the background when using the
nice command is
A. 0 √
B. 10
C. -10
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 √
11. The command which kill the launched program zoom by name is
A. $ killall zoom √
A. $ kill -1 zoom
A. The system denies the change as -10 nice value is restricted to root
13. Give the command which searches all ordinary file beginning with "core" in the
system created before 10 days and delete them.
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.
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
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
17. How to create a file called "test" with the command cat using the input redirection
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.
4/5
19. Suppose we execute the following command (Here document)
$ wc -l << END
> we enjoy linux
>let's work with shell
END
ˆ
A. 2 √
ˆ
B. 6
C.2635