Docsity

Linux Foundation TSCB Exam Practice Questions, Exams of Technology

Toggle sidebar
bg1
Linux Foundation TSCB Exam
Question 1. Which command is used to list all files, including hidden files, in a directory?
A) ls -a
B) listall
C) la
D) show -all
Answer: A
Explanation: The ls -a command lists all files, including those beginning with a dot (hidden files).
Question 2. What does the command cp file1.txt /tmp/ do?
A) Moves file1.txt to /tmp/
B) Copies file1.txt to /tmp/
C) Deletes file1.txt from /tmp/
D) Renames file1.txt to tmp
Answer: B
Explanation: cp copies file1.txt into the /tmp/ directory.
Question 3. How do you recursively remove a directory and its contents?
A) rm -r directory
B) del directory
C) removeall directory
D) rmdir directory
Answer: A
Explanation: rm -r deletes the directory and all its files/subdirectories.
Question 4. Which command creates a symbolic link named link.txt to file.txt?
A) ln -s file.txt link.txt
B) link file.txt link.txt
C) ln file.txt link.txt
D) symlink file.txt link.txt
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

Partial preview of the text

Download Linux Foundation TSCB Exam Practice Questions and more Exams Technology in PDF only on Docsity!

Question 1. Which command is used to list all files, including hidden files, in a directory? A) ls - a B) listall C) la D) show - all Answer: A Explanation: The ls - a command lists all files, including those beginning with a dot (hidden files). Question 2. What does the command cp file1.txt /tmp/ do? A) Moves file1.txt to /tmp/ B) Copies file1.txt to /tmp/ C) Deletes file1.txt from /tmp/ D) Renames file1.txt to tmp Answer: B Explanation: cp copies file1.txt into the /tmp/ directory. Question 3. How do you recursively remove a directory and its contents? A) rm - r directory B) del directory C) removeall directory D) rmdir directory Answer: A Explanation: rm - r deletes the directory and all its files/subdirectories. Question 4. Which command creates a symbolic link named link.txt to file.txt? A) ln - s file.txt link.txt B) link file.txt link.txt C) ln file.txt link.txt D) symlink file.txt link.txt

Answer: A Explanation: ln - s creates a symbolic (soft) link; the target comes first, then the link name. Question 5. Which command finds all files named "report.txt" starting from root? A) find / - name report.txt B) search / report.txt C) locate report.txt / D) find report.txt / Answer: A Explanation: find / - name report.txt searches the entire filesystem for files named report.txt. Question 6. What does the command cat file.txt do? A) Concatenates two files B) Shows the contents of file.txt C) Deletes file.txt D) Edits file.txt Answer: B Explanation: cat displays the contents of a file to the standard output. Question 7. Which command compresses a file using gzip? A) gzip filename B) tar filename C) compress filename D) zip filename Answer: A Explanation: gzip compresses a file with the .gz extension. Question 8. What is the effect of chmod 755 script.sh? A) Only owner can execute

Explanation: systemctl restart sshd uses systemd to restart the sshd service. Question 12. How do you schedule a one-time job to run at 3:30 PM using the at command? A) at 15: B) cron 15: C) runat 15: D) atjob 15: Answer: A Explanation: at is used for one-time scheduling; at 15:30 specifies the time. Question 13. Which command displays current CPU usage statistics? A) top B) df C) du D) netstat Answer: A Explanation: The top command displays CPU, memory, and process usage live. Question 14. To install a package called "vim" on Ubuntu, which command is correct? A) apt install vim B) yum install vim C) dnf install vim D) install vim Answer: A Explanation: apt is the Debian/Ubuntu package manager; apt install installs packages. Question 15. What file contains a list of repositories for apt on Debian/Ubuntu? A) /etc/apt/sources.list B) /etc/yum.repo.d/

