sudo apt install bash zsh shellcheck
Bash is the default interactive shell for many Debian/Ubuntu installations.
Commands, distributions, and practical Linux guidance
Command hub
CMD batch concepts mapped to Bash/Zsh shell behavior, including environment variables, conditionals, loops, exit codes and aliases.
Distro notes
Terminal & Shell Scripting
sudo apt install bash zsh shellcheck
Bash is the default interactive shell for many Debian/Ubuntu installations.
sudo dnf install bash zsh ShellCheck
Fedora uses Bash by default; ShellCheck package capitalization can differ.
sudo pacman -S bash zsh shellcheck
Arch commonly uses Bash by default, but many users install Zsh or Fish.
Guides
48 commands
doskey /macros→alias
Aliases
List shell aliases
Lists defined aliases.
Distro equivalents
Debian/Ubuntu
alias
Fedora
alias
Arch
alias
Open full guide →
doskey macro=value→alias name="command"
Aliases
Create command alias
Creates a temporary shell alias.
Distro equivalents
Debian/Ubuntu
alias name="command"
Fedora
alias name="command"
Arch
alias name="command"
Open full guide →
& command separator→command1; command2
Control Operators
Run commands sequentially
Runs commands one after another regardless of success.
Distro equivalents
Debian/Ubuntu
command1; command2
Fedora
command1; command2
Arch
command1; command2
Open full guide →
&& operator→command1 && command2
Control Operators
Run next command on success
Runs the second command only if the first succeeds.
Distro equivalents
Debian/Ubuntu
command1 && command2
Fedora
command1 && command2
Arch
command1 && command2
Open full guide →
|| operator→command1 || command2
Control Operators
Run fallback command
Runs the second command only if the first fails.
Distro equivalents
Debian/Ubuntu
command1 || command2
Fedora
command1 || command2
Arch
command1 || command2
Open full guide →
%TEMP%→echo "${TMPDIR:-/tmp}"
Environment Variables
Show temp directory
Prints the temporary directory path.
Distro equivalents
Debian/Ubuntu
echo "${TMPDIR:-/tmp}"
Fedora
echo "${TMPDIR:-/tmp}"
Arch
echo "${TMPDIR:-/tmp}"
Open full guide →
%USERNAME%→echo "$USER"
Environment Variables
Show username variable
Prints the current username environment variable.
Distro equivalents
Debian/Ubuntu
echo "$USER"
Fedora
echo "$USER"
Arch
echo "$USER"
Open full guide →
%USERPROFILE%→echo "$HOME"
Environment Variables
Show home directory variable
Prints the current user home directory.
Distro equivalents
Debian/Ubuntu
echo "$HOME"
Fedora
echo "$HOME"
Arch
echo "$HOME"
Open full guide →
setx PATH→echo "export PATH="$PATH:/new/path"" >> ~/.bashrc
Environment Variables
Persist PATH change
Adds a PATH modification to a shell startup file.
Distro equivalents
Debian/Ubuntu
echo "export PATH="$PATH:/new/path"" >> ~/.bashrc
Fedora
echo "export PATH="$PATH:/new/path"" >> ~/.bashrc
Arch
echo "export PATH="$PATH:/new/path"" >> ~/.bashrc
Open full guide →
command /?→command --help
Help
Show command help
Prints built-in command help when supported.
Distro equivalents
Debian/Ubuntu
command --help
Fedora
command --help
Arch
command --help
Open full guide →
help command→man command
Help
Open command manual
Shows the manual page for a command.
Distro equivalents
Debian/Ubuntu
man command
Fedora
man command
Arch
man command
Open full guide →
for /r→find . -type f -exec command {} \;
Loops
Loop files recursively
Runs a command for each matching file under a tree.
Distro equivalents
Debian/Ubuntu
find . -type f -exec command {} \;
Fedora
find . -type f -exec command {} \;
Arch
find . -type f -exec command {} \;
Open full guide →
forfiles→find . -mtime +7 -exec rm {} \;
Loops
Run command on matched files
Finds files by criteria and runs a command on them.
Distro equivalents
Debian/Ubuntu
find . -mtime +7 -exec rm {} \;
Fedora
find . -mtime +7 -exec rm {} \;
Arch
find . -mtime +7 -exec rm {} \;
Open full guide →
dir | find→command | grep "pattern"
Pipelines
Pipe output to search
Sends command output to a text filter.
Distro equivalents
Debian/Ubuntu
command | grep "pattern"
Fedora
command | grep "pattern"
Arch
command | grep "pattern"
Open full guide →
2> redirection→command 2> errors.log
Redirection
Redirect stderr
Writes error output to a file.
Distro equivalents
Debian/Ubuntu
command 2> errors.log
Fedora
command 2> errors.log
Arch
command 2> errors.log
Open full guide →
2>&1 redirection→command > all.log 2>&1
Redirection
Merge stdout and stderr
Writes normal and error output to the same file.
Distro equivalents
Debian/Ubuntu
command > all.log 2>&1
Fedora
command > all.log 2>&1
Arch
command > all.log 2>&1
Open full guide →
> redirection→command > file
Redirection
Redirect stdout
Writes command output to a file.
Distro equivalents
Debian/Ubuntu
command > file
Fedora
command > file
Arch
command > file
Open full guide →
%* batch arguments→printf "%s\n" "$@"
Scripts
All script arguments
Expands all positional arguments safely.
Distro equivalents
Debian/Ubuntu
printf "%s\n" "$@"
Fedora
printf "%s\n" "$@"
Arch
printf "%s\n" "$@"
Open full guide →
%1 batch argument→echo "$1"
Scripts
First script argument
Reads the first positional parameter in a shell script.
Distro equivalents
Debian/Ubuntu
echo "$1"
Fedora
echo "$1"
Arch
echo "$1"
Open full guide →
%~dp0 script directory→cd "$(dirname "$0")"
Scripts
Script directory
Changes to the directory containing the script.
Distro equivalents
Debian/Ubuntu
cd "$(dirname "$0")"
Fedora
cd "$(dirname "$0")"
Arch
cd "$(dirname "$0")"
Open full guide →
call script.bat→source script.sh
Scripts
Run script in current shell
Sources a shell script so it can modify current shell state.
Distro equivalents
Debian/Ubuntu
source script.sh
Fedora
source script.sh
Arch
source script.sh
Open full guide →
choice→read -r -p "Continue? [y/N] " answer
Scripts
Prompt for choice
Reads an interactive answer from the user.
Distro equivalents
Debian/Ubuntu
read -r -p "Continue? [y/N] " answer
Fedora
read -r -p "Continue? [y/N] " answer
Arch
read -r -p "Continue? [y/N] " answer
Open full guide →
start cmd /c→bash -c "command"
Scripts
Run command string
Executes a command through Bash.
Distro equivalents
Debian/Ubuntu
bash -c "command"
Fedora
bash -c "command"
Arch
bash -c "command"
Open full guide →
timeout /nobreak→sleep 10
Scripts
Wait for seconds
Pauses script execution for a number of seconds.
Distro equivalents
Debian/Ubuntu
sleep 10
Fedora
sleep 10
Arch
sleep 10
Open full guide →
where /r→find /path -name "name"
Search
Search recursively for file
Finds files by name under a directory tree.
Distro equivalents
Debian/Ubuntu
find /path -name "name"
Fedora
find /path -name "name"
Arch
find /path -name "name"
Open full guide →
%errorlevel%→$?
Terminal
Check command success or failure exit code
Reads the exit status of the last command. 0 means success; any non-zero value means failure.
Distro equivalents
Debian/Ubuntu
$?
Fedora
$?
Arch
$?
Open full guide →
break→Ctrl+C
Terminal
Interrupt a running command
Stops a currently running command or script. Ctrl+C sends SIGINT to the foreground process.
Distro equivalents
Debian/Ubuntu
Ctrl+C
Fedora
Ctrl+C
Arch
Ctrl+C
Open full guide →
chcp→locale charmap
Terminal
Show terminal encoding
Displays the active character encoding.
Distro equivalents
Debian/Ubuntu
locale charmap
Fedora
locale charmap
Arch
locale charmap
Open full guide →
cls→clear
Terminal
Clear the terminal screen
Clears all text from the terminal window.
Distro equivalents
Debian/Ubuntu
clear
Fedora
clear
Arch
clear
Open full guide →
cmd /k (set title)→alias
Terminal
Create command shortcuts (aliases)
Creates short nicknames for long commands. Add them to ~/.bashrc to make them permanent.
Distro equivalents
Debian/Ubuntu
alias
Fedora
alias
Arch
alias
Open full guide →
color→printf "\033[32mgreen\033[0m\n"
Terminal
Print colored terminal text
Uses ANSI escape sequences for terminal color.
Distro equivalents
Debian/Ubuntu
printf "\033[32mgreen\033[0m\n"
Fedora
printf "\033[32mgreen\033[0m\n"
Arch
printf "\033[32mgreen\033[0m\n"
Open full guide →
doskey /history→history
Terminal
View command history
Shows previously run commands. Linux keeps a much longer history than Windows.
Distro equivalents
Debian/Ubuntu
history
Fedora
history
Arch
history
Open full guide →
echo→echo
Terminal
Print text to terminal
Displays a line of text. Also used in scripts for variable output.
Distro equivalents
Debian/Ubuntu
echo
Fedora
echo
Arch
echo
Open full guide →
exit→exit
Terminal
Exit the shell or return an exit code
Closes the current shell session or exits a script, optionally with a numeric return code.
Distro equivalents
Debian/Ubuntu
exit
Fedora
exit
Arch
exit
Open full guide →
for→for ... in ...; do ... done
Terminal
Loop over a list or range
Repeats a block of commands for each item in a list, range, or set of files.
Distro equivalents
Debian/Ubuntu
for ... in ...; do ... done
Fedora
for ... in ...; do ... done
Arch
for ... in ...; do ... done
Open full guide →
goto→functions / break / continue
Terminal
Control flow — replace GOTO with functions
Bash has no GOTO. Use functions, break, continue, or restructure logic with loops and conditionals.
Distro equivalents
Debian/Ubuntu
functions / break / continue
Fedora
functions / break / continue
Arch
functions / break / continue
Open full guide →
if→if [ condition ]; then ... fi
Terminal
Conditional branching in scripts
Tests a condition and executes different code depending on whether it is true or false.
Distro equivalents
Debian/Ubuntu
if [ condition ]; then ... fi
Fedora
if [ condition ]; then ... fi
Arch
if [ condition ]; then ... fi
Open full guide →
mode con→stty -a
Terminal
Show terminal settings
Displays terminal line discipline settings.
Distro equivalents
Debian/Ubuntu
stty -a
Fedora
stty -a
Arch
stty -a
Open full guide →
path→echo $PATH / export PATH
Terminal
View or modify the command search path
Shows or modifies the list of directories the shell searches when you type a command.
Distro equivalents
Debian/Ubuntu
echo $PATH / export PATH
Fedora
echo $PATH / export PATH
Arch
echo $PATH / export PATH
Open full guide →
pause→read -p
Terminal
Pause a script and wait for keypress
Halts a script and waits for the user to press a key before continuing. Used frequently in batch files.
Distro equivalents
Debian/Ubuntu
read -p
Fedora
read -p
Arch
read -p
Open full guide →
prompt→export PS1="\u@\h:\w\$ "
Terminal
Set shell prompt
Changes the shell prompt format.
Distro equivalents
Debian/Ubuntu
export PS1="\u@\h:\w\$ "
Fedora
export PS1="\u@\h:\w\$ "
Arch
export PS1="\u@\h:\w\$ "
Open full guide →
rem / ::→#
Terminal
Add comments to scripts
Adds human-readable comments to shell scripts that are ignored during execution.
Distro equivalents
Debian/Ubuntu
#
Fedora
#
Arch
#
Open full guide →
set→export / env
Terminal
View or set environment variables
Lists or modifies environment variables available in the current session.
Distro equivalents
Debian/Ubuntu
export / env
Fedora
export / env
Arch
export / env
Open full guide →
set /a (arithmetic)→$(( expression ))
Terminal
Perform arithmetic calculations
Evaluates mathematical expressions in scripts or at the command line.
Distro equivalents
Debian/Ubuntu
$(( expression ))
Fedora
$(( expression ))
Arch
$(( expression ))
Open full guide →
shift→shift
Terminal
Shift script argument positions
Shifts positional parameters ($1, $2...) left by one. Used to process command-line arguments in scripts.
Distro equivalents
Debian/Ubuntu
shift
Fedora
shift
Arch
shift
Open full guide →
start (open file/URL)→xdg-open
Terminal
Open files with default application
Opens a file, folder, or URL with the appropriate default application — like double-clicking in the file manager.
Distro equivalents
Debian/Ubuntu
xdg-open
Fedora
xdg-open
Arch
xdg-open
Open full guide →
title→echo -ne "\033]0;My Title\007"
Terminal
Set the terminal window title
Changes the title text shown in the terminal emulator's title bar.
Distro equivalents
Debian/Ubuntu
echo -ne "\033]0;My Title\007"
Fedora
echo -ne "\033]0;My Title\007"
Arch
echo -ne "\033]0;My Title\007"
Open full guide →
while (goto loop)→while [ condition ]; do ... done
Terminal
Loop while a condition is true
Repeatedly executes commands as long as a condition remains true.
Distro equivalents
Debian/Ubuntu
while [ condition ]; do ... done
Fedora
while [ condition ]; do ... done
Arch
while [ condition ]; do ... done
Open full guide →