Working with various Terminal Configurations
(Learn shell scripting and bash scripting - more advanced - later)
iTerm - Terminal Emulator for Mac
-
Terminal Emulator is an application that lets is use the terminal in a graphical way.
-
Control your OS with the help of commands.
What is a shell?
- A shell is a program that takes commands from the keyboard and gives them to the operating system to perform.
- Interprets the commands
- When we run
git
how does the computer know what to do?git
is an executable file. - Commandline interface that interprets commands and tells the OS what to do.
Types of Shells:
- Bourne Shell (sh)
- C Shell (csh)
- Z Shell (zsh) - "Oh my zsh"
- Bash Shell (bash)
root
is the username of the current user@
is the seperatornumber
is the hostname of the server:/#
is the current directory
How to check where the executable file is located?
where git
where python3
Now, if you copy the address and paste in the terminal it'll run the executable file.
ls
- list all the files and folders in the current directoryopen .
- open the current directory in the findermkdir folder
- create a new folder with name "folder"cd folder
- change directory to "folder"cd ..
- go back to the previous directorycd
- go to the home directoryls -a
- list all the files and folders including the hidden files and folderscat file
- print the contents of the filetouch file
- create a new file with name "file"
- Named values that are used to change how commands and processes are executed
- Any instance of a running command is a process
Example:
The PATH Environment Variable
echo $PATH
- The PATH variable is a list of directories that the shell searches through when looking for a command to run.
- All the directories are seperated by a colon
:
- If you wanna store passwords and secrets, you can store them in the environment variables.
- When you open your shell some files are executed automatically.
- For example, when you open your shell, it automatically runs the
.bash_profile
and.bashrc
files.
ls -a
- Any file that starts with a
.
is a hidden file. cat .zshrc
- prints the contents of the.zshrc
file. Contains Themes and Aliases