C) /var/lib/apt/ D) /root/.apt/ Answer: A Explanation: /etc/apt/sources.list contains the repositories for apt. Question 16. Which bootloader is commonly used in modern Linux systems? A) GRUB B) LILO C) Bootmgr D) NTLDR Answer: A Explanation: GRUB (GRand Unified Bootloader) is standard on most Linux systems. Question 17. Which command creates a new directory called "projects"? A) mkdir projects B) newdir projects C) createdir projects D) dircreate projects Answer: A Explanation: mkdir is the standard command for creating directories. Question 18. What does the command tar - czvf archive.tar.gz folder/ do? A) Compresses folder into archive.tar.gz B) Extracts archive.tar.gz into folder C) Lists files in archive.tar.gz D) Deletes folder Answer: A Explanation: tar - czvf creates a compressed tar.gz archive of the folder.

Answer: A Explanation: Traditional SysVinit runlevels go from 0 to 6; there is no runlevel 7. Question 23. Which file defines environment variables for all users on login? A) /etc/profile B) ~/.bashrc C) ~/.profile D) /etc/environment Answer: A Explanation: /etc/profile is sourced at login for all users. Question 24. What does the command grep "error" logfile.txt do? A) Searches for lines containing "error" in logfile.txt B) Deletes lines with "error" C) Replaces "error" with blank D) Counts "error" occurrences Answer: A Explanation: grep searches for lines matching the pattern. Question 25. How do you append text to a file using redirection? A) echo "text" >> file.txt B) echo "text" > file.txt C) echo "text" < file.txt D) cat "text" file.txt Answer: A Explanation: >> appends output to the file. Question 26. Which command shows the amount of free and used memory? A) free

B) memstat C) showmem D) usedmem Answer: A Explanation: free displays information about memory usage. Question 27. What does the command ls - lh show? A) List files with human-readable sizes B) List only hidden files C) List files with hard links D) List files in long format only Answer: A Explanation: - lh lists in long format and human-readable sizes (e.g., MB, GB). Question 28. How do you set a variable "USER" to "admin" in Bash? A) USER=admin B) set USER=admin C) var USER=admin D) USER:admin Answer: A Explanation: Bash variables are set using VAR=value syntax. Question 29. Which command is used to compare two files line by line? A) diff file1 file B) cmp file1 file C) compare file1 file D) match file1 file Answer: A Explanation: diff is used to show line-by-line differences.

D) unzip archive.tar.gz Answer: A Explanation: - x extracts, - z for gzip, - v for verbose, - f for file. Question 34. To check the last 20 lines of a log file, which command is correct? A) tail - n 20 logfile B) head - n 20 logfile C) less logfile D) cat logfile | tail 20 Answer: A Explanation: tail - n 20 shows the last 20 lines. Question 35. Which command searches for the "nginx" binary in your PATH? A) which nginx B) find nginx C) locate nginx D) search nginx Answer: A Explanation: which shows the location of executables in PATH. Question 36. What does the command sed 's/foo/bar/g' file.txt do? A) Replace 'foo' with 'bar' in file.txt B) Delete all 'foo' C) Append 'bar' to each line D) Remove all lines with 'foo' Answer: A Explanation: sed 's/foo/bar/g' replaces all instances of 'foo' with 'bar' in each line. Question 37. Which command lists all currently loaded kernel modules?

A) lsmod B) modinfo C) modprobe D) insmod Answer: A Explanation: lsmod lists loaded kernel modules. Question 38. How do you display the manual for the "grep" command using the info system? A) info grep B) man grep C) grep --help D) docs grep Answer: A Explanation: info provides in-depth documentation, sometimes more detailed than man. Question 39. Which command would you use to find the disk space used by /var? A) du - sh /var B) df /var C) ls - lh /var D) diskusage /var Answer: A Explanation: du - sh /var gives the summary (-s) in human-readable format (-h). Question 40. What does the command df - h show? A) Free and used space on mounted filesystems, human-readable B) Disk fragment details C) Directory sizes D) File access times Answer: A

C) user D) username Answer: A Explanation: whoami prints the effective username. Question 45. Which command will show the last login times for all users? A) last B) history C) logins D) who Answer: A Explanation: last displays a list of last logins. Question 46. In a cron job definition, what does the first field specify? A) Minute B) Hour C) Day of month D) Month Answer: A Explanation: The first field in a crontab line is the minute. Question 47. Which command is used to extract files from a .zip archive? A) unzip archive.zip B) tar - xvf archive.zip C) extract archive.zip D) gunzip archive.zip Answer: A Explanation: unzip extracts files from .zip archives.

Question 48. How do you count the number of lines in a file? A) wc - l file.txt B) count file.txt C) grep - c file.txt D) lines file.txt Answer: A Explanation: wc - l counts lines in a file. Question 49. Which command shows a list of all users on the system? A) cat /etc/passwd B) users C) who D) id Answer: A Explanation: /etc/passwd lists all user accounts. Question 50. How do you display running processes in a tree format? A) pstree B) top C) ps tree D) proctree Answer: A Explanation: pstree displays processes in a hierarchical tree. Question 51. Which command will force remove a file named "test.txt"? A) rm - f test.txt B) del test.txt C) remove test.txt D) rm --force test.txt

B) kernel - v C) version D) lsmod Answer: A Explanation: uname - r outputs the kernel release. Question 56. How do you run a command in the background? A) Append & to the command B) Add bg before the command C) Use runbg D) Use background command Answer: A Explanation: & runs the command in the background. Question 57. Which file contains user account information? A) /etc/passwd B) /etc/group C) /etc/shadow D) /etc/login Answer: A Explanation: /etc/passwd contains user account details. Question 58. What is the function of the /etc/shadow file? A) Stores encrypted user passwords B) Stores user groups C) Stores user home directories D) Stores user shells Answer: A Explanation: /etc/shadow stores encrypted user passwords.

Question 59. How do you display the network interface configuration? A) ifconfig or ip addr B) netstat C) network D) nicinfo Answer: A Explanation: ifconfig (deprecated) or ip addr shows NIC configuration. Question 60. Which command is used to display the current date and time? A) date B) time C) now D) datetime Answer: A Explanation: date prints the current system date and time. Question 61. What does the command mv old.txt new.txt do? A) Renames old.txt to new.txt B) Copies old.txt to new.txt C) Deletes both files D) Appends old.txt to new.txt Answer: A Explanation: mv renames or moves files. Question 62. Which command shows the size of all files in the current directory? A) du - sh * B) ls - l C) df.

A) grep - r "error" /var/log B) find "error" /var/log C) search "error" /var/log D) grep "error" /var/log Answer: A Explanation: grep - r searches recursively through directories. Question 67. Which command will show all open network ports? A) netstat - tuln B) showports C) portlist D) netshow Answer: A Explanation: netstat - tuln lists all listening ports. Question 68. What does the command history show? A) Previously executed commands B) List of users C) List of files D) System uptime Answer: A Explanation: history shows the command history for the current shell. Question 69. Which command will display detailed information about the CPU? A) lscpu B) cpuinfo C) cpu - v D) hardware Answer: A

Explanation: lscpu displays information about the CPU architecture. Question 70. How do you search for a pattern and display line numbers using grep? A) grep - n pattern file.txt B) grep - l pattern file.txt C) grep - r pattern file.txt D) grep - c pattern file.txt Answer: A Explanation: - n adds line numbers to the output. Question 71. Which command is used to edit text files in the command line? A) nano B) edit C) vim D) Both A and C Answer: D Explanation: Both nano and vim are common command-line text editors. Question 72. How do you display the groups a user belongs to? A) groups username B) group username C) usergroups username D) showgroups username Answer: A Explanation: groups username lists all groups for the user. Question 73. Which file contains group information on a Linux system? A) /etc/group B) /etc/passwd