Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Mastering Basic Linux Commands

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Which command is used to list all files and directories in the current directory, including hidden ones?

a)

ls -l

b)

ls -a

c)

ls -h

d)

ls -d

2.

What is the command to create a new directory called "assignments"?

a)

mkdir assignments

b)

newdir assignments

c)

createdir assignments

d)

makedir assignments

3.

Which command will display the contents of a file named "notes.txt" one page at a time?

a)

cat notes.txt

b)

less notes.txt

c)

open notes.txt

d)

show notes.txt

4.

How do you search for the word "science" in a file called "report.txt" using grep?

a)

grep science report.txt

b)

grep report.txt science

c)

find science report.txt

d)

search science report.txt

5.

Which command is used to display your current working directory?

a)

pwd

b)

cwd

c)

dir

d)

whereami

6.

What does the command "ls -lh" do?

a)

Lists files in long format with human-readable file sizes

b)

Lists only hidden files

c)

Lists files in reverse order

d)

Lists files with their permissions only

7.

Which command will move a file named "essay.doc" to a directory called "Documents"?

a)

mv essay.doc Documents/

b)

cp essay.doc Documents/

c)

move essay.doc Documents/

d)

transfer essay.doc Documents/

8.

What is the purpose of the "awk" command in Linux?

a)

To search for patterns in files

b)

To process and analyse text files, especially columns and fields

c)

To list files and directories

d)

To create new directories

9.

Which command will show the IP address of your computer?

a)

ifconfig

b)

ipconfig

c)

netstat

d)

ping

10.

How do you copy a file named "data.csv" to a USB drive mounted at "/media/usb"?

a)

cp data.csv /media/usb/

b)

mv data.csv /media/usb/

c)

copy data.csv /media/usb/

d)

send data.csv /media/usb/

11.

Which command will recursively list all files and directories under the current directory?

a)

ls -R

b)

ls -a

c)

ls -l

d)

ls -d

12.

What does the following command do? `grep -i "maths" results.txt`

a)

Searches for "maths" in results.txt, case-sensitive

b)

Searches for "maths" in results.txt, ignoring case

c)

Searches for "maths" in all files

d)

Deletes lines containing "maths" from results.txt

13.

Which command will display the first 10 lines of a file called "summary.txt"?

a)

head summary.txt

b)

tail summary.txt

c)

top summary.txt

d)

start summary.txt

14.

How do you use awk to print the second column from a file called "marks.txt"?

a)

awk '{print $2}' marks.txt

b)

awk '{print $1}' marks.txt

c)

awk '{print $3}' marks.txt

d)

awk '{print $0}' marks.txt

15.

Which command will test the network connection to www.google.com?

a)

ping www.google.com

b)

netstat www.google.com

c)

connect www.google.com

d)

testnet www.google.com