Docsity

Linux Foundation Certified System Administrator (LFCS) Exam Questions, Exams of Technology

Toggle sidebar
bg1
Linux Foundation Certified System Administrator Beta
Exam
Question 1. Which command is used to list all files, including hidden ones, in a directory?
A) ls -a
B) ls -l
C) ls -h
D) ls -d
Answer: A
Explanation: The -a option with ls lists all files, including those starting with a dot (hidden files).
Question 2. Which command is used to change the current working directory in Linux?
A) pwd
B) cd
C) ls
D) mv
Answer: B
Explanation: The cd command is used to change the current working directory.
Question 3. What does the ‘touch’ command do?
A) Deletes a file
B) Creates an empty file or updates the modification time
C) Moves a file
D) Renames a file
Answer: B
Explanation: touch creates a new empty file or updates the timestamp if it already exists.
Question 4. How do you display the current directory path?
A) ls
B) cd
C) pwd
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48

Partial preview of the text

Download Linux Foundation Certified System Administrator (LFCS) Exam Questions and more Exams Technology in PDF only on Docsity!

Exam

Question 1. Which command is used to list all files, including hidden ones, in a directory? A) ls - a B) ls - l C) ls - h D) ls - d Answer: A Explanation: The - a option with ls lists all files, including those starting with a dot (hidden files). Question 2. Which command is used to change the current working directory in Linux? A) pwd B) cd C) ls D) mv Answer: B Explanation: The cd command is used to change the current working directory. Question 3. What does the ‘touch’ command do? A) Deletes a file B) Creates an empty file or updates the modification time C) Moves a file D) Renames a file Answer: B Explanation: touch creates a new empty file or updates the timestamp if it already exists. Question 4. How do you display the current directory path? A) ls B) cd C) pwd

Exam

D) echo $PATH Answer: C Explanation: pwd (print working directory) shows the current directory path. Question 5. Which of the following commands will recursively list all files and directories from the current directory? A) ls - a B) ls - R C) ls - l D) ls - d Answer: B Explanation: The - R option makes ls list directories and their contents recursively. Question 6. Which command is used to copy files in Linux? A) mv B) cp C) copy D) scp Answer: B Explanation: cp is the standard command for copying files and directories. Question 7. How do you move or rename a file in Linux? A) cp B) mv C) rm D) ln Answer: B Explanation: mv moves files or directories and can also be used to rename them.

Exam

D) locate ‘error’ logfile.txt Answer: B Explanation: grep is used to search for patterns within files. Question 12. Which command will display the first 10 lines of a file? A) tail B) head C) less D) more Answer: B Explanation: head by default shows the first 10 lines of a file. Question 13. What does the command ‘chmod 755 file’ do? A) Sets file permissions to rwxr-xr-x B) Sets file permissions to rw-rw-rw- C) Sets file permissions to r-xr-xr-x D) Sets file permissions to rwxrwxrwx Answer: A Explanation: 755 means owner has all permissions, group and others have read and execute. Question 14. How do you change the owner of a file to user ‘bob’? A) chown bob file B) chmod bob file C) setowner bob file D) usermod bob file Answer: A Explanation: chown changes the ownership of files and directories.

Exam

Question 15. Which command is used to change the group ownership of a file? A) chown :group file B) chmod group file C) chgrp group file D) setgroup group file Answer: C Explanation: chgrp is used to change the group ownership of a file. Question 16. What does the ‘umask’ command control? A) Default file permissions B) File ownership C) File content D) File size Answer: A Explanation: umask sets the default permissions for newly created files and directories. Question 17. How do you set the SUID bit on a file named ‘program’? A) chmod u+s program B) chmod +x program C) chown suid program D) setuid program Answer: A Explanation: The u+s flag sets the SUID (Set User ID) bit. Question 18. What is the effect of setting the sticky bit on a directory? A) Only the file owner can delete or rename files in that directory B) All users can delete files C) Only root can delete files

Exam

Question 22. What is the purpose of the ‘info’ command? A) View detailed documentation about commands B) Show system information C) Display process information D) Show disk usage Answer: A Explanation: info displays detailed documentation in a hypertext format. Question 23. How do you search for a keyword in all manual pages? A) man - k keyword B) man keyword C) help keyword D) info keyword Answer: A Explanation: man - k searches the short descriptions and manual page names for a keyword. Question 24. Which command is used to create an empty directory? A) mkdir B) rmdir C) mkfile D) touchdir Answer: A Explanation: mkdir creates new directories. Question 25. What does the ‘rm’ command do by default? A) Removes files B) Removes directories C) Removes users

Exam

D) Removes links Answer: A Explanation: rm removes files by default; directories require - r option. Question 26. Which command searches for files and directories by name? A) find B) locate C) search D) grep Answer: B Explanation: locate uses a database to quickly search for files by name. Question 27. How can you display the contents of a compressed text file ‘file.txt.gz’ without decompressing it? A) zcat file.txt.gz B) gunzip file.txt.gz C) cat file.txt.gz D) less file.txt.gz Answer: A Explanation: zcat displays the content of a gzipped file without extracting it. Question 28. Which command is used to compare the contents of two files? A) diff B) cmp C) comm D) All of the above Answer: D Explanation: All listed commands can compare files in different ways.

Exam

