QCM 3SI 2022
1)Which of the following commands lists the dependencies of a given dpkg package?
A. apt-cache depends-onpackage
B. apt-cache dependencies package
C. apt-cache depends package
D. apt-cache requires package
2) Which of the following commands backups the MBR located on /dev/sda ?
A. dd if=/dev/zero of=/dev/sda bs=512
B. dd if=/dev/sda of=fic bs=512 count=1
C. dd if=/dev/zero of=/dev/sda bs=512 count=1
D. dd if=/dev/sda of=fic bs=440
3) What is the difference between the --remove and the --purge action with the dpkg command?
A. --remove removes the program, --purge also removes the config files
B. --remove only removes the program, --purge only removes the config files
C. --remove removes a package, --purge also removes all packages dependent on it
D. --remove removes only the package file itself, --purge removes all files related to the package
4)Which of the following apt-get commands will install the newest versions of all currently
installed packages without removing any packages or installing new
packages that are not already installed?
A. auto-update
B. upgrade
C. dist-upgrade
D. install
E. update
5) When removing a package, which of the following dpkg options will completely remove the files
including configuration files?
A. --clean
B. --delete
C. --purge
D. –remove
6) When given the following command line. echo "foo bar" | tee bar | cat
Which of the following output is created?
A. cat
B. foo bar
C. tee bar
D. bar
E. foo
7) Which of the following commands determines the type of a file by using a definition database
file which contains information about all common file types?
A. magic
B. type
C. file
D. pmagic
E. hash
8) What command will generate a list of user names from /etc/passwd along with their login shell?
A. column -s : 1,7 /etc/passwd
B. chop -c 1,7 /etc/passwd
C. colrm 1,7 /etc/passwd
D. cut -d: -f1,7 /etc/passwd
9) Which of the following commands prints a list of usernames (first column) and their primary
group (fourth column) from the /etc/passwd file?
A. fmt -f 1,4 /etc/passwd
B. split -c 1,4 /etc/passwd
C. cut -d : -f 1,4 /etc/passwd
D. paste -f 1,4 /etc/passwd
10) Which of the following commands replaces each occurrence of 'bob' in the file letter with 'Bob'
and writes the result to the file newletter?
A. sed '/bob/Bob' letter > newletter
B. sed s/bob/Bob/ letter < newletter
C. sed's/bob/Bob' letter > newletter
D. sed 's/bob/Bob/g' letter > newletter
E. sed 's/bob, Bob/' letter > newletter
11) Which of the following commands prints all files and directories within the /tmp directory or its
subdirectories which are also owned by the user root? (Choose TWO correct answers.)
A. find /tmp -uid root -print
B. find -path /tmp -uid root
C. find /tmp -user root -print
D. find /tmp -user root
E. find -path /tmp -user root –print
12) Which of the following commands can be used to create a USB storage media from a disk
image?
A. gdisk
B. dd
C. cc
D. fdisk
E. mount
13) A user accidentally created the subdirectory \dir in his home directory. Which of the following
commands will remove that directory?
A. rmdir '~/\dir'
B. rmdir "~/\dir"
C. rmdir ~/'dir'
D. rmdir ~/\dir
E. rmdir ~/\\dir
14) Immediately after deleting 3 lines of text in vi and moving the cursor to a different line, which
single character command will insert the deleted content below the current line?
A. i (lowercase)
B. P (uppercase)
C. p (lowercase)
D. U (uppercase)
E. u (lowercase)
15) What does the command mount -a do?
A. It mounts all available filesystems onto the current directory.
B. It shows all mounted filesystems.
C. It mounts all user mountable filesystems for the current user.
D. It mounts all filesystems listed in /etc/fstab which have the option auto set.
E. It mounts all filesystems listed in /etc/fstab which have the option noauto set.
16) Which command is used to query information about the available packages on a Debian
system?
A. apt-cache
B. apt-get
C. apt-search
D. dpkg
E. dpkg-search
17) Which of the following options must be passed to a filesystem’s entry in /etc/fstab in order to
mount the file system without root privileges?
A. auto
B. norestrict
C. noauto
D. user
18) Which permissions and ownership should the file /etc/passwd have?
A. -rw-------1 root root 531 Jun 5 22:45 /etc/passwd
B. -rw-r--r--1 root root 531 Jun 5 22:45 /etc/passwd
C. -rw-r--r--1 11531 Jun 5 22:45 /etc/passwd
D. -rw-------1 11531 Jun 5 22:45 /etc/passwd
19) When planning a partition scheme, which of the following directories could be considered for
separate partitions? (Choose three)
A. /etc
B. /home
C. /var
D. /lib
E. /opt
20) Which of the following partition types is used for Linux swap spaces when partitioning hard
disk drives?
A. 82
B. 83
C. 8e
D. fd
E. 7
21) Which signal is sent by the kill command by default?
A. SIGHUP(1)
B. SIGQUIT(3)
C. SIGKILL(9)
D. SIGTERM(15)
22) Which of the following is true for hard linked files? (Choose three.)
A. The output of stat will reporthardinstead ofregular file.
B. The hard linked files have the same permissions and owner.
C. The hard linked files share the same inode.
D. The hard linked files are indicated by a -> when listed withls -1.
E. The hard linked files must be on the same filesystem.
23) Which of the following commands print the current working directory when using a Bash shell?
(Choose two.)
A. echo “${PWD}”
B. echo “${WD}”
C. pwd
D. printwd
E. echo “${pwd}”
24) Which chown command will change the ownership to dave and the group to staff on a file
named data.txt?
A. chown dave/staff data.txt
B. chown –u dave –g staff data.txt
C. chown --user dave --group staff data.txt
D. chown dave:staff data.txt
25) Which of the following are modes of the vi editor? (Choose two.)
A. paste mode
B. insert mode
C. change mode
D. review mode
E. command mode
26) Which of the following commands are common Linux commands for file management?
(Choose three correct answers.)
A. copy
B. mv
C. move
D. cp
E. mkdir
27) Which of the following file permissions belong to a symbolic link?
A. -rwxrwxrwx
B. +rwxrwxrwx
C. lrwxrwxrwx
D. srwxrwxrwx
28) Which of the following are valid stream redirection operators within Bash? (Choose two.)
A. <
B. #>
C. %>
D. >>>
E. 2>&1
29) Which of the following files, located in a user’s home directory, contains the Bash history?
A. .bashrc_history
B. .bash_histfile
C. .history
D. .bash_history
E. .history_bash
30) Which of the following commands will reduce all consecutive spaces down to a single space?
A. tr '\s' ' ' < a.txt > b.txt
B. tr -c ' ' < a.txt > b.txt
C. tr -d ' ' < a.txt > b.txt
D. tr -r ' ' '\n' < a.txt > b.txt
E. tr -s ' ' < a.txt > b.txt
31) Which of the following commands can be used to determine how long the system has been
running? (Choose TWO correct answers.)
A. uptime
B. up
C. top
D. uname -u
E. time –up
32) In the vi editor, which of the following commands will copy the current line into the vi buffer?
A. c
B. cc
C. 1c
D. yy
E. 1y
33) Which grep command will print only the lines that do not end with a / in the file foo?
A. grep'/$' foo
B. grep '/#' foo
C. grep -v '/$' foo
D. grep -v '/#' foo
34) Which of the following commands will change all CR-LF pairs in an imported text file,
userlist.txt, to Linux standard LF characters and store it as newlist.txt?
A. tr ‘\r\n’ ‘’ < userlist.txt > newlist.txt
B. tr –c ‘\n\r’ ‘’ < newlist.txt > userlist.txt
C. tr –d ‘\r’ < userlist.txt > newlist.txt
D. tr ‘\r’ ‘\n’ userlist.txt newlist.txt
E. tr –s ‘^M’ ‘^J’ userlist.txt newlist.txt
35) Which of the following commands set the sticky bit for the directory /tmp? (Choose TWO
correct answers.)
A. chmod +s /tmp
B. chmod +t /tmp
C. chmod 1775 /tmp
D. chmod 4775 /tmp
E. chmod 2775 /tmp
36) Pressing the Ctrl-C combination on the keyboard while a command is executing in the
foreground sends which of the following signal codes?
A. 1(SIGHUP)
B. 2(SIGINT)
C. 3(SIGQUIT)
D. 9(SIGKILL)
E. 15(SIGTERM)
37) Which command will uninstall a package but leave its configuration files in case the package is
re-installed?
A. dpkg –s pkgname
B. dpkg –L pkgname
C. dpkg –P pkgname
D. dpkg –r pkgname
38) Which umask value ensures that new directories can be read, written and listed by their owning
user, read and listed by their owning group and are not accessible at all for everyone else?
A. 0750
B. 0027
C. 0036
D. 7640
E. 0029
39) Which of the following commands will print the last 10 lines of a text file to the standard
output?
A. cat -n 10 filename
B. dump -n 10 filename
C. head -n 10 filename
D. tail -n 10 filename
40) Which of the following commands displays the contents of a gzip compressed tar archive?
A. gzip archive.tgz | tar xvf -
B. tar ztf archive.tgz
C. gzip -d archive.tgz | tar tvf -
D. tar cf archive.tgz
41) In a nested directory structure, which find command line option would be used to restrict the
command to searching down a particular number of subdirectories?
A. -dirmax
B. -maxdepth
C. -maxlevels
D. -n
E. -s
42) Which of the following settings for umask ensures that new files have the default permissions -
rw-r----- ?
A. 0017
B. 0640
C. 0038
D. 0027
43) Which of the following vi commands deletes two lines, the current and the following line?
A. d2
B. 2d
C. 2dd
D. dd2
E. de12
44) What is the purpose of the xargs command?
A. It passes arguments to an X server.
B. It reads standard input (STDIN) and builds up command lines to execute.
C. It helps shellscripts take variable argument lists.
D. It asks a question, graphically, and returns the answer to the shell.
E. It allows users to specify long options for commands that normally only accept short options.
45) What output will be displayed when the user fred executes the following command?
echo « fred $USER »
A. fred fred
B. fred /home/fred/
C. ‘fred $USER’
D. fred $USER
E. ‘fred fred’
============================================================
22222222222222222222222222222222222222222222222222222222222222222222
=============================================================
46) In the vi editor, what vi command will copy (but not paste) from the current line at the cursor
and the following 16 lines (17 lines total)? Specify the correct vi command without spaces.
17yy
47) Donnez l'alias capable de permettre de créer des répertoires
imbriqués du style /a/b/c/d/e
alias mkdir= « mkdir -p » ou mieux alias mkdir= « mkdir -vp »
48) Quelle commande liste tous les alias en cours ?
alias
49) Quelle commande supprime un alias comme "ll" ?
unalias ll
50) Comment peut-on découper un fichier fic.tar.gz par morceaux de 10 Mo ?
split -b 10m fic.tar.gz fic.tar.gz ou split -b 10m fic.tar.gz
51) Donner 3 manières de devenir "root" avec la commande "su"
su –login ; su -l ; su -
52) Donner 3 manières de devenir "root" avec la commande "sudo"
sudo su -
sudo su -l
sudo su --login
sudo -i
sudo -s
53) Quel est le nom du fichier de configuration de "sudo" ?
/etc/sudoers
54) Quelles sont les 2 commandes qui permettent de l'éditer dans les règles de l'art ?
visudo ; sudoedit /etc/sudoers
55) Que fait chmod 750 /home/davy/scripts ?
rwxr-x---
56) Que fait 4755 sur /usr/bin/passwd en rwx ?
rwsr-xr-x
57) Que fait chown davy. /home/davy/scripts ?
Le user davy est propriétaire et groupe propriétaire
drwxr-xr-x 2 davy davy 6 mai 24 22:44 script
58 ) Comment plaquer les droits d'un fichier /home/davy/fic.sh et FIC.sh
chmod --reference=/home/davy/fic.sh FIC.sh
59) Comment peut-on éditer le fichier /etc/ssh/ssh_config sur le serveur « myserver » à distance ?
ssh -t myserver « vim /etc/ssh/ssh_config »
60) Comment peut-on copier un répertoire « /etc » d’un serveur « myserver » dans son propre
home directory ?
scp -r myserver:/etc ~
scp -r myserver:/etc $HOME
61) Comment peut-on savoir combien restent-ils d’inodes de libres sur le « / » ?
df -i
62) Comment peut-on libérer des inodes en supprimant les fichiers vides ?
find / -type f -size 0 -ls
repérer ensuite les répertoires où il y a des fichiers vides et passer la commade suivante
find /myrep -type f -size 0 -exec rm -fv {} \ ;
63) Comment peut-on retrouver tous les fichiers de « /etc » qui contiennent le mot exact dhcp quelle
que soit la casse ?
find /etc -type f |xargs grep -w --color « dhcp »
64) Comment liste-on tous mes mémentos tagués « personal » avec cheat ?
cheat -t personal -l
65) Comment cherche-t-on toutes les occurrences « ssh » ?
cheat -s ssh
66) Comment s’appelle le fichier de conf de « cheat » ?
$HOME/.config/cheat/conf.yml ou conf.yml
67) Comment voir rapidement le script de démarrage d’un serveur « nginx » ?
systemctl cat nginx
68) Après avoir fait des modifications dans ce fichier, comment peut-on le faire prendre en compte
immédiatement ?
systemctl daemon-reload
69) Comment peut-on visualiser tous les messages d’erreur depuis le dernier boot d’un serveur
Linux ?
journalctl -p err -b
70) Comment peut-on obtenir la liste des binaires installés par un package « openssh-server » ?
dpkg l openssh-server |grep bin
================================================
333333333333333333333333333333333333333333333333333333
================================================
71) Which of the following commands will produce the following output?
ps ou ps |head
72) ls -li /bin/z*
73) free -m
74) Voici les dernières lignes d’un fichier « /etc/passwd », comment peut-on récupérer seulement
les lignes allant de « geoclue » jusqu’à « dnsmasq » ?
tail -8 /etc/passwd |head -4
75) Comment trie-ton les UID par ordre décroissant ceci ?
sort -t : -k 3 -rn
76) Comment peut-on savoir si l’on a ou pas la bonne « timezone » ?
timedatectl
77) Comment connaître son OS, son nom de machine et l’architecture du processeur ?
hostnamectl
78) Comment peut-on voir toutes les tentatives de connexion, d’intrusion échouées ?
grep « invalid » var/log/auth.log
79) Que doit-on mettre dans le fichier « /etc/ssh/sshd_config » pour invalider toute connexion à
root et toute connexion tout court sauf pour « hikarunogo »?cat
AllowUsers hikarunogo@*
80) De quel fichier s’agit-il ?
/etc/hosts.deny