Shell Configuration
Dr.GINNE MJAMES
Assistant Professor
Department of Computer Science with Data Analytics
Sri Ramakrishna College of Arts and Science
Coimbatore - 641 006
Tamil Nadu, India
1
2.
What is ShellConfiguration?
•Customizing the shell environment to enhance usability and productivity.
•Common Shells: Bash, Zsh, Fish, etc.
Environment Variables
•What areEnvironment Variables?
•Key-value pairs used by the shell to configure the environment.
•Common Environment Variables:
•PATH
•HOME
•USER
•SHELL
5.
Setting Environment Variables
•Persistent Setting:
• Add to bashrc or zshrc
export PATH=$PATH:/new/path
• Temporary Setting
PATH=$PATH:/new/path
6.
Aliases
• What areAliases?
• Shortcuts for commands.
• Creating Aliases
alias ll='ls -la’
alias gs='git status'
7.
Functions
• What areFunctions?
Custom reusable commands.
• Creating Functions
function greet() {
echo "Hello, $1"
}
8.
Shell Prompts
• Customizingthe Shell Prompt:
PS1 variable in Bash:
PS1='u@h:w$ ‘
• Example for Zsh:
PROMPT='%n@%m:%~%# '
9.
Using .bashrc and.bash_profile
•Purpose of .bashrc:
Executed for interactive non-login shells.
•Purpose of .bash_profile:
Executed for login shells.