1/69
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Linux shell
A tool that lets users run programs, check files, and customize how the system works.
Environmental variables
Special variables used by the system, shell, or apps to store process-specific or session data.
$USER variable
The username of the person currently logged in.
View the $USER variable
echo $USER
$HOME variable
The user's home directory path.
View the $HOME variable
echo $HOME
$SHELL variable
The path to the current shell interpreter (e.g., /bin/bash).
PS1 variable
The appearance of the command prompt.
Escape sequences in PS1
\u: username, \h: hostname, \w: working directory, \$: prompt symbol ($ or #).
PATH variable
A list of directories that Linux searches to find executable programs.
Add a directory to PATH temporarily
export PATH=$PATH:/your/custom/dir
Make PATH changes permanent
Add them to ~/.bashrc or ~/.zshrc.
DISPLAY variable
Specifies where GUI programs send their output.
DISPLAY=:0.0
Local desktop session using display 0 and screen 0.
DISPLAY=localhost:10.0
Remote X forwarding session over SSH.
Absolute path in Linux
A complete address to a file/folder starting from the root (/).
Relative path in Linux
A file/folder address based on your current working directory.
~ in Linux paths
The current user's home directory.
Environment configuration files
Files like .bash_profile, .bashrc, .profile that define shell behavior.
.bash_profile
Loads user-specific variables when starting a Bash login session.
.bashrc
Runs for every interactive, non-login shell like opening a terminal.
.profile
General login session settings, especially for POSIX-compliant shells.
Input redirection (
Redirects a command's input from a file instead of the keyboard.
Here-document (<
Allows embedding a block of text directly in a script/command.
Here-string (<<
Sends a single string as input to a command.
Standard input (stdin)
Default method for commands to receive input (usually the keyboard).
Output redirection (> and >>)
> overwrites a file with output; >> appends output to a file.
stderr in Linux
A separate output stream used for error messages.
2> and 2>> in output redirection
Redirects stderr to a file (overwrite or append).
&>
Redirects both stdout and stderr to the same file.
History command
Shows previously run commands in current and past sessions.
!!
Repeats the last command entered.
!43 or !cmd
Re-runs a specific command by number or prefix from history.
alias in Linux
A shortcut for a longer command.
make an alias permanent
Add it to ~/.bashrc or ~/.bash_profile.
regex
A series of character patterns used to search or match text.
regex symbol .
Matches any single character.
^ and $ in regex
^ matches start of line, $ matches end of line.
[ ] in regex
Define character ranges or sets (e.g., [a-z], [0-9]).
* in regex
Matches zero or more of the preceding character.
+ in regex
Matches one or more of the preceding character.
? in regex
Matches zero or one of the preceding character.
{n} in regex
Matches exactly n occurrences of the previous character.
grep
Searches files for lines that match a regex pattern.
sed
Stream editor used for modifying text in files.
awk
Text processing tool that handles structured data and prints specific fields.
cut
Extracts sections or columns from files.
tr
Translates or deletes characters in text.
wc
Counts lines, words, and characters in text.
sort
Arranges data by specified fields or values.
uniq
Filters out or counts duplicate lines in text.
xargs
Builds command lines from input (often used with find).
head
Displays the first few lines of a file.
tail
Displays the last few lines of a file; can follow live changes.
more
Displays file content page-by-page (scroll forward only).
less
Displays file content with forward/backward scrolling and searching.
echo
Prints text or variables to the screen or a file.
cat
Reads, concatenates, and displays file contents.
tee
Writes output to both a file and the screen at the same time.
printf
Prints formatted text with control over variables and layout.
bc
A command-line calculator for arithmetic operations.
uname
Displays system information (OS, kernel version, architecture).
source
Executes a script in the current shell, applying changes immediately.
nano
A simple, user-friendly terminal text editor.
nano's save and exit shortcuts
Ctrl + O to write, Ctrl + X to exit.
vi/vim
Advanced modal text editors with Insert, Command, and Execute modes.
command in vim saves and exits
:wq
quit vim without saving
:q!
replace text in vim
:s/old/new/g
highlight search matches in vim
:set hlsearch