Command Line

Course – Version Control Quiz answers

Week 2: Command Line

META FRONT/BACK-END/ANDROID DEVELOPER PROFESSIONAL CERTIFICATE

Complete Coursera Answers & Study Guide

Click to Enroll in Coursera Meta Front-End Professional Certificate

Command Line INTRODUCTION

This module is part of the Meta Front-End Developer Professional Certificate offered on Coursera. You will learn to use Command Line, a text-based interface that allows you to control your computer and execute commands from the terminal easily. With Command Line, you’ll be able to traverse, create, rename and delete files on your hard drive quickly and efficiently.

This module will also introduce you to some of the powerful workflows created with Command Line that can help streamline and automate tasks. You’ll soon learn just how easy it is to utilize piping and redirection in Command-Line to make mundane processes faster while keeping them organized.

Learning Objectives

  • Describe how the command line is and how it is used.
  • Practice traversing your hard drive via the command line.
  • Create, rename and delete files and folders on your hard drive using Unix commands.
  • Use pipes and redirection.

SELF REVIEW: MAKE AND CHANGE DIRECTORIES AND FILES

1. How many files exist in the lab directory? 

  • 0
  • 1 (Correct)
  • 2
  • 3

Correct: Congratulations! file3.txt exists in the lab directory.

2. How many directories exist in the lab directory? 

  • 0
  • 2 (Correct)
  • 1
  • 3

Correct: Congratulations! The directories dir1 and dir2 exist in the lab directory.

3. How many directories exist in the dir2 directory? 

  • 0
  • 1 (Correct)
  • 2
  • 3

Correct: Congratulations! The dir3 directory exists inside of the dir2 directory.

4. How many files exist in the the dir2 directory? 

  • 0 (Correct)
  • 1
  • 2
  • 3

KNOWLEDGE CHECK: UNIX COMMANDS

1. The options you pass to a command are known as _____________.

  • Flags (Correct)
  • Chips
  • Keys

Correct: Congratulations! Flags are used to change the behaviour of a command.

2. What command do you use to change directory?

  • pwd
  • ls
  • cd (Correct)

Correct: cd is the Change Directory command.

3. What command do you use to move files and directories?

  • rm
  • mv (Correct)
  • cp

Correct: Congratulations! mv is the Move command.

4. To pass the output from one command as the input to another command, what do you use?

  • Pipes (Correct)
  • Grep

Correct: Pipes, specified using the | character, allow you to pass the output of one command as the input to another command.

5. What command do you use to create a directory?

  • pwd
  • cd
  • mkdir (Correct)

Correct: Congratulations! mkdir is the Make Directory command.

6. To create a file called myfile.html what command would you use?   

  • mkdir myfile.html
  • touch myfile.html (Correct)
  • cd myfile.html

Correct: You are correct! You will use the touch myfile.html file to create the file.

7. There is a folder called bi_project. What command would you use to change directory into that folder?    

  • pwd bi_project
  • cp bi_project
  • cd bi_project (Correct)
  • mv bi_project

Correct: You are correct! You use the cd command to change directories.     

Bash Commands in Mac Terminal

CommandUsed for
cdChange Directory
lsList command used for showing the content of a directory.
rmRemove command used for removing a file or a directory
mvUsed to move files or folders to another location
touchAllows creating of a new empty file or to upate a timestamp on a file
cpUsed to make a copy of a file or foldler
mkdirMake a new directory
pwdPrint work directory, shows the current location in the shell
catAllows reading or concatenation of a file
lessDisplays the contents of a file one page at a time.
grepGlobal regular expression, allows for searching contents of files or folders
Bash Commands in Mac Terminal

8. Which of the following commands will you use to ensure all the items are printed in a list structure on the screen? 

  • Is-I (Correct)
  • cd
  • PWD
  • Is

Correct: That’s correct. The ls –l command is used to list all the information about files and directories within the file system. 

9. You are working in the command line and you want to create a newdirectory. Which command do you use to do this? 

  • Mkdir (Correct)
  • Cd
  • Pwd   

Correct: That’s correct! To create a new directory you use the mkdir command. The cd command is used to change directory and the pwd command is used to see what directory you’re in. 

10. True or false. As a developer working with the command line, you can use pipes to combine commands together. Example: ls file1.txt |wc-w​ 

  • True (Correct)
  • False

Correct: That’s correct. When working with the command line, you can use pipes to combine commands together. 

11. There are 3 types of redirection. Select all that apply.

  • Standard error (Correct)
  • Standard input (Correct)
  • Standard output (Correct)
  • Standard throughput

Correct: The standard error redirect allows you to specify that the error should be written to a file.    

Correct: You are correct! The standard input redirection gives you the option to record your input and save it to a file either by overwriting or appending the file.     

Correct: That is correct! The redirection standard output allow you to control where the output goes.     

12. You have a text file that contains addresses. You would like to search for addresses with the word “Ocean”, so you perform a grep search with no additional flags. In this case, which one of the following statements would be true? 

  • None of these statements apply 
  • The search returns results that begin with Ocean (Correct)
  • The search returns partial matches
  • The search returns results that begin with Ocean or ocean 

Correct: That’s correct! Because this search is case sensitive, it would only return words that begin with “Ocean”. 

Coursera Meta Front-End Developer Professional Certificate Answers and Study Guide

Liking our content? Then don’t forget to ad us to your bookmarks so you can find us easily!

Weekly Breakdown | Meta Study Guides | Back to Top

MODULE QUIZ: COMMAND LINE

1. What command do you use to print the current working directory?

  • Pwd (Correct)
  • cd
  • cat

Correct! pwd is the Print Working Directory command.

2. What command do you use to search text content?

  • Mkdir
  • Grep (Correct)
  • ls

Correct! grep is used to search text content.

3. Which of the following are standard input/output (I/O) streams? Select all that apply.

  • Stderr (Correct)
  • Stdin (Correct)
  • Stdout (Correct)

Correct: stderr is the standard error stream.

Correct! stdin is the standard input stream.

Correct! stdout is the standard output stream.

4. Pipes are used to pass the output of one command as input to another command.

  • True (Correct)
  • False

Correct! Using the | character allows you to pipe output from one command to the input of another command.

5. What command do you use to list files and directories?

  • Mkdir
  • Cd
  • Ls (Correct)

Correct! ls is the List files and directories command.

6. The mv command is used to create directories.

  • True
  • False (Correct)

Correct! mv is the Move command.

7. Flags can be used to change the behaviour of a command.

  • True (Correct)
  • False

Correct: Flags allow you to specify different options available for a command.

8. Which of the following are benefits of using the command line? Select all that apply.

  • Automating tasks (Correct)
  • Interacting with cloud provider platforms in a consistent way (Correct)
  • Automatically correct mistakes in commands
  • Improved performance versus Graphical User Interface (Correct)

Correct! Many tasks can be automated through the command line.

Correct! Most cloud providers provide command line access.

Correct! The Command Line Interface (CLI) uses less CPU and memory than a Graphical User Interface (GUI)

Command Line CONCLUSION

The command line is a powerful tool that every Linux user should know how to use. With just a few keystrokes you can traverse, create, rename, and delete files on your hard drive. Y

ou can also use piping and redirection to create powerful workflows that will automate your work, saving you time and effort. If you’re not already familiar with the command line, I highly recommend taking this course. It’s free and only takes a few hours to complete. Who knows? After completing this course you may find yourself using the command line more often than you ever thought possible.

Join Coursera today and take our course on Introduction to Data Analysis with Python to learn more about how data analysis can help automate your workflow even further!

Subscribe to our site

Get new content delivered directly to your inbox.

Liking our content? Then, don’t forget to ad us to your BOOKMARKS so you can find us easily!