Linux Command Line Basics Quiz

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the primary function of the type command?

  • Create a new file
  • Delete a file
  • Display information about a file
  • Identify whether a file is a program (correct)

When using a long option, how many hyphens are required before the option name?

  • Three hyphens
  • One hyphen
  • Two hyphens (correct)
  • No hyphens

Which action does the uname command perform?

  • Manage users on the system
  • Navigate the file system
  • Modify file permissions
  • Display system information (correct)

What does the -a option with the ls command do?

<p>Display hidden files (B)</p> Signup and view all the answers

How do you remove an alias in Unix?

<p>unalias name (D)</p> Signup and view all the answers

True or False: The type command in Unix can only identify whether a file is a program.

<p>True (C)</p> Signup and view all the answers

What is the primary purpose of using arguments in a shell?

<p>To specify options for a command (B)</p> Signup and view all the answers

How many times can you use the * glob character in a pattern?

<p>Without limits (D)</p> Signup and view all the answers

What does the -r option do with the ls command?

<p>Lists files in reverse alphabetical order (A)</p> Signup and view all the answers

What does the asterisk (*) wildcard match?

<p>Any string, including the empty string (C)</p> Signup and view all the answers

What is the main function of the cal command?

<p>Display a calendar for a specific month and year (B)</p> Signup and view all the answers

What is globbing?

<p>A way to match multiple files using wildcards (B)</p> Signup and view all the answers

Is it true that the touch command can only be used to create new files?

<p>False (C)</p> Signup and view all the answers

If you want to locate all files named 'config.sys' on the system, which command would you use?

<p>find / -name config.sys (C)</p> Signup and view all the answers

What purpose does using arguments serve when starting a new program?

<p>To change the behavior of the shell (B)</p> Signup and view all the answers

How can you create a new directory named 'new_project'?

<p>mkdir new_project (D)</p> Signup and view all the answers

What type of information does the -r option provide when used with the ls command?

<p>'r' stands for 'recursive' (D)</p> Signup and view all the answers

What does the * glob character match?

<p>Any string of characters, including none (B)</p> Signup and view all the answers

What does the 'whatis' command provide?

<p>A brief description of a command (B)</p> Signup and view all the answers

How do you unset a variable in a Linux environment?

<p>unset $variable (D)</p> Signup and view all the answers

What is the correct way to create a new environment variable?

<p>export name=value (A)</p> Signup and view all the answers

How can you display the value of a variable in a Linux environment?

<p>echo $variable (C)</p> Signup and view all the answers

Which of the following statements accurately describes the difference between local and environment variables?

<p>Local variables are deleted when the program exits, while environment variables persist across programs. (A)</p> Signup and view all the answers

What is the main difference between local and global initialization files?

<p>Local files are specific to a user, global files affect all users. (A)</p> Signup and view all the answers

What file is typically executed first when Bash starts as a login shell?

<p>/etc/profile (A)</p> Signup and view all the answers

How can you view the contents of hidden files in your home directory?

<p>Use the ls command with the -a option. (C)</p> Signup and view all the answers

What is the role of global initialization files?

<p>To affect all users' shell environments. (A)</p> Signup and view all the answers

Which type of user is primarily associated with local initialization files?

<p>Regular users (B)</p> Signup and view all the answers

In the context of shell startup, what does ~/.bashrc typically contain?

<p>User-specific Bash settings (C)</p> Signup and view all the answers

Flashcards are hidden until you start studying

Study Notes

Using Arguments in Shell Commands

  • Arguments are used to change the behavior of the shell, specify options for a command, provide additional information to a command, or start a new program.

The ls Command

  • The -r option with the ls command lists files in reverse alphabetical order.
  • The -a option with the ls command displays hidden files.

The cal Command

  • The cal command displays a calendar for a specific month and year.

The touch Command

  • The touch command is not only used to create new files, but also to update the timestamp of existing files.

The uname Command

  • The primary function of the uname command is to display system information.

Removing Aliases

  • To remove an alias, use the unalias command followed by the name of the alias.

The type Command

  • The type command identifies whether a file is a program or a shell builtin.

Long Options

  • A long option requires two hyphens (--) before the option name.

Setting and Unsetting Variables

  • To set a new environment variable, use the name=value syntax followed by the export command.
  • To unset a variable, use the unset command followed by the name of the variable.
  • To display the value of a variable, use the echo command followed by the variable name.

Local and Environment Variables

  • Local variables are deleted when the program exits, while environment variables persist across programs.
  • Environment variables are case-sensitive.

Bash Startup Files

  • The ~/.bash_profile file is typically executed first when Bash starts as a login shell.

Viewing Hidden Files

  • To view the contents of hidden files in your home directory, use the ls command with the -a option.

Globbing

  • Globbing is a way to match multiple files using wildcards.
  • The asterisk (*) wildcard matches any string, including the empty string.

Locating Files

  • To locate all files named 'config.sys' on the system, use the find command with the -name option.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Use Quizgecko on...
Browser
Browser