-->

Featured

DSA Interview Question

Question: Various S orting algorithms Answer: There are various sorting algorithms, each with its own advantages and disadvantages in terms ...

Unix command MCQ

Question : What command is used to display the current directory?

ls

cd

pwd

dir

Correct Answer : pwd


Question : Which command is used to create a new directory?

mkdir

touch

newdir

mkd

Correct Answer : mkdir


Question : How do you list files in a long format, including hidden files?

ls -l

ls -a

ls -h

ls -lh

Correct Answer : ls -lh


Question : To navigate to your home directory, which command would you use?

home

cd ~

cd /home

go home

Correct Answer : cd ~


Question : What command is used to remove a file?

delete

rm

erase

del

Correct Answer : rm


Question : Which command is used to display the last 10 lines of a file?

cat

tail

head

more

Correct Answer : tail


Question : What does the 'chmod +x' command do?

Adds execute permission

Adds read permission

Adds write permission

Removes execute permission

Correct Answer : Adds execute permission


Question : To search for a specific text in a file, which command is used?

find

grep

search

locate

Correct Answer : grep


Question : Which command is used to copy files or directories in Unix?

cp

mv

copy

duplicate

Correct Answer : cp


Question : To see the contents of a file in real-time as it grows, which command is used?

tail -f

cat -r

more -f

watch

Correct Answer : tail -f


Question : What does the 'ps' command do?

Displays current processes

Pauses a process

Resumes a process

Stops a process

Correct Answer : Displays current processes


Question : Which command is used to find the total disk space used by a directory and its subdirectories?

du

df

diskusage

space

Correct Answer : du


Question : What does the command 'echo $SHELL' display?

Prints the system date

Displays the current shell

Echoes the contents of a file

Prints the environment variables

Correct Answer : Displays the current shell


Question : To terminate a process forcefully, which command is used?

kill

terminate

end

stop

Correct Answer : kill


Question : Which command is used to display the manual pages for a command?

info

man

help

manual

Correct Answer : man


Question : What does the 'df' command display?

Disk format

Directory files

Disk free space

Data files

Correct Answer : Disk free space


Question : To move up one directory level, which command is used?

cd ..

cd /

cd up

cd parent

Correct Answer : cd ..


Question : What is the purpose of the 'tar' command in Unix?

Compress files

Copy files

Archive files

Delete files

Correct Answer : Archive files


Question : Which command is used to display the calendar for a specific month?

cal

calendar

datecal

month

Correct Answer : cal


Question : To see the currently logged-in users, which command is used?

users

who

logged

online

Correct Answer : who


Question : What does the command 'mv file1 file2' do?

Copies file1 to file2

Renames file1 to file2

Moves file1 to directory file2

Appends file1 to file2

Correct Answer : Renames file1 to file2


Question : To display the current date and time, which command is used?

time

date

clock

datetime

Correct Answer : date


Question : What is the purpose of the 'history' command in Unix?

Displays system events

Shows recent commands entered

Lists user login history

Views file modification history

Correct Answer : Shows recent commands entered


Question : Which command is used to remove a directory and its contents recursively?

rmdir

delete

rmdir -r

rm -r

Correct Answer : rm -r


Question : To find a file by its name, what command is used?

locate

search

find

grep

Correct Answer : find


Question : What does the 'chmod 755 file' command do?

Adds execute permission to the owner

Adds read and write permissions to the owner

Sets read, write, and execute permissions for everyone

Removes all permissions

Correct Answer : Sets read, write, and execute permissions for everyone


Question : Which command is used to display the top processes consuming system resources?

top

ps -top

taskmgr

sysstat

Correct Answer : top


Question : To count the number of lines in a file, which command is used?

linecount

wc -l

countlines

lines

Correct Answer : wc -l


Question : What does the 'echo $PATH' command display?

Current working directory

List of environment variables

Print system path

Print user's home directory

Correct Answer : Print system path


Question : Which command is used to compress a file or directory in Unix?

compress

zip

gzip

tar -c

Correct Answer : gzip


Question : To open a text file for editing in the default text editor, which command is used?

open

edit

nano

vi

Correct Answer : open


Question : What does the 'uname' command display?

User information

System name

Current shell

File permissions

Correct Answer : System name


Question : To display the size of a file or directory, which command is used?

size

ls -s

du -h

filesize

Correct Answer : du -h


Question : Which command is used to change the ownership of a file or directory?

own

chown

chmod

usermod

Correct Answer : chown


Question : To create an empty file in Unix, which command is used?

touch

newfile

create

mkfile

Correct Answer : touch


Question : What does the 'cut' command do in Unix?

Deletes files

Cuts text from files

Cuts columns from a file

Copies files to a new location

Correct Answer : Cuts columns from a file


Question : Which command is used to view the contents of a compressed file without extracting it?

view

cat

zcat

read

Correct Answer : zcat


Question : To execute a command in the background, what symbol is used at the end of the command?

&

!

^

#

Correct Answer : &


Question : What does the 'df -h' command display?

Disk format in human-readable format

Directory files

Disk free space in human-readable format

Data files in human-readable format

Correct Answer : Disk free space in human-readable format


Question : Which command is used to create a symbolic link in Unix?

link

ln -s

symlink

mklink

Correct Answer : ln -s


Question : To view the contents of a file from the end, which command is used?

cat

more

tail

head

Correct Answer : tail


Question : Which command is used to display the manual pages in a specific section?

man

info

help

whatis

Correct Answer : man


Question : What does the 'grep' command do?

Display disk usage

Search for a pattern in a file

Rename a file

Move a file

Correct Answer : Search for a pattern in a file


Question : To view the system's uptime, which command is used?

uptime

time

sysuptime

systemtime

Correct Answer : uptime


Question : Which command is used to set the password for a user in Unix?

passwd

setpass

password

userpass

Correct Answer : passwd


Question : What does the 'whoami' command display?

Current shell

System name

Current user

User ID

Correct Answer : Current user


Question : To sort the lines of a text file in ascending order, which command is used?

sort

order

arrange

organize

Correct Answer : sort


Question : What is the purpose of the 'env' command in Unix?

Display environment variables

Encrypt files

Evaluate expressions

Edit network settings

Correct Answer : Display environment variables


Question : To check the disk space usage of a file system, which command is used?

space

diskusage

df

checkdisk

Correct Answer : df


Question : Which command is used to suspend a running process in the foreground?

stop

suspend

ctrl+z

pause

Correct Answer : ctrl+z


Question : What does the 'find' command do in Unix?

Search for files and directories

Display file contents

Rename files

Delete files

Correct Answer : Search for files and directories


Question : Which command is used to display the permissions of a file in symbolic notation?

ls -p

chmod -s

ls -l

chmod -l

Correct Answer : ls -l


Question : To create an archive of a directory, which command is used?

archive

compress

tar

zip

Correct Answer : tar


Question : What does the command 'echo $HOME' display?

Current working directory

Home directory of the user

System home directory

User's login name

Correct Answer : Home directory of the user


Question : Which command is used to display the process ID (PIof a running process?

pidof

ps -p

getpid

procid

Correct Answer : pidof


Question : To append the contents of one file to another, which command is used?

cp

cat

append

merge

Correct Answer : cat


Question : What is the purpose of the 'tee' command in Unix?

Display file contents

Redirect output to a file

Create links between files

Display system time

Correct Answer : Redirect output to a file


Question : Which command is used to display the disk space usage of a file or directory in a human-readable format?

du

df -h

diskusage

space -h

Correct Answer : du


Question : To display the first 10 lines of a file, which command is used?

cat

head

tail

more

Correct Answer : head


Question : What does the 'alias' command do in Unix?

Create a new user

Assign a nickname to a command

Delete a file

Rename a directory

Correct Answer : Assign a nickname to a command

No comments:

Post a Comment

popular posts