Linux Command Line Basics Quiz

FortunateHarpGuitar avatar
FortunateHarpGuitar
·
·
Download

Start Quiz

Study Flashcards

29 Questions

What is the primary function of the type command?

Identify whether a file is a program

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

Two hyphens

Which action does the uname command perform?

Display system information

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

Display hidden files

How do you remove an alias in Unix?

unalias name

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

True

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

To specify options for a command

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

Without limits

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

Lists files in reverse alphabetical order

What does the asterisk (*) wildcard match?

Any string, including the empty string

What is the main function of the cal command?

Display a calendar for a specific month and year

What is globbing?

A way to match multiple files using wildcards

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

False

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

find / -name config.sys

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

To change the behavior of the shell

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

mkdir new_project

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

'r' stands for 'recursive'

What does the * glob character match?

Any string of characters, including none

What does the 'whatis' command provide?

A brief description of a command

How do you unset a variable in a Linux environment?

unset $variable

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

export name=value

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

echo $variable

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

Local variables are deleted when the program exits, while environment variables persist across programs.

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

Local files are specific to a user, global files affect all users.

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

/etc/profile

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

Use the ls command with the -a option.

What is the role of global initialization files?

To affect all users' shell environments.

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

Regular users

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

User-specific Bash settings

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.

Test your knowledge of Linux command line basics with this quiz. Questions cover topics such as command information with 'whatis', unsetting variables, and creating new environment variables.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Linux Command Line Basics Quiz
7 questions
Linux Command Line Syntax Quiz
15 questions

Linux Command Line Syntax Quiz

AstonishingPermutation avatar
AstonishingPermutation
Linux Command Line Basics
12 questions
Use Quizgecko on...
Browser
Browser