Linux Shell, Environment Variables, PATH, Alias & Package Management – Full Quiz
← Back to Shell & Environment Commands
← Back to Linux Commands
← Back to Quiz Home
This quiz contains 20 questions focused on shell variables, environment variables,
PATH configuration, aliases, and Linux package management.
These concepts are heavily used by DevOps engineers in daily operations.
Which variable is accessible only within the current shell session?
Shell variables are local to the current shell instance and are not inherited by child processes.
Which command creates an environment variable?
The export command promotes a shell variable to an environment variable, making it available to child processes.
Which command displays all environment variables?
The env command lists all the current environment variables.
Which command displays a specific environment variable?
To view the value of a specific variable, use echo followed by the variable name prefixed with $.
Which environment variable defines where Linux searches for commands?
The PATH variable contains a colon-separated list of directories where the shell looks for executable files.
Which command displays the current PATH?
echo $PATH prints the contents of the PATH environment variable.
Why can most Linux commands be executed from any directory?
Commands like ls and cp are stored in directories (like /bin or /usr/bin) that are included in the PATH variable.
Which command gives execute permission to a script?
chmod +x adds the execute permission to the file, allowing it to be run as a program.
Why does ./script.sh work but script.sh fails?
By default, the current directory (.) is not in the PATH for security reasons, so you must specify the path explicitly (e.g., ./).
Which file is executed when a new terminal session starts?
~/.bashrc is a script that runs whenever you start a new interactive shell session (like opening a new terminal window).
Which file is used to persist aliases and environment variables?
Adding aliases or export commands to ~/.bashrc ensures they are available in every new shell session.
Which command creates a shortcut command?
The alias command allows you to define a shortcut or abbreviation for a longer command.
Which command removes an alias?
The unalias command removes a previously defined alias.
Which package manager is used in RHEL / CentOS / Oracle Linux?
yum (or dnf in newer versions) is the standard package manager for Red Hat-based distributions.
Which package manager is used in Ubuntu / Debian?
apt (Advanced Package Tool) is the package management system used by Debian and its derivatives like Ubuntu.
Which package manager is used in Alpine Linux?
apk (Alpine Package Keeper) is the lightweight package manager for Alpine Linux.
Which command installs a package using yum?
yum install <package_name> is the command to download and install a package.
Which command removes a package using apt?
apt remove <package_name> uninstalls the package but typically leaves configuration files.
Which command checks if a package command exists?
which searches the PATH for the executable file associated with the given command name.
Which file interpreter is defined by the shebang?
The shebang #!/bin/bash at the top of a script tells the system to execute the file using the Bash shell.
Quiz Progress
0 / 0 questions answered
(0% )
0 correct
Quiz Complete!
0%
Reset quiz
📩 Get weekly DevOps quizzes & guides
📬 Weekly DevOps, Cloud & Gen AI quizzes & guides