Q61
Q61 How can you execute a shell script named script.sh?
./script.sh
sh script.sh
bash script.sh
source script.sh
Q62
Q62 What does the read command do in a shell script?
Reads a file
Reads user input
Reads a variable
Reads a command
Q63
Q63 What is the significance of the $? variable in shell scripting?
Stores the process ID of the last executed command
Stores the exit status of the last executed command
Stores the current shell's process ID
Stores the number of arguments passed to the script
Q64
Q64 How do you print "Hello, World!" to the terminal in a shell script?
echo "Hello, World!"
print "Hello, World!"
printf "Hello, World!"
disp "Hello, World!"
Q65
Q65 How do you assign the output of the date command to a variable named current_date in a shell script?
current_date=date
current_date=$(date)
current_date=$(date)
current_date=$date
Q66
Q66 How do you create a loop that runs 5 times in a shell script?
for i in {1..5}; do ... done
while [ $i -le 5 ]; do ... done
for i in 1 2 3 4 5; do ... done
until [ $i -gt 5 ]; do ... done
Q67
Q67 A shell script is giving a "Permission denied" error when executed.
What is the likely cause?
The script is not executable
The script has syntax errors
The script is missing the shebang
The script is not in the PATH
Q68
Q68 A user wants to debug a shell script to identify where it is failing.
Which command should they use?
sh -x script.sh
bash -x script.sh
set -x
echo
Q69
Q69 A shell script executes correctly when run manually but fails when run as a cron job.
What could be the issue?
Missing shebang
Incorrect script syntax
Environment variables not set
Script not executable
Q70
Q70 Which command is used to display the contents of a file?
cat
grep
awk
sed
Q71
Q71 What does the grep command do?
Displays file contents
Searches for patterns within files
Sorts the contents of a file
Counts the number of lines in a file
Q72
Q72 What is the primary function of the awk command?
Editing text files
Searching for patterns
Processing and analyzing text
Displaying file contents
Q73
Q73 Which command is used to delete lines from a file that match a specific pattern?
sed
awk
grep
cut
Q74
Q74 What does the cut command do in text processing?
Extracts sections from each line of a file
Sorts lines in a file
Counts the number of lines in a file
Displays the first few lines of a file
Q75
Q75 Which command is used to merge lines of files based on a common field?
sort
uniq
paste
join
Q76
Q76 How do you display the first 10 lines of a file named data.txt?
head data.txt
tail data.txt
cat data.txt
more data.txt
Q77
Q77 How do you search for the string "error" in a file named log.txt and display the matching lines?
grep "error" log.txt
awk "/error/ {print}" log.txt
sed -n "/error/p" log.txt
cut -d" " -f1 log.txt
Q78
Q78 How do you replace all occurrences of the word "Linux" with "GNU/Linux" in a file named os.txt?
sed 's/Linux/GNU/Linux/g' os.txt
awk '{gsub(/Linux/, "GNU/Linux")}1' os.txt
grep -rl "Linux" os.txt
cut -d" " -f1 os.txt
Q79
Q79 A user reports that the grep command is not finding matches in a file.
What could be the issue?
The file does not exist
The pattern is incorrect
The file is empty
The user does not have read permissions
Q80
Q80 A user needs to extract the second column of a comma-separated file named data.csv.
Which command should they use?
grep
cut
awk
sed
Q81
Q81 Which command is used to install packages in Debian-based distributions?
yum
dnf
apt-get
zypper
Q82
Q82 What is the primary purpose of a package manager in Linux?
To compile source code
To manage software packages
To update the kernel
To configure hardware
Q83
Q83 Which file contains the list of repositories for Debian-based distributions?
/etc/yum.conf
/etc/apt/sources.list
/etc/pacman.conf
/etc/zypper/repos.d
Q84
Q84 What is the function of the yum package manager?
To manage RPM packages
To manage DEB packages
To manage source code
To manage system services
Q85
Q85 Which command is used to upgrade all installed packages in Debian-based distributions?
yum update
apt-get upgrade
dnf upgrade
zypper update
Q86
Q86 Which package manager is used by Arch Linux?
yum
apt-get
dnf
pacman
Q87
Q87 How do you search for a package named "vim" using apt-get?
apt-get install vim
apt-get search vim
apt-get remove vim
apt-get update vim
Q88
Q88 How do you install a package named "nano" using yum?
yum search nano
yum install nano
yum remove nano
yum update nano
Q89
Q89 How do you remove a package named "wget" using apt-get?
apt-get remove wget
apt-get purge wget
apt-get delete wget
apt-get erase wget
Q90
Q90 A user reports that they cannot install a package using apt-get due to broken dependencies.
What is the likely solution?
Use the --fix-broken option
Update the package list
Clean the package cache
Reinstall the package manager