Podcast
Questions and Answers
What is the default user shell in Red Hat Enterprise Linux (RHEL)?
What is the default user shell in Red Hat Enterprise Linux (RHEL)?
Which character signifies that the bash shell is running as a superuser?
Which character signifies that the bash shell is running as a superuser?
What are the three basic parts of a command entered in the shell?
What are the three basic parts of a command entered in the shell?
What is a primary benefit of using the bash shell for command execution?
What is a primary benefit of using the bash shell for command execution?
Signup and view all the answers
Which of the following best describes the purpose of options in a command?
Which of the following best describes the purpose of options in a command?
Signup and view all the answers
In the command 'usermod -L user01', what does 'usermod' represent?
In the command 'usermod -L user01', what does 'usermod' represent?
Signup and view all the answers
Which shell was the default for macOS prior to version 10.15 Catalina?
Which shell was the default for macOS prior to version 10.15 Catalina?
Signup and view all the answers
What type of interface does the command line provide for user interaction with a computer system?
What type of interface does the command line provide for user interaction with a computer system?
Signup and view all the answers
What is the primary method of authentication being described?
What is the primary method of authentication being described?
Signup and view all the answers
Which command ensures that only the owner can read the private key file?
Which command ensures that only the owner can read the private key file?
Signup and view all the answers
What happens if the public key is not installed in the remote user's account?
What happens if the public key is not installed in the remote user's account?
Signup and view all the answers
What message does ssh display when connecting to a new machine for the first time?
What message does ssh display when connecting to a new machine for the first time?
Signup and view all the answers
What is the purpose of a terminal in a computer system?
What is the purpose of a terminal in a computer system?
Signup and view all the answers
What is the purpose of the host key sent by the remote host during an SSH connection?
What is the purpose of the host key sent by the remote host during an SSH connection?
Signup and view all the answers
Which virtual console is designated as tty1 in Red Hat Enterprise Linux 9?
Which virtual console is designated as tty1 in Red Hat Enterprise Linux 9?
Signup and view all the answers
What is required for the SSH connection to succeed with a private key?
What is required for the SSH connection to succeed with a private key?
Signup and view all the answers
What does the Ctrl+Alt function key combination do in relation to virtual consoles?
What does the Ctrl+Alt function key combination do in relation to virtual consoles?
Signup and view all the answers
Which option indicates how to specify the private key file when using SSH?
Which option indicates how to specify the private key file when using SSH?
Signup and view all the answers
Why might system administrators avoid using a graphical environment on servers?
Why might system administrators avoid using a graphical environment on servers?
Signup and view all the answers
What will happen if the private key is accessible to others?
What will happen if the private key is accessible to others?
Signup and view all the answers
How does a graphical session affect the virtual console used for login prompts?
How does a graphical session affect the virtual console used for login prompts?
Signup and view all the answers
What happens when you log in to a graphical environment from a virtual console?
What happens when you log in to a graphical environment from a virtual console?
Signup and view all the answers
What occurs if a user switches to another account in the graphical environment without logging out?
What occurs if a user switches to another account in the graphical environment without logging out?
Signup and view all the answers
What is a major characteristic of multiple virtual consoles?
What is a major characteristic of multiple virtual consoles?
Signup and view all the answers
What might a changed host key indicate in an SSH connection?
What might a changed host key indicate in an SSH connection?
Signup and view all the answers
When a local machine does not have a saved host key for the remote host, what choice does the user have?
When a local machine does not have a saved host key for the remote host, what choice does the user have?
Signup and view all the answers
What happens if the saved host key does not match the one sent from the remote host?
What happens if the saved host key does not match the one sent from the remote host?
Signup and view all the answers
What is one way to log out from a remote SSH session?
What is one way to log out from a remote SSH session?
Signup and view all the answers
What is a characteristic of commands typed into the Bash shell?
What is a characteristic of commands typed into the Bash shell?
Signup and view all the answers
Which of the following is a correct syntax for typing multiple commands in Bash?
Which of the following is a correct syntax for typing multiple commands in Bash?
Signup and view all the answers
What is the purpose of the options in a command typed into the Bash shell?
What is the purpose of the options in a command typed into the Bash shell?
Signup and view all the answers
What denotes a command in the shell syntax?
What denotes a command in the shell syntax?
Signup and view all the answers
What does the 'less' command allow you to do when viewing long files?
What does the 'less' command allow you to do when viewing long files?
Signup and view all the answers
What is the default number of lines displayed by the head and tail commands?
What is the default number of lines displayed by the head and tail commands?
Signup and view all the answers
How can you count only the number of lines in a file using the wc command?
How can you count only the number of lines in a file using the wc command?
Signup and view all the answers
What will happen if you press the Tab key twice when using tab completion?
What will happen if you press the Tab key twice when using tab completion?
Signup and view all the answers
What does the '-c' option do when used with the wc command?
What does the '-c' option do when used with the wc command?
Signup and view all the answers
Which command would you use to view the last 3 lines of a file?
Which command would you use to view the last 3 lines of a file?
Signup and view all the answers
What is the purpose of the UpArrow and DownArrow keys while using the less command?
What is the purpose of the UpArrow and DownArrow keys while using the less command?
Signup and view all the answers
What command would you use to find out the number of words in the '/etc/group' file?
What command would you use to find out the number of words in the '/etc/group' file?
Signup and view all the answers
What is the purpose of using the backslash character (") in a command?
What is the purpose of using the backslash character (") in a command?
Signup and view all the answers
What does pressing the Tab key do while entering commands like useradd?
What does pressing the Tab key do while entering commands like useradd?
Signup and view all the answers
Which of the following is NOT an option with the useradd command?
Which of the following is NOT an option with the useradd command?
Signup and view all the answers
What character does the shell display as a secondary prompt for continuing commands?
What character does the shell display as a secondary prompt for continuing commands?
Signup and view all the answers
What happens if a user mistakenly includes the greater-than character (>) in a command?
What happens if a user mistakenly includes the greater-than character (>) in a command?
Signup and view all the answers
When using tab completion, what must you do if the name is not unique?
When using tab completion, what must you do if the name is not unique?
Signup and view all the answers
What is a common mistake made by beginners regarding the continuation prompt?
What is a common mistake made by beginners regarding the continuation prompt?
Signup and view all the answers
What command is used to add users to the system?
What command is used to add users to the system?
Signup and view all the answers
Study Notes
Accessing the Command Line
- A command line is a text-based interface used to input instructions to a computer system.
- Linux uses a program called a shell to provide the command line.
- Many shell program variants exist, but Red Hat recommends using the default shell for system administration.
- The default shell in Red Hat Enterprise Linux (RHEL) is the GNU Bourne-Again Shell (bash).
- Bash is an improved version of the original Bourne Shell (sh).
- The shell displays a prompt when waiting for user input.
- A regular user prompt ends with a dollar ($) symbol.
- A superuser prompt (root) uses a hash (#) symbol.
- Hash (#) distinguishes superuser mode and helps prevent mistakes affecting the entire system.
- Bash provides scripting language for automating tasks.
- Bash offers capabilities to simplify operations difficult with graphical tools.
- Bash is conceptually similar to cmd.exe (Windows), but with a more sophisticated scripting language similar to PowerShell.
Shell Basics
- Commands entered at the shell prompt have three parts:
- Command to execute
- Options adjusting command behavior (often begin with - or --).
- Arguments targeting actions of the command.
- For example:
usermod -L user01 string
-
usermod
is the command. -
-L
is an option. -
user01
is an argument.
-
Logging in to a Local System
- A terminal is a text-based interface for entering commands and receiving output.
- To use the shell, log in to the computer's terminal.
- A physical console connects directly to the computer via keyboard and display.
- Virtual consoles (VNC) are simulated virtual environments allowing different login sessions.
- The graphical login prompt (if available) can allow entry into a graphical environment using virtual consoles.
Logging in to a Remote System
- Secure Shell (SSH) is the standard method to access remote systems in Linux.
- OpenSSH is the command-line program often used for SSH connections.
- SSH encrypts communication to protect passwords from eavesdropping and hijacking.
- Some remote systems do not allow password login and rely on public key authentication.
- Public key authentication uses a private key file (like mylab.pem) equivalent to a password.
- The host key is checked against a list to ensure the connection is legitimate and a match has been approved.
Writing Simple Commands
- The
date
command displays the current date and time. - Users can modify the format of time and dates by using the
+%R
argument for 24-hour-format. - The
passwd
command changes a user's password and typically enforces strong password requirements.
Viewing Contents of Files
- The
cat
command displays the contents of files. - The
head
command displays the first few lines of a file. - The
tail
command displays the last few lines of a file. - These commands can display contents of multiple files.
Command History
- The
history
command displays a list of previously executed commands, prefixed. - The
!
character is used to reference previous commands for faster re-execution of common or repeated actions.
Edit commands
- Bash uses command-line editing shortcuts, accessible through arrow keys and control-key combinations to adjust the current command.
- Ctrl+A jumps to the beginning of the command line
- Ctrl+E jumps to the end of the command line
- Ctrl+U clears from cursor to beginning of line
- Ctrl+K clears from cursor to end of line
- Ctrl+LeftArrow moves cursor to previous word
- Ctrl+RightArrow moves cursor to next word
- Ctrl+R searches history list of commands for a pattern
- Esc+ or Alt+. inserts the last word of the previous command
Write a Long Command on Multiple Lines
- Long commands can be written on multiple lines, using a backslash () as an escape character.
- This avoids wrapping and makes long commands easier to read.
Tab Completion
- Tab completion is a useful shortcut when running commands; it helps interactive users quickly complete command names or file names.
- Partial typing with a tab press displays all commands beginning with the typed characters.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz covers the basics of accessing the command line in Linux, specifically focusing on the GNU Bourne-Again Shell (bash) used in Red Hat Enterprise Linux. You'll learn about prompt symbols, user modes, and the advantages of using bash for system administration and automation tasks.