Introduction to Linux Shell and basic commands:
Kernel:
- The kernel is a computer program that is the core of a computer’s operating system, with complete control over everything in the system.
- Think of it as as Chef working in a hotel. You as a coustmer can’t see the chef working but get your order (output).
Shell:
- Shell is a special user program that provides an interface for the user to use operating system services.
- Using the same scenario, think of shell as a waiter, who takes your order (input) and gives it to the chef (Kernel).
Shell is divided into two categories-
-
Command Line Shell:
-
Graphical shell:
Types of shell:
- BASH (Bourne Again SHell)
- CSH (C SHell)
- KSH (Korn SHell)
### File system structure:
NAME | DESCRIPTION |
---|---|
/ |
The slash / character denotes the root of the filesystem tree. exp: Trunk of a tree. |
/home |
Contains personal directories of user. |
/lib |
Contains system libraries and critical file. |
/bin |
Contains user executable files. |
/boot |
Contains all the files that are required for booting. |
/dev |
Contains hardware and development files. |
/media |
Mount points for removable media. |
/mnt |
Temporarily mounted filesystems. |
/opt |
Contains optional files. |
Commands:
date
: Returns current date.whoami
: Returns the current domain and user name.ls
(list): Returns content of a specified Directorycd
: Changes directory.
mkdir
: Creates a new directory.pwd
: Prints the current working directory.
touch
: Creates empty file.cat
: Creates file with content.
-
whereis
: Finds the location of specified file. -
mv
: To move or rename a file. -
cp
: To copy content of a file to the other. -
whatis
: Gives short description of a command.
Issues faced:
Running whatis command
always returns “nothing appropriate”
Solution found:
whatis
uses an index created and maintained by mandb
to locate the documentation you’re looking for. If said index doesn’t exist, or if the command you’re looking for isn’t in the existing index, you’ll see Nothing appropriate. If your setup doesn’t have a mandb
index yet, you can create one by running sudo mandb