Bash Shell
We are people who work with Linux daily, and if you're new to working with Linux, then you should definitely know about the bash shell.
Before knowing about the bash shell, let's talk about the shell.
So, what is a shell if you ask?
"Shell is an interface between the user and the operating system; commands you give (cd, ls, mkdir) will be translated to the operating system. Shell controls the OS with a graphical user interface or a command-line interface."
users -> Shell -> Kernel -> Hardware
There are different kinds of shells we have:
C shell, Bash, Zshell, BourneShell. Each one has its own specialty.
In this article, we will focus on the Bash shell.
BASH SHELL :
BASH stands for Bourne Again Shell. BASH is a superset of BourneShell, and BASH is widely used in Linux distributions and macOS.So, it's popular.
It supports command executability.
It helps to automate tasks with its scripting capability.
Remember that BASH is also a programming language that is specially used in automating system tasks, managing files, executing commands, and interacting directly with the operating system.
What is the bashrc file?
Every time you open a Linux terminal, the system needs to set up a shell environment for you - like things your prompt style, environment variables, custom commands(alias)..
Well, bashrc files are of two types based on the user range:
1. User-specific bashrc:
User-specific configuration file - Each user has their own.bashrc file to customize their personal shell environment. Location: ~/.bashrc
2. Global bashrc:
System-wide configuration file. Settings here apply to all users on the system unless overridden in their individual .bashrc files.Location: etc/skel/.bashrc
Well, a general user doesn't need this change, this one, but it's good to know.
To configure :
1. Just open your own .bashrc file with Vim editor and start editing it.
2.Once you configured the bashrc file, just source the file using - source ~/.bashrc
For Fun lets just add some alias in your own bashrc file so you can reduce you repetative typing, with shortcuts.
alias :
"alias is shell command that defines a word that the shell replaces with associated text before interpreting a command line."This means that we ever the interpreter comes across the alias it replaces it with the text you assigned to it in the .bashrc file.
Syntax : alias name='command'
These are some alias I use,
alias c='clear' # Used to clear the terminal window
alias 1-='cd ../' # used to come out of a child directory
alias 2-='cd ../../' # used to come out of a subdirectory two level deep.
alias 3-='cd ../../../' # used to come out of a subdirectory three level deep.
alias 4-='cd ../../../../'# used to come out of a subdirectory four level deep.
alias sim_id='ps -ef | grep simvision.exe' # this is used to check how many users are running the simvision tool currently.
well there are lot more things you can do with bash.There are still more things that I need to know about. So, here are the things I learned so far. I'll try to share my learning further in the future.
Thanks for reading until now, lets meet again.
Comments
Post a Comment