- Bootcamp learn linux
- Table of Contents
- Course Outline
- Setting Up the Environment
- The Linux Terminal in Depth
- Getting Help, Man Pages (man, type, help, apropos)
- Linux Command Structure
- Terminal - Keyboard Shortcuts
- Mastering the Terminal - the Bash History
- Mastering the Terminal - The TAB Key
- 1. Auto-Completion:
- 2. Auto-Completion for Commands:
- 3. Auto-Completion for File and Directory Paths:
- 4. Auto-Completion for Filenames with Spaces:
- 5. Listing Available Options:
- 6. Auto-Completion for Command Options:
- 7. Auto-Completion for Variable Names:
- 8. Auto-Completion for Environment Variables:
- 9. Command Substitution:
- 10. File and Directory Listing:
- Tips:
- Recording the Date and Time for Each line in History
- root vs. non-Privileged Users
- Running Commands Without Leaving a Trace
- Terminals, Consoles, Shells and Commands
- The Linux File System
- User Accounts Management
- Linux File Permissions
- Linux Process Management
- Networking in Linux
- Software Management
- System Administration
- Bash Shell Scripting
- Running Containerized Applications with Docker
- Securing and Hardening a Linux System
- Setting Up a Web and DNS Server
- Automating Linux Administrative Tasks With Ansible
- IPFS - The InterPlanetary File System
- SSH Public Key Authentication
- Linux distributions, often referred to as "distros," are variations of the Linux operating system that include the Linux kernel, system libraries, system utilities, and application software.
- Each distribution is a complete package that can be installed on a computer, server, or embedded device.
- There are hundreds of Linux distributions, each catering to specific needs and preferences.
man, type, help, and apropos are all commands used in Unix-like operating systems to help users understand and use other commands.
- commands are the instructions given to the operating system to perform specific tasks.
- The typical structure of a Linux command is as follows:
command [options] [arguments]
- The Bash history is a useful feature in the Bash shell that keeps a record of the commands you've entered during your session.
- It allows you to review, reuse, and manage your command history efficiently.
-
Command History Size:
- The number of commands stored in the history can be set using the
HISTSIZE
environment variable. For example:export HISTSIZE=1000
- The number of commands stored in the history can be set using the
-
History File:
- The history is usually saved to a file called
.bash_history
in the user's home directory.
- The history is usually saved to a file called
-
history
Command: -
!!
(Double Bang): -
!n
(History Expansion): -
!-n
(Relative History): -
!string
(Search and Execute): -
Ctrl + R
(Reverse Search): -
history -c
(Clear History): -
history -d n
(Delete Entry):
-
HISTCONTROL
Variable: -
HISTFILE
Variable: -
HISTTIMEFORMAT
Variable:
-
Persistent History Across Sessions:
-
Ignore Commands from History:
-
Execute a Command Without Saving to History:
The TAB
key is a powerful tool in the Linux terminal, providing various functionalities to ease command-line usage. Here's an in-depth look at the uses of the TAB
key in the terminal:
- One of the primary functions of the
TAB
key is auto-completion. When you start typing a command, file, or directory name and pressTAB
, the terminal will attempt to complete the entry based on the available options.ls Do<TAB> # Result: ls Documents/
- Pressing
TAB
after typing a partial command will attempt to complete it, helping you avoid typing the full command.su<TAB> # Result: sudo
- Auto-completion works for file and directory paths, making it easier to navigate the filesystem.
cd /ho<TAB> # Result: cd /home/
- If a filename contains spaces, the
TAB
key will automatically escape the spaces, allowing you to continue typing.cat My\ Docu<TAB> # Result: cat My\ Documents/
- Pressing
TAB
twice after a partial entry will display a list of available options, helping you choose from the available matches.ls D<TAB><TAB> # Result: Display list of options starting with D
- When typing command options, pressing
TAB
will auto-complete the option if there is a unique match.ls -l --h<TAB> # Result: ls -l --help
- In some shells, pressing
TAB
can auto-complete variable names.$MY_VA<TAB> # Result: $MY_VARIABLE
- Environment variables can be auto-completed by pressing
TAB
after the$
symbol.echo $HOM<TAB> # Result: echo $HOME
- When using command substitution with
$(...)
, pressingTAB
can auto-complete the command within the substitution.ls -l $(echo /u<TAB>) # Result: ls -l $(echo /usr/)
- Pressing
TAB
after a command that expects a file or directory as an argument will list available options.cat /etc/p<TAB> # Result: cat /etc/passwd
-
Double-Tap TAB:
- Double-tapping
TAB
will show a list of available options if there are multiple matches.
- Double-tapping
-
Cycle Through Options:
- If there are multiple matches, pressing
TAB
multiple times will cycle through the available options.
- If there are multiple matches, pressing
-
Case Sensitivity:
TAB
key completion is case-sensitive. Be aware of the case when using it.
-
Customization:
- The behavior of
TAB
completion can be customized using shell options and configuration files, such as.bashrc
or.bash_profile
.
- The behavior of