Understanding Computer Hardware

Linux Essentials +

GitHub Exam Questions

Writing here

Questions and Answers

1. Add directory to PATH

Question: Which of the following commands adds the directory /new/dir/ to the PATH environment variable?

Answer: export PATH=/new/dir:$PATH

2. File permissions with chmod

Question: Which permissions are set on a regular file once the permissions have been modified with the command chmod 654 file.txt?

Answer: -rw-r-xr--

3. DNS resolution

Question: Which of the following commands can be used to resolve a DNS name to an IP address?

Answer: host

4. /etc/skel directory

Question: Which statements about the directory /etc/skel are correct? (Choose two.)

5. Creating a ZIP archive

Question: Which of the following commands creates the ZIP archive poems.zip containing all files in the current directory whose names end in .txt?

Answer: zip poems.zip *.txt

6. Regular expression operator

Question: Which operator in a regular expression matches the preceding character either zero or one time?

Answer: ?

7. File ownership

Question: What is true about the owner of a file?

Answer: Each file is owned by exactly one user and one group.

8. Documentation directory

Question: Which of the following directories contains information, documentation and example configuration files for installed software packages?

Answer: /usr/share/doc/

9. Shell script for loop structure

Question: Which of the following examples shows the general structure of a for loop in a shell script?

Answer: for file in *.txt; do echo $i; done

10. Output of the free command

Question: Which of the following outputs comes from the command free?

total        used        free      shared  buff/cache   available
Mem:           15Gi        2.3Gi        9Gi      910Mi       3.0Gi        11Gi
Swap:          2.0Gi        0B         2.0Gi
    

11. Linux drivers

Question: Which of the following statements regarding Linux hardware drivers is correct?

Answer: Drivers are either compiled into the Linux kernel or are loaded as kernel modules.

12. Mounting directories

Question: Which of the following directories must be mounted with read and write access if it resides on its own dedicated file system?

Answer: /var

13. Shell script permission issue

Question: The current directory contains the following file: -rw-r--r-- 1 root exec 24551 Apr 2 12:36 test.sh. The file contains a valid shell script, but executing this file using ./test.sh leads to this error: bash: ./test.sh: Permission denied. What should be done in order to successfully execute the script?

Answer: The execute bit should be set in the file’s permissions.

14. Viewing file content with spaces

Question: Which of the following commands output the content of the file Texts 2.txt? (Choose two.)