
What is a shell?
- Linux shell is a program that allows text-based interaction between the user and the computer
Types of shell in Linux
Linux Commands
- Linux command consists of program name followed by the option and arguments.
- For ex.
cat-n myfile# program name: cat# option: -n# argument: myfile
Home directory
- The home directory is a directory that stores user-specific data.
- this data can be of any type
- for ex. If there is a user named john, then john's data like images, documents, downloads, etc. data will reside in/home/john/ location
How to know the Home directory
echo$HOME# This command will read from the environment variable $HOMEecho ~# This command will expand the tilde symbol to the given user's home directory path
Directory Management
How to know your current path
- To know the current path, we use the command pwd, which stands for Present working directory
pwd
How to create & remove directories
- mkdir is a command that is used to create a directory
- rmdir is a command that is used to delete an empty directory
- example
# to create a directorymkdirtest_directory# to create multiple directoriesmkdirtest1 test2 test3# to delete a directoryrmdirtest_directory# to remove multiple directoriesrmdirtest1 test2 test3
How to list the content of a folder
- to list the content of a directory we use the ls command
# to list the content of a directoryls
How to create a chain of directories
- in order to perform this we use the "-p" parameter with mkdir command
- Example
# We want to create 4 directories each inside of it's parent directorymkdir-p a/b/c/d
How to navigate through directories
- To switch directories we use cd command
# Changing to the parent directorycd ../# Changing to the home directorycd /home/user1
How to navigate folder directory in Linux
- there are two types of path notation in Linux
- 1. Relative Path
- 2. Absolute Path
Relative path
- relative path is defined with respect to the current directory
- "." represents the current working folder
- ".." represents the parent directory
- For example
# to change to the parent directory for the current directorycd ../# to run a file/script present in the current directorybash ./example.sh
Absolute path
- absolute paths are defined with respect to the root "/" location
- for example
# navigating to the user1 document foldercd /home/user1/documents
PUSHD & POPD
- pushd and popd commands are used to manage the directory stack.
- Example
# we created 3 directoriesmkdir-p a/b/c# now we navigate to c directory using pushd command, by pushing it's path to directory stackpushda/b/c# this command will take us to the given c directory and we can create a file hereecho"hello world"> test_file.txt# to navigate to the previous path we can use popd command# this will bring us to the parent directorypopd
Top comments(13)

- Email
- LocationKyle, Texas
- EducationLambda School
- WorkSenior Android Developer
- Joined
Would love to see something about pushd and popd in addition to cd. They can be very handy tools when you changing directories a lot and need to make a quick escape to where you've previously been! :)
Can't wait to see more!

I think an important concept is also where a user's shell is defined.
A user's shell is typically setup when the user is added to the system. Often /bin/bash is set as a default, but macOS now sets /bin/zsh as the default shell for users.
A user could find their default shell by viewing the/etc/passwd
file. For example,
root:x:0:0:root:/root:/bin/bashgames:x:12:100:games:/usr/games:/sbin/nologin
In the above example root's default shell is set to the Bash shell. While the games user actually has been set to a nologin shell, preventing anyone from logging into the user. This has certain uses for non-interactive user sessions. We have other shell options that we can use as well. There are lots of varieties and it depends on your OS, or what the administrator has set at account creation.
There are different commands to modify a user's shell. But one way you can do this is with the usermod command:
usermod -s /bin/bash USER
If you want to find a list of available shells on your system, try this command:cat /etc/shells

- Email
- LocationSan Francisco Bay Area
- EducationM.S., University of Illinois at Urbana-Champaign
- WorkRetired Principal Software Engineer
- Joined
There's no such thing as a Linux shell. There are only various shells, e.g., bash, tcsh, zsh, etc. You can use exactly the same shells on FreeBSD, macOS, and others as you can on Linux.

- LocationNew Delhi, India
- Pronounslinux/coder
- WorkIT Professional
- Joined
@pauljlucas Yeah, you are correct mate, thanks for the help, i've updated the title accordingly.

- Email
- LocationSan Francisco Bay Area
- EducationM.S., University of Illinois at Urbana-Champaign
- WorkRetired Principal Software Engineer
- Joined
You might want to reconsider the banner image and#linux
tag as well.

- Email
- LocationSan Francisco Bay Area
- EducationM.S., University of Illinois at Urbana-Champaign
- WorkRetired Principal Software Engineer
- Joined
You still mention "Linux shell....". You ought to replace that with "A shell...."

- LocationYardley, PA
- EducationN/A
- Pronounshe/him
- WorkPrincipal Architect at Arc XP
- Joined
I’m glad to see folks still talking about the terminal. That said, none of this is bash-specific. These will all work in a variety of shells, and I hope folks find whatever shell they prefer and have a great time in the shell.

- Email
- LocationSan Francisco Bay Area
- EducationM.S., University of Illinois at Urbana-Champaign
- WorkRetired Principal Software Engineer
- Joined
You mention commands, but never once mention thePATH
environment variable or explain that commands likemkdir
"live" in certain directories and the way commands work is that the shell searchesPATH
for a matching command.

- Email
- LocationDhaka,BD
- WorkBackend Developer at ScaleUp Ads Agency
- Joined
In my opinion "how bash works" is also an important topic for a beginners, Don't you think so?

- LocationNew Delhi, India
- Pronounslinux/coder
- WorkIT Professional
- Joined
Beginners with no experience with bash, see the black screen and don't know what to write on it.
From my Teaching experience, they are more interested in, How to use it.
not "How it works".
I hope you understood my point, sir.
Thanks for your Feedback though
Some comments may only be visible to logged-in visitors.Sign in to view all comments.
For further actions, you may consider blocking this person and/orreporting abuse