Spread the love

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.

  • 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.

  • ls -la /home
  • ls -l -a /home
  • list -a /home
  • ls -la ~

3. In Bash, which of the following commands can be used to remove a directory named “Miscellaneous Directory” ?

  • rm -r Miscellaneous\ Directory
  • rm Miscellaneous\ Directory
  • rm -r Miscellaneous Directory
  • rm Miscellaneous Directory

4. Which of the following are command line interfaces (CLI) on Windows OS? Select all that apply.

  • Command Prompt
  • Parameter
  • PowerShell
  • Bash

5. Which command is used in both Linux and Windows CLI to create a new directory?

  • cd
  • mkdir
  • rm
  • ls

6. In Bash, which of the following commands can be used to view the contents of a document? Check all that apply.

  • less
  • gat
  • dog
  • cat

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.

  • 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.

  • 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?

  • 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

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?

  • ls /home/ben/Documents< grep important
  • ls /home/ben/Documents >> grep important
  • ls /home/ben/Documents > grep important
  • ls /home/ben/Documents | grep important

11. Which command can be used on Windows CLI to see the first 10 lines of a file called “more_information.txt”?

  • ls more_information.txt -head 10
  • less more_information.txt -head 10
  • head more_information.txt
  • cat more_information.txt -head 10

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *