Understanding the Shell Environment Flashcards
What is the shell?
The Shell is a binary application to interact with the system directly. It is a text mode interface
What is the default shell in SUSE?
The default shell in SUSE is bash
Where can you see the available shells?
Available shells are in /etc/shells
What command shows the aliases for the user?
The command #alias give you the list of aliases for the user
What type of variables are there?
There are shell variables and environment variables
What are functions?
Functions are like script-like grouping of commands
What is an alias?
They are like shortcuts to larger commands
What are the shells modes?
Login, via ssh, using su - or sudo -I
Non-login, using su
Interactive when you execute a command
Non-interactive when you run remotely ssh user@host “somecommand”
What are the files used for interactive logins?
/etc/profile and .profile are used for interactive logins
What are the files used for non-interactive logins?
/etc/bash.bashrc and .bashrc as used for non-interactive logins
What man page gives you info about the shell?
man bash
What command shows you the list of files you have run?
history
What files keeps the history in store?
The file /home/user/.bash_history keeps the history
How do you re-run command 77 in the history?
!77
What keys do you have to use to re-run the last command you ran?
To re-execute the last command just type !!
What do variables contain?
Variables contain data
What command can you use to see the variables?
echo $VAR_NAME
What command can you use to see ALL the variables?
env
What command displays all variables and functions?
set
To set a variable, run this syntax:
VARIABLE=content
To make a brand new variable available to all shells, you have to…
export it: #export VAR=content
Special variables are:
$? shows the exit code of the previous command
$0 shows the name of the command executed
$* shows all the arguments a command had
$# shows how many arguments were used
$$ shows the PID of the shell you are in