As I was getting involved with technologies and knowing more about what our machines run and how effectively we can complete our tasks using better technologies which in our case is using a better OS that runs Linux.
Before I started learning about Linux, I started setting up the environment for my PC to get it Linux-based.
For to use it as a Primary OS, I found Dual Booting much better than the first two methods, considering all the suggestions/advice on Linux, I was in to use Linux at its best and found dual boot is the best way possible.
These are not the only distros just the widely used ones, there are almost one thousand distros as of now maybe even more, you can know more at Distrowatch.
Do you know the actual extent one can go with Linux, is building their distribution, for a person who is at a master-level of System Administration of Linux and uses a distro like Gentoo is quite the challenge they would look up to. It's possible, we need to put on a lot of work for it and we will.
Then enters the switch par from Windows to Linux for dual-booted systems, it was quite simple I must say and that's it for setting up Linux on your PC.
That's Good, but I want to know more about Linux.
Firstly, I've found that what I now use isn't just Linux it's GNU/Linux, yes it is. But why, isn't Linux an OS? Well, It is, as GNU/Linux and it is core which as a kernel is Linux just as it is.
So Linux is a free OS Kernel it's a key component for an OS and in here which is GNU The OS, our system which we say Linux-based is GNU/Linux System
Even our system agrees with it, to know that open your terminal Ctrl + Alt + t
and type the command: uname -a
, you should get the output similar to this
ctrl + alt + t
Point to remember: Linux commands are case-sensitive.
Ctrl + alt + F1
if we want to open up/access multiple consoles we can do it with Ctrl + Alt + F1-F8
like 1-8 is the number for the console, depending on which you want to open it.exit
command to exit from the console, wait for a few seconds, and you'll be back to your system login page.
Here's kiransatyaraj
is the username name and after the @
which is jksrtwt
is the hostname
A Linux-based system can have multiple users for the same host and you can also change the hostname
The terminal emulator which I'm using is Terminator, you can install it using the command: sudo apt update && sudo apt install terminator
After the semicolon, the ~
characters represent the user's home directory, what lies in that position is the file path, after the $
the sign we can start writing the commands.
https://twitter.com/jksrtwt/status/1541774775952896002
cd
- change directory, ls
- list, pwd
- present working directory, /
- root directory,
~ - home directory
pwd
is a path /home/kiransatyaraj/
which means that starting from /
- root directory inside that we have a home directory
inside that, we have a user directory of name kiransatyaraj
ls
- list which lists all the directories of the current directory you are in.echo Hello, World!
is the bash way to print hello world into the console here echo is the command name, and "Hello, World!" is the argumentcd
gets you back to the user's home directory and you can change the directory that you want to work with using cd <filepath>
of the directory like cd Documents/
cd -
to change back to the previous directory, cd ..
to change back to the parent directory,
ls -a
- lists all the files also the hidden files because any file that starts with a dot (.) is hidden--
double hyphens for the word flags and -
single hyphen for the character flags-
character flags and can provide arguments which in this case hello/
is the argument and we are in the parent/user's home directory
clear
command, which clears the page for you, and Ctrl + l
is used to expand the browser until you can use it from the top
Now how do we get to know the option available for a command, that is possible with the man command, now what is man, let's ask about man
using man man
which leads to a page about the manual command
you can get additional typing h
when you're on the manual page, to quit from it just typing q
twice will do the job.
Ctrl + f or space
will help you and for scrolling up one window at a time Ctrl + b
and to get to the very beginning of the page type g
and to the very end of the page G
, to search for a specific keyword type /
while you're on the manual page and type the word or a letter and press enter
, the matches in the current will be highlightedn
to get to the next match and N or Shift + n
for the previous match/
the search starts from the beginning of the page, to search from the end of the manual page and you know the drill what to do nexttype <command-name>
To get the documentation of such builtin shell commands, we use help <command-name>
help does not work on the executable file commands like try help ls
it won't work, help
is only for shell-builtin commands but we have a hack, use <command-name --help>
it works for all the commands no matter what the type is.
man -k <command-name>
or apropos <command-name>
to find the command, feature, keyword
TAB
key for auto-completion of a command, folder, or a directoryTAB
key,
if there's a single match the command will be auto-completed, if not press the key twice to see all the matches for the first few letters of that command
up and down arrow
keys and press enter to run themexit or Ctrl + d
to exit the bash shell/close the terminal, Ctrl + u
to remove the current line, Ctrl + a
to move the cursor to the start of the line, and Ctrl + e
In the end, Ctrl + c
to stop the execution of the command
cat .bash_history
stores the history of all the commands as a directory in the user's home directory, echo $HISTFILESIZE
to know how many commands the systems stores in it which is 2000
history
to print out the entire history of all the commands you ran, echo $HISTSIZE
controls how many commands from your bash history will be stored in the memory
history
shows the current history of the commands but the user's bash history files are updated when the user is logged out
Before logging out
It's updated after logging in, for printing out the user's command history files use cat .bash_history
history
, so to run a certain command of number we use !<number from history's command-line>
, take a look at the picture below
!!
and to run the last nth command from the history use !-n
Running the last command that starts with "XYZ" use !XYZ
and for printing that command !XYZ:p
Ctrl + r
and start typing, if you found the command press enter
, or if you want to exit and clear the line press Ctrl + G
history -d <line_number>
and to erase the whole history use history -c
$HISTCONTROL=ignoreboth
it works only for the current session to save the changes using echo “HISTCONTROL=ignoreboth" >> .bashrc
Thank You so much, you made it till the end, and giving your time means a lot to me, I hope you found this blog helpful and we'll meet again with another blog on "Linux File System" starting with root access, why wait till the next blog you can connect with me on Twitter.
YOU ARE AWESOME!! HAVE A GREAT DAY BUDDY