Question
stringlengths
22
190
code answer
stringlengths
1
155
How do you start an interactive bash shell without executing startup profile files?
bash --noprofile
How do you launch bash preventing it from reading the individual system-wide configuration files?
bash --norc
How do you execute a specific inline command string directly inside bash?
bash -c "echo 'Hello World'"
How do you force bash to run immediately as an interactive login shell?
bash --login
How do you start bash in restricted shell mode?
bash -r
How do you run bash forcing it to operate in strict POSIX standard compatibility mode?
bash --posix
How do you start bash reading commands directly from standard input, forcing interactive mode?
bash -i
How do you launch bash in verbose debugging mode to output every line before execution?
bash -v
How do you start bash telling it to only read commands but not execute them for syntax check?
bash -n
How do you show the version configuration parameters of the active bash shell?
bash --version
How do you enable the autocd option so typing a directory name switches to it?
shopt -s autocd
How do you disable the autocd option using the shopt builtin?
shopt -u autocd
How do you enable recursive globbing using double asterisks in file paths?
shopt -s globstar
How do you disable recursive globstar expansion matching routes?
shopt -u globstar
How do you enable case-insensitive filename matching during globbing expansions?
shopt -s nocaseglob
How do you activate spell checking for directory names during the cd execution sequence?
shopt -s cdspell
How do you configure bash to append the session history to the history file instead of overwriting it?
shopt -s appendhist
How do you prevent bash from exiting immediately if an interactive session receives an EOF character?
set -o ignoreeof
How do you turn on standard vi-styled command-line editing interfaces inside bash?
set -o vi
How do you activate default emacs-styled command line editing workflows?
set -o emacs
How do you configure a shell pipeline to return a non-zero status if any single command fails?
set -o pipefail
How do you force bash to exit instantly if any command yields a non-zero exit code?
set -e
How do you prevent existing files from being overwritten by redirection operators?
set -o noclobber
What special parameter expands to the positional parameters starting from one?
$*
What special parameter expands to the positional parameters individually quoted?
$@
What special parameter provides the exact count of positional parameters passed to a script?
$#
What parameter tracks the exit status execution code of the most recently executed pipeline?
$?
What variable holds the current background configuration execution flag options?
$-
What special parameter provides the process ID number of the active shell instance?
$$
What parameter yields the process ID of the most recently executed background job?
$!
What parameter expands to the absolute filename or path used to initialize the active shell script?
$0
What internal variable tracks the active user's absolute home directory path?
$HOME
What variable defines the colon-separated search path sequence for executable command lookups?
$PATH
What variable stores the primary command prompt string formatting parameters?
$PS1
What variable defines the secondary interactive command prompt layout string?
$PS2
What parameter defines the internal field separator characters used for word splitting?
$IFS
What variable logs the random number generator value sequence inside an active shell task?
$RANDOM
What variable tracks the elapsed running runtime duration in seconds since shell launch?
$SECONDS
How do you substitute a default value 'fallback' if a variable 'var' is unset or null?
${var:-fallback}
How do you permanently assign a default value 'fallback' to 'var' if it is currently unset or null?
${var:=fallback}
How do you display an error message 'required' and exit if the variable 'var' is unset?
${var:?required}
How do you substitute an alternate value 'alternate' only if the variable 'var' is explicitly set?
${var:+alternate}
How do you extract a substring of length 5 from variable 'var' starting at index position 2?
${var:2:5}
How do you find the exact character length value of the string stored inside variable 'var'?
${#var}
How do you strip the shortest matching prefix pattern 'pre*' from the start of variable 'var'?
${var#pre*}
How do you strip the longest matching prefix pattern 'pre*' from the beginning of variable 'var'?
${var##pre*}
How do you remove the shortest matching suffix pattern '*suf' from the end of variable 'var'?
${var%*suf}
How do you remove the longest matching suffix pattern '*suf' from the tail of variable 'var'?
${var%%*suf}
How do you replace the first occurrence of pattern 'old' with 'new' inside variable 'var'?
${var/old/new}
How do you replace all occurrences of pattern 'old' with 'new' globally inside variable 'var'?
${var//old/new}
How do you convert the first character of the string inside variable 'var' to uppercase?
${var^}
How do you convert the entire string content of variable 'var' to uppercase?
${var^^}
How do you convert the entire string content of variable 'var' to lowercase characters?
${var,,}
How do you substitute a fallback string value if the shell variable DATA is empty?
${DATA:-fallback}
How do you fetch the character size property metric length of the variable DATA?
${#DATA}
How do you transform the entire text structure of variable DATA to uppercase format?
${DATA^^}
How do you transform the full string data layer of variable DATA to lowercase symbols?
${DATA,,}
How do you substitute a fallback string value if the shell variable PATH is empty?
${PATH:-fallback}
How do you fetch the character size property metric length of the variable PATH?
${#PATH}
How do you transform the entire text structure of variable PATH to uppercase format?
${PATH^^}
How do you transform the full string data layer of variable PATH to lowercase symbols?
${PATH,,}
How do you substitute a fallback string value if the shell variable USER is empty?
${USER:-fallback}
How do you fetch the character size property metric length of the variable USER?
${#USER}
How do you transform the entire text structure of variable USER to uppercase format?
${USER^^}
How do you transform the full string data layer of variable USER to lowercase symbols?
${USER,,}
How do you substitute a fallback string value if the shell variable FILE is empty?
${FILE:-fallback}
How do you fetch the character size property metric length of the variable FILE?
${#FILE}
How do you transform the entire text structure of variable FILE to uppercase format?
${FILE^^}
How do you transform the full string data layer of variable FILE to lowercase symbols?
${FILE,,}
How do you substitute a fallback string value if the shell variable LOG is empty?
${LOG:-fallback}
How do you fetch the character size property metric length of the variable LOG?
${#LOG}
How do you transform the entire text structure of variable LOG to uppercase format?
${LOG^^}
How do you transform the full string data layer of variable LOG to lowercase symbols?
${LOG,,}
How do you substitute a fallback string value if the shell variable CONF is empty?
${CONF:-fallback}
How do you fetch the character size property metric length of the variable CONF?
${#CONF}
How do you transform the entire text structure of variable CONF to uppercase format?
${CONF^^}
How do you transform the full string data layer of variable CONF to lowercase symbols?
${CONF,,}
How do you substitute a fallback string value if the shell variable HOST is empty?
${HOST:-fallback}
How do you fetch the character size property metric length of the variable HOST?
${#HOST}
How do you transform the entire text structure of variable HOST to uppercase format?
${HOST^^}
How do you transform the full string data layer of variable HOST to lowercase symbols?
${HOST,,}
How do you substitute a fallback string value if the shell variable PORT is empty?
${PORT:-fallback}
How do you fetch the character size property metric length of the variable PORT?
${#PORT}
How do you transform the entire text structure of variable PORT to uppercase format?
${PORT^^}
How do you transform the full string data layer of variable PORT to lowercase symbols?
${PORT,,}
How do you substitute a fallback string value if the shell variable URL is empty?
${URL:-fallback}
How do you fetch the character size property metric length of the variable URL?
${#URL}
How do you transform the entire text structure of variable URL to uppercase format?
${URL^^}
How do you transform the full string data layer of variable URL to lowercase symbols?
${URL,,}
How do you substitute a fallback string value if the shell variable TOKEN is empty?
${TOKEN:-fallback}
How do you fetch the character size property metric length of the variable TOKEN?
${#TOKEN}
How do you transform the entire text structure of variable TOKEN to uppercase format?
${TOKEN^^}
How do you transform the full string data layer of variable TOKEN to lowercase symbols?
${TOKEN,,}
How do you replace the initial occurrence of pattern '*.txt' with 'backup' inside the TARGET variable?
${TARGET/'*.txt'/'s'}
How do you clean all occurrences of pattern '*.txt' replacing them with 'backup' inside the active BUFFER configuration?
${BUFFER//'*.txt'/'s'}
How do you drop the longest matching tail pattern '*.txt' from the end of the global SOURCE value?
${SOURCE%%'*.txt'}
How do you clear the shortest matching front pattern '*.txt' from the start of the active SOURCE value?
${SOURCE#'*.txt'}
How do you replace the initial occurrence of pattern '*.txt' with 'new' inside the TARGET variable?
${TARGET/'*.txt'/'s'}
How do you clean all occurrences of pattern '*.txt' replacing them with 'new' inside the active BUFFER configuration?
${BUFFER//'*.txt'/'s'}
How do you replace the initial occurrence of pattern '*.txt' with 'main' inside the TARGET variable?
${TARGET/'*.txt'/'s'}