1. Using a Linux machine, you have the following directory tree: [directory tree plugin]. If your current path is /home/cindy/Pictures/Canada, and you want to change to the Alaska directory, which of the following commands can you use? Check all that apply.
Answers
·
ls ../Pictures/Alaska
·
cd /Pictures/Alaska
·
cd ../Alaska
· cd /home/cindy/Pictures/Alaska
2. In Bash, which of the
following commands can be used to view a list of all files in the /home
directory? Check all that apply.
Answers
·
ls -la /home
·
ls -l -a /home
·
list -a /home
·
ls -la ~
Explanation: In the /home directory, the output of these commands will, in order, list the files, list all files (including hidden ones), and list files in a manner that provides more information.
3. In Bash, which of the
following commands can be used to remove a directory named "Miscellaneous
Directory” ?
Answers
·
rm -r Miscellaneous\
Directory
·
rm Miscellaneous\ Directory
·
rm -r Miscellaneous Directory
·
rm Miscellaneous Directory
Explanation: This command deletes directories using the rm (remove) command with the -r option, which stands for recursive and is required to do it. Caution is advised while using it since it will remove both the directory and all of the items inside it.
4. Which of the
following are command line interfaces (CLI) on Windows OS? Select all that
apply.
Answers
·
Command Prompt
·
Parameter
·
PowerShell
·
Bash
5. Which command is used
in both Linux and Windows CLI to create a new directory?
Answers
·
cd
·
mkdir
·
rm
·
ls
Explanation: This command, which creates a new directory or folder in any operating system and is abbreviated as "make directory," stands for "make directory."
6. In Bash, which of the
following commands can be used to view the contents of a document? Check all
that apply.
Answers
·
less
·
gat
·
dog
·
cat
Explanation: You should use the real name of your document rather than "your_document.txt" in this step. The cat command combines the contents of many files into a single output and shows it on the terminal.
7. A Linux machine has
the following files:
apple.txt
banana.jpg
chocolate.txt
orange.txt
What command can be used to search for the word "fruit" in the text
files? Check all that apply.
Answers
·
find fruit apple.txt chocolate.txt
orange.txt
·
grep fruit apple.txt
chocolate.txt orange.txt
·
grep fruit *.txt
· find fruit apple.txt chocolate.txt
8. In Bash, which of the
following commands can be used to view a list of all files in the /home
directory? Check all that apply.
Answers
·
ls -la /home
·
ls -l -a /home
·
list -a /home
·
ls -la ~
9. A Linux machine has a
file named "types_of_fish.txt". Which of the following commands can
be used to append the word "trout" to the file contents?
Answers
·
echo trout > types_of_fish.txt
·
echo trout < types_of_fish.txt
·
echo trout >>
types_of_fish.txt
·
echo trout 2> types_of_fish.txt
Explanation: This script uses the echo command to print the word "trout," and then it uses the >> operator to add the word to the end of the file called "types_of_fish.txt."
10. Using a linux
machine, which of the following commands can be used to list through a
directory called /home/ben/Documents and search for the word
"important" in the filenames in that directory?
Answers
·
ls /home/ben/Documents< grep
important
·
ls /home/ben/Documents >> grep
important
·
ls /home/ben/Documents > grep
important
·
ls /home/ben/Documents |
grep important
Explanation: This program will list the files that are located in the /home/ben/Documents directory, and the grep command will filter the output such that it only displays filenames that include the word "important."
11. Which command can be
used on Windows CLI to see the first 10 lines of a file called
“more_information.txt”?
Answers
·
ls more_information.txt -head 10
·
less more_information.txt -head 10
·
head more_information.txt
·
cat more_information.txt
-head 10