#1
#1
INFORMATION TECHNOLOGY COLLEGE OF HO CHI MINH CITY
FACULTY OF INFORMATION TECHNOLOGY
oOo
FINAL EXAMINATION
SUBJECT: FUNDAMENTALSOF LINUX
CLASSES: C9CTs
DURATION: 90 minutes
(only reference to “Fundamentals of Linux” paper-book
and English-Vietnamese paper-dictionary allowed )
Choose the best answer for each question.
1) As a system administrator, you are instructed to
backup all the users’ home directories. Which of the
following commands would accomplish this?
a) tar xvf usersbackup.tar /home/*
b) tar cvf usersbackup.tar /home/*
c) tar cvf usersbackup.tar /home/usr/*
2) What would be displayed as the result of issuing the
command ps –ef?
a) Display information about every process on the
system with full listing.
b) Only display names of all processes of current
user.
c) Display information about stopped processes on
the system with full listing.
3) You enter the command
cat MyFile | sort > DirList&
and the operating system display
[4] 3499
What does this mean?
a) This is the job number 4 and the PID of the
command 3499
b) This is the job numner 4 and the PID of the job is
3499
c) The PID of the command is 3499 and the priority
is 4
4) Which command would you use to get a list of all files
inside the rpm-packet votandung.rpm in /home/cntt?
a) rpm –a /home/cntt/votandung.rpm
b) rpm –l /home/cntt/votandung.rpm
c) rpm –d /home/cntt/votandung.rpm
5) How could you describe the following commandline?
command1 | command2
a) The command command1 redirect its output to
the command command2.
b) The command command1 writes its output into
the file command2.
c) The command command2 is only processed if
the command command2 leaves with an error.
6) What would the following command result in?
echo $(date) > A.txt
a) The current date and time of the system will be
written into the file A.txt
b) The date and time values in A.txt file will set for
the date and time of the system.
c) Displays errors.
7) Which of the following commands could be used to
search for a particular term inside a textfile without
opening the file?
a) grep
b) diff
c) find
8) What would the following command result in? (Files:
file1.txt, file2.txt. Directories: tm1, tm2, tm3)
cp /tm1/file1.txt /tm2/file2.txt /tm3
a) This isn’t a valid command.
b) file1.txt, file2.txt and tm3 are copied to current
directory.
c) file1.txt and file2.txt are copied to /tm3
9) You've started three jobs in the background. Now you
would like to bring one particular of them into the
foreground again. How could you do it?
a) Use the command fg jobname
b) Get the list of jobs using the jobs-command and
then use fg jobID
c) Switch through all background-jobs using the
Ctrl-Tab key
10) Which statements about priority of processes are true?
a) A priority value reaches from 0 to 20
b) A less priority value means higher priority
c) Priority-values can be changed with the ps-
command
11) What does the following command mean?
ls *[A-Z][0-9]
a) List all files that end with one uppercase letter
and then one digit.
b) List all files that begin with one uppercase letter
and one digit.
c) List all files that have one letter or one digit.
12) What is the number of the first logical partition on
/dev/hda?
a) /dev/hda1
b) /dev/hda4
c) /dev/hda5
13) In what file do you configure which partitions should
be mounted on bootup?
a) /etc/fstab
b) /etc/mkfstab
c) /root/fstab
14) You are working with vi, writing a textfile. Being in
command mode, you want to move the cursor to last
line of file. Enter the necessary command?
a) G
b) 1G
c) Press “End” key.
15) You need to search the entire directory structure to
lacate a specific file. How could you do this and still
Page 1of 3 (exam #1)
be able to run other commands while the find
command is still searching for your file?
a) find / -name filename &
b) find / -name filename
c) bg find / -name filename
16) Which commands will shutdown a RedHat Linux
system in console mode:
a) shutdown –r now
b) init 0
c) init 1
17) You need to copy all the files and directories
contained in the home directory to another location.
What utility can you use for this?
a) cp
b) mv
c) ln
18) Which shell built-in command can be used to create an
shorter string that represents for a longer command in
bash shell?
a) ln
b) alias
c) set
19) Which process has the Process ID numder 1
a) bash
b) init
c) sys
20) What is the correct command to move all file in /tmA
to /tmB that begin with ‘a’ and end with ‘b’?
a) mv /tmA/a?b /tmB
b) mv /tmA /tmB/[a-b]
c) mv /tmA/a*b /tmB
21) Which of the below commands you should use to
identifies all groups to which the ‘tandung’ user
belongs.
a) whoami
b) last
c) id
22) Which command should you choose if you want to
change the owner of the below ‘coconut’ file?
a) chown teo:normal coconut
b) chmod teo:normal coconut
c) useradd –c teo:normal coconut
23) You are running a Red Hat machine. You have
added a 2
nd
NIC to your machine and reboot it. The
card is detected fully by the BIOS. Which file must be
created to allow this interface to function?
a) /etc/sysconfig/network-scripts/ifcfg-eth0
b) /etc/sysconfig/network-scripts/ifcfg-eth1
c) /etc/sysconfig/network-scripts/ifcfg-eth2
24) Which Linux command can be used to modify the list
of groups a user belongs to?
a) usermod
b) groupadd
c) chgrp
25) Your lemus.dat file is existing in current directory.
You want to append some data to it. What command
will be deployed?
a) tee –a lemus.dat
b) tee lemus.dat
c) touch –a lemus.dat
26) You want to show only the middle 15 lines of a 45
line text file named test.txt. Which of the following
commands will you use?
a) head –n 16-30 test.txt
b) tail +16 test.txt > head -15 test.txt
c) head –n 30 test.txt | tail -15
27) What utility can you use to show a dynamic listing of
running processes?
a) top
b) ps
c) pgrep
28) When you create spat user without using -d option.
Which home-directory of spat will be made?
a) /usr/spat
b) /home/spat
c) /etc/spat
29) You need to view the MAC address, IP address and
loopback address informations for all of your
configured and active interfaces. Type the command
string that will accomplish this.
a) ifconfig
b) ifconfig –a
c) vi /etc/sysconfig/network-scripts/ifcfg-all
30) You wish to find a votandung user in your system.
Which statement will you choose?
a) find /usr –name votandung
b) grep votandung /etc/passwd
c) whoami votandung
31) Which Linux command can be used to show the
available space on local hard-disk partitions?
a) df -hT
b) fdisk –l
c) df
32) Which is the mount-point of following command?
mount –t vfat /dev/sda2 /mnt/disk2
a) -t vfat
b) /dev/sda2
c) /mnt/disk2
33) Choose the best command in the followings to list all
files and directories in your Linux system.
a) ls –R /
b) find />r.txt;cat r.txt
c) both a) and b) are right.
34) You want to creat a compressed backup of the user
home directories. What utility should you use?
a) gzip
b) compress
c) tar
35) If you want to make a hard link from t2 directory to t1
directory. Which of the following commands is right?
a) ln /a/b/t1 t2
b) ln /a/b/t1 /a/b/t2
c) Both a) and b) are false.
36) Assume that your current directory is '/tm1' and your
home directory is '/home/dung'. Which of the below
commands will copy all the content of '/tm1/tm2/' to a
'tm2' subdirectory of your home directory?
a) cp -r tm2/* /home/dung
b) cp -r ./tm2 ~
c) cp -r /tm1/tm2 /home/dung/tm2
37) You need to view the contents of the tarfile called
Khoa9.tar. What command would you use?
a) tar tf Khoa9.tar
b) tar tf Khoa9
c) tar xf Khoa9.tar
38) If you want to make a symbol link (soft link) from t2
file to t1 file. Which of the following commands is
right?
a) ln –s t1 t2
b) ln /a/b/t1 /a/b/t2
c) ln –s /a/b/t1 /a/b/t2
Page 2 of 3 (exam #1)
39) Your umask is set to 012. If you create a new
directory, what will the permission of the new
directory be?
a) -rwxrw-r-x
b) drw-r-xr
c) drwxrw-r-x
40) In your present working directory, you have only
these files: firewall.txt, firefox.txt, fine.txt. What is the
fewest number of keys you can type to open the file
“fine.txt” with vi (include typing “v” and “i” of vi
command)?
a) 6
b) 8
c) 12
41) You type the command “cd ~foo” in your Linux
console. What does the command do?
a) It will take you to the “~foo” directory.
b) It will take you to the home directory of the user
“foo”.
c) It will take you to the “/root/foo” directory.
42) Which of the following commands would count the
total number of lines with the word “root” in
/etc/passwd file?
a) wc –l /etc/passwd | grep root
b) grep root /etc/password | wc –l
c) cat /etc/passwd | grep root | wc –l
43) What key combination can you press to suspend a
running job and place it in the background?
a) Ctrl-Z
b) Ctrl-D
c) Ctrl-B
44) Which command allows you to make a shell variable
(named VTD) visible to subshell?
a) export $VTD
b) env VTD
c) export VTD
45) If you know that your samba service’s name is smbd.
Which following command is deployed to find out if
your samba service is running:
a) find / -name smbd -depth
b) whereis smbd
c) ps –e | grep smbd
46) You want to check what shares are offered by a
Windows system. Which of the following commands
could you use to perform this task on your Linux
system?
a) smbclient
b) smbstatus
c) smbshares
47) Which two files in a user’s home directory are used
to customize the bash (Bourne-Again shell)
environmment ?
a) profile and .bash_profile
b) profile and .bashrc
c) .bash_profile and .bashrc
48) You issue the command jobs and receive the
following output:
[1]- Stopped (tty output) pine
[2]+ Stopped (tty output) MyProgram
How would you bring the MyProgram process to the
foreground?
a) Ctrl-C
b) Ctrl-Z
c) fg %2
49) You would like all the users of the system to be able
to run your new “abc” application which has been
copied it to the directory “/usr/local/bin”. Which of the
following command lines would allow the appropriate
access?
a) chmod u+x /usr/local/bin/abc
b) umask 0022 /usr/local/bin/abc
c) chmod 777 /usr/local/bin/abc
50) Which one of the following commands copies files
with the .dat extension from /tm1 into /tm2?
a) mv /tm1/*.dat /tm2
b) cp /tm1/*.dat /tm2
c) cp -p /tm2 < /tm1/*.dat
END
Page 3 of 3 (exam #1)
. #1
#1
INFORMATION TECHNOLOGY COLLEGE OF HO CHI MINH CITY
FACULTY OF INFORMATION TECHNOLOGY
oOo
FINAL EXAMINATION
SUBJECT: FUNDAMENTALS OF LINUX
CLASSES:. /etc/sysconfig/network-scripts/ifcfg-eth0
b) /etc/sysconfig/network-scripts/ifcfg-eth1
c) /etc/sysconfig/network-scripts/ifcfg-eth2
24) Which Linux command can