Users, Interactive and Login shells Flashcards
What configuration scripts are executed upon signing in through the login shell?
1 /etc/profile - sets up environment variables 2 ~/.bash_profile | ~/.bash_login | ~/.profile - first file executed, sets up user env variables 3 ~/.bashrc - sets up user created functions and command aliases 4 /etc/bashrc - sets up system wide functions and command aliases
What script will be executed at user logout if it exists?
~/.bash_logout *user defined commands can be placed here to perform actions at logout
What configuration scripts are executed upon opening a non login shell (interactive)?
1 ~/.bashrc - sets up user created functions and commands 2 /etc/bashrc - sets up system wide functions and command aliases
How do you modify the $PATH env variable?
append: PATH=$PATH:/directory prepend: PATH=/directory:$PATH
How do you create a variable and use it in other shells?
export VARIABLENAME
What is the structure that constitutes a command?
Command Option Argument i.e ls -l file
What is the command to create an alias?
alias =’’ i.e alias lr=’ls -R’
What is the command to remove a created alias?
unalias i.e unalias lr
How do you create a persistent alias?
Append alias to ~/.bashrc
How do you get a listing of shell and environment variables?
set
When using the su command, what denotes a login shell?
- -l –login i.e su - *loads the env variables for the user
What is important to account for when running a script?
Script is run with under user with login shell, for instance if it depended on environment variables that were not present from interactive shell
How would you login as root without knowing the root user password?
sudo su
Add to path
export PATH=$PATH:/place/with/the/file
Make path permanent
Add the to ~/.bashrc