- What does the ‘&&’ operator do in a command?
a. Runs the second command if the first one fails.
b. Runs the second command regardless of the first one.
c. Runs the second command only if the first one is successful.
Ans. Runs the second command only if the first one is successful.
- What does the ‘ps’ command do?
a. Shows process status.
b. Shows disk usage.
c. Shows CPU usage.
Ans. Shows process status.
- What is the command to list all the files in a directory, including hidden files?
a. ls -a
b. ls -h
c. ls -l
Ans. ls -a
- What does the ‘df’ command do?
a. Shows disk usage.
b. Shows directory files.
c. Shows disk format.
Ans. Shows disk usage.
- What does the ‘whoami’ command do?
a. Display the current user.
b. Display the current directory.
c. Display the current date and time.
Ans. Display the current user.
- How do you check the disk usage of a directory?
a. du -sh
b. df -h
c. ls -lh
Ans. du -sh
- What does the ‘chmod 777’ command do?
a. Changes file permissions to read, write, and execute for all.
b. Deletes the file.
c. Changes the owner of the file.
Ans. Changes file permissions to read, write, and execute for all.
- What is the command to find the process running on a particular port?
a. lsof -i :port
b. ps -ef | grep port
c. netstat -an | grep port
Ans. lsof -i :port
- How do you check the OS version in Linux?
a. uname -r
b. cat /etc/os-release
c. lsb_release -a
Ans. cat /etc/os-release
- What is the purpose of the ‘chown’ command?
a. Change file permissions.
b. Change file ownership.
c. Change file group.
Ans. Change file ownership.
- What is the command to check the kernel version?
a. uname -r
b. cat /proc/version
c. lsb_release -a
Ans. uname -r
- How do you search for a specific string in files?
a. grep "string" *
b. find / -name "string"
c. ls | grep "string"
Ans. grep "string" *
- How do you check CPU usage?
a. top
b. ps -ef
c. vmstat
Ans. top
- How do you check memory usage in Lunux?
a. free -m
b. df -h
c. top
Ans. free -m
- What does the ‘kill’ command do in Linux?
a. Stops a running process.
b. Starts a process.
c. Pauses a process.
Ans. Stops a running process.
- How do you check the IP address on Linux?
a. ifconfig
b. ip addr show
c. Both Option 1 and 2.
Ans. Both Option 1 and 2.
- What is the command to check the history of commands used in the terminal?
a. history
b. !
c. !!
Ans. history
- What does the ‘crontab’ command do?
a. Schedules tasks.
b. Lists running tasks.
c. Kills tasks.
Ans. Schedules tasks.
- How do you change the hostname in Linux?
a. hostnamectl set-hostname new_hostname
b. hostname new_hostname
c. Both Option 1 and 2.
Ans. Both Option 1 and 2.
- What does the ‘tar’ command do?
a. Compresses files.
b. Extracts files.
c. Both Option 1 and 2.
Ans. Both Option 1 and 2.
- What does the ‘ping’ command do?
a. Checks network connectivity.
b. Checks disk usage.
c. Checks CPU usage.
Ans. Checks network connectivity.
- How do you set a ‘cron’ job to run every hour?
a. 0 * * * * command
b. * * * * * command
c. 1 * * * * command
Ans. 0 * * * * command
- What does the ‘ssh’ command do?
a. Securely connect to a remote server.
b. Show system hardware.
c. Show system software.
Ans. Securely connect to a remote server.
- How do you list all installed packages?
a. dpkg --list
b. apt list --installed
c. Both Option 1 and 2.
Ans. Both Option 1 and 2.
- What does the ‘wget’ command do?
a. Download files from the internet.
b. Upload files to the internet.
c. Watch files on the internet.
Ans. Download files from the internet.
- How do you redirect stdout to a file?
a. command > file
b. command >> file
c. Both Option 1 and 2.
Ans. Both Option 1 and 2.
- What does the redirect operator >> file do?
a. Redirect the output to a file and delete the existing content.
b. Redirect the output to a file and Append it to the existing content.
c. Redirect only the error to the file
Ans.
- How do you find the size of a directory?
a. du -sh directory
b. df -h directory
c. ls -lh directory
Ans. du -sh directory
- What does the ‘find’ command do?
a. Find files and directories.
b. Find text in files.
c. Find installed packages.
Ans. Find files and directories.
- How do you check the number of cores in Linux?
a. nproc
b. lscpu
c. Both Option 1 and 2.
Ans. Both Option 1 and 2.
- What does the ‘cat’ command do?
a. Concatenate and display file content.
b. Change file attributes.
c. Copy files.
Ans. Concatenate and display file content.
- How do you check the system uptime?
a. uptime
b. top
c. ps -ef
Ans. uptime
- What does the ‘touch’ command do?
a. Change file timestamps.
b. Create an empty file.
c. Both Option 1 and 2.
Ans. Both Option 1 and 2.
- How do you check the available disk space?
a. df -h
b. du -sh
c. ls -lh
Ans. df -h
- What does the ‘mv’ command do?
a. Move or rename files.
b. Copy files.
c. Delete files.
Ans. Move or rename files.
- How do you check the running processes?
a. ps -ef
b. top
c. vmstat
Ans. ps -ef
- What does the ‘rm’ command do?
a. Remove files or directories.
b. Rename files or directories.
c. Read files or directories.
Ans. Remove files or directories.
- How do you check the system load average?
a. uptime
b. top
c. Both Option 1 and 2.
Ans. Both Option 1 and 2.
- What does the ‘cp’ command do?
a. Copy files or directories.
b. Change file permissions.
c. Change file ownership.
Ans. Copy files or directories.
- How do you check the open files by a process?
a. lsof -p pid
b. ps -ef | grep pid
c. top -p pid
Ans. lsof -p pid
- What does the ‘pwd’ command do?
a. Print the current directory.
b. Print the disk usage.
c. Print the system load average.
Ans. Print the current directory.
- How do you change the file permissions?
a. chmod
b. chown
c. chgrp
Ans. chmod
- What does the ‘ln’ command do?
a. Create a symbolic link to a file.
b. List the number of lines in a file.
c. Load a new kernel.
Ans. Create a symbolic link to a file.
- How do you display the top of a file?
a. head
b. tail
c. cat
Ans. head
- What does the ‘man’ command do?
a. Manage files.
b. Display the manual page of a command.
c. Manipulate text in files.
Ans. Display the manual page of a command.
- How do you display the bottom of a file?
a. head
b. tail
c. cat
Ans. tail
- What does the ‘less’ command do?
a. Display less information about a file.
b. Display the contents of a file with navigation.
c. Display the less important files.
Ans. Display the contents of a file with navigation.
- How do you display the environment variables?
a. env
b. set
c. Both Option 1 and 2.
Ans. Both Option 1 and 2.
- What does the ‘sort’ command do?
a. Sort the contents of a file.
b. Sort the files in a directory.
c. Sort the processes by CPU usage.
Ans. Sort the contents of a file.
- How do you count the number of lines, words, and characters in a file?
a. wc
b. count
c. calc
Ans. wc
No comments:
Post a Comment