D) disk Answer: A Explanation: du reports disk usage of files and directories. Question 33. How do you display free and used memory on the system? A) free B) mem C) meminfo D) memory Answer: A Explanation: free displays memory usage statistics. Question 34. What does the ‘ps’ command do? A) Lists running processes B) Starts a new process C) Stops a process D) Monitors system performance Answer: A Explanation: ps lists currently running processes. Question 35. Which command will display a real-time view of system processes? A) top B) ps C) jobs D) monitor Answer: A Explanation: top provides a dynamic, real-time view of running processes.

Exam

Question 36. What does the ‘kill’ command do? A) Terminates running processes B) Starts new processes C) Suspends processes D) Prioritizes processes Answer: A Explanation: kill sends signals to processes, typically to terminate them. Question 37. How do you send the SIGKILL signal to process ID 1234? A) kill - 9 1234 B) kill 1234 C) kill - 15 1234 D) sigkill 1234 Answer: A Explanation: - 9 is the signal number for SIGKILL, which forcefully terminates a process. Question 38. Which command installs packages on Debian-based systems? A) apt B) yum C) rpm D) dnf Answer: A Explanation: apt is the package manager for Debian-based distributions. Question 39. How do you remove a package using yum? A) yum remove package B) yum delete package C) yum uninstall package

Exam

Question 43. What is the main configuration file for the yum package manager? A) /etc/yum.conf B) /etc/yum/yum.conf C) /etc/yum.repos.d/yum.conf D) /etc/yum/repos.conf Answer: A Explanation: /etc/yum.conf is the main configuration file for yum. Question 44. Which command can be used to list all services managed by systemd? A) systemctl list-units --type=service B) systemctl list-all C) service --list D) systemctl services Answer: A Explanation: systemctl list-units --type=service lists all systemd services. Question 45. How do you start a systemd service named ‘httpd’? A) systemctl start httpd B) service httpd start C) start httpd D) initctl start httpd Answer: A Explanation: systemctl start is used to start a systemd-managed service. Question 46. Which command shows the status of a systemd service? A) systemctl status servicename B) service servicename status C) status servicename

Exam

D) systemd status servicename Answer: A Explanation: systemctl status servicename displays the status of a service. Question 47. What does the ‘systemctl enable’ command do? A) Starts a service immediately B) Enables a service to start at boot C) Disables a service D) Reloads a service Answer: B Explanation: systemctl enable configures a service to start during boot. Question 48. Which command will reboot a Linux system immediately? A) reboot B) shutdown - r now C) systemctl reboot D) All of the above Answer: D Explanation: All listed commands can be used to reboot the system. Question 49. How do you shut down a Linux system immediately? A) shutdown - h now B) poweroff C) halt D) All of the above Answer: D Explanation: All listed commands will shut down a Linux system.

Exam

D) locate Answer: A Explanation: whereis shows locations for binaries, sources, and man pages. Question 54. What is the effect of running ‘chmod o-w file.txt’? A) Removes write permission for others B) Adds write permission for others C) Removes write permission for owner D) Adds write permission for group Answer: A Explanation: o-w removes write permission for others. Question 55. What does the ‘df’ command show? A) Disk space usage of mounted filesystems B) Directory size C) File size D) Disk format Answer: A Explanation: df shows free and used space on mounted filesystems. Question 56. How do you compress a file using bzip2? A) bzip2 filename B) zip filename C) gzip filename D) tar filename Answer: A Explanation: bzip2 compresses the specified file using the bzip2 algorithm.

Exam

Question 57. Which command decompresses a .bz2 file? A) bunzip2 filename.bz B) unzip filename.bz C) bz2 filename.bz D) extract filename.bz Answer: A Explanation: bunzip2 decompresses .bz2 files. Question 58. Which command displays kernel ring buffer messages? A) dmesg B) syslog C) tail /var/log/messages D) journalctl Answer: A Explanation: dmesg displays kernel ring buffer messages. Question 59. What is the default runlevel or target for a graphical multi-user system in systemd? A) graphical.target B) multi-user.target C) default.target D) runlevel5.target Answer: A Explanation: graphical.target is the systemd target for a graphical multi-user system. Question 60. Which command shows the current systemd default target? A) systemctl get-default B) systemctl status C) systemctl show

Exam

Question 64. How do you clear the terminal screen? A) clear B) reset C) ctrl+l D) All of the above Answer: D Explanation: All listed methods can clear the terminal screen. Question 65. Where is the system’s hostname stored? A) /etc/hostname B) /etc/hosts C) /etc/host.conf D) /etc/sysconfig/hostname Answer: A Explanation: /etc/hostname contains the system's hostname. Question 66. Which command changes the system’s hostname temporarily? A) hostname newname B) sethostname newname C) change-hostname newname D) systemctl set-hostname newname Answer: A Explanation: hostname newname sets the hostname until the next reboot. Question 67. How do you display the current date and time? A) date B) time C) clock

Exam

D) timedate Answer: A Explanation: date displays current system date and time. Question 68. Which command displays the calendar for the current month? A) cal B) calendar C) date - c D) month Answer: A Explanation: cal displays a calendar. Question 69. Where are user account information and password hashes stored on most modern Linux systems? A) /etc/passwd and /etc/shadow B) /etc/accounts and /etc/passwords C) /etc/users and /etc/passwords D) /var/passwd and /var/shadow Answer: A Explanation: User info is in /etc/passwd; password hashes are in /etc/shadow. Question 70. Which command is used to add a new user? A) useradd B) adduser C) newuser D) createuser Answer: A Explanation: useradd is the standard command for adding users.