Linux

Linux

Linux

What is Linux?
It's like windows, mac, android.
A computer consists of physical parts, called hardware, and written programs called software.
Most computers have a special program that manages all other programs and helps them use the underlying hardware.
This program is called an operating system or os for short.
An operating system is a software that enables the communication between computer hardware and software.
The Linux os inspired by another older os called Unix. The name "Linux" is a combination of its creator's name, "Linus" and "Unix".
Unix is the first major operating system. That made it easier to write and manage programs.
It was created in 1969 at the famous Bell Labs.

Why use Linux?
There are many reasons to choose Linux over other operating systems. 
Linux is completely free to use.
Linux supports all the programming languages such as Python, Java, C/C++, Perl, Ruby, etc...  
To be more specific Linux is open-source.
This means that all of the code that makes Linux is available to everyone and it can be freely redistributed and modified.
The most popular os for mobile phone, android, is a modified version of Linux.
Here are a few more reasons to use Linux:
  • It works with any hardware (from low-end to high-end).
  • It is secure (continuously reviewed by experts). 
  • It is fully customizable (you can change anything you want).
Which Linux?
There are a total of 600 different flavors available. In technical terms, these are called distributions, or distros in short.
if you are just started to learn Linux then I recommend ubuntu Because it's perfect for beginners, has added benefit of being one of the top used and supported distros.

Linux terminal:
It is similar to how you can use a mouse to tell the computer to open a file, you can type in a command in the terminal.
From opening files and increasing the computer volume, there's a terminal command for anything the computer can do.
The term "terminal" originates from the first computer, which had a physical terminal that was used to communicate.
A command is just a piece of text that you type into the terminal.
The main part of the terminal that reads the commands and executes them is called a shell.

Common Terminology
Linux comes with an improved version of the shell, which is called bash.
bash also refers to the programming language used to interpret the code within the shell.

Sometimes you might type some commands which are restricted. That's where the root user comes in. it's the unique admin user, with superpowers. unsurprisingly, its also called superuser.

The package manager removes the tedious process of installing or uninstalling apps. Think of a package as being an app.

Using the Terminal:
There are a few ways to do:
  • pressing CLTR+ALT+T(Ubuntu specific)
  • right-click anywhere in a directory/desktop and press the open terminal.
  • Press the super key(AKA the Windows key) and search for the terminal.
echo "ArduousGeek is cool!"

you can  see the text display in the terminal:
ArduousGeek is cool!

with echo, any string that passes as an argument will be printed in the shell. 

Variable:
Think of a variable as a box.
They are used to store information.
Website="ArduousGeek"

Don't add any spaces around the=sign or you will get an error saying "command not found".
We have taken the "ArduousGeek" information and stored it on our website.
To print this variable, you'd type:
echo $Website
ArduousGeek

You need to prefix a $ sign to the variable name to get its value.

echo Website
Website

Environment Variable
An environment variable is a variable that is available to all the processes running in the shell.
Environment variables like global variables.
Linux contains many default environment variables.
Environment variables are usually names with all uppercase letters to differentiate them from regular variables.
For example, the HOME  environment variable holds the current user's home directory.
A "directory" is just another notable for a folder.
Use the env command to see a list of all current environment variables:
env
USER=arduousgeek
HOME=/home/arduousgeek
if you know the name of the variable you are looking for, use the echo command to display it:
echo $HOME
/home/arduousgeek

Common Environment Variables
On Linux (and other Unix-based operating systems), common environment variables include:
  • HOME, which contains the current user's home directory. That is a top-level directory to most other directories.
  • PATH, which contains a list of directories where to look for a command. When a user types echo in the terminal, Linux finds the echo program in one of the directories listed in PATH and executes it.
  • PWD, which stands for the Present Working Directory and holds the path to the directory you're currently in. This is practically called the "working directory".
  • EDITOR, which specifies the default text editor.
  • LANG, which specifies the user's language.
Personalizing Your Environment
It's possible for each user to customize their bash environment by editing the .bashrc file in their home directory.
If the file exists, one of the first things bash does when loaded is executed each line in this file "as if" the user typed the line directly in the terminal.
Common Customizations:
These are the common customizations:
  • Changing the default terminal by adding color or additional information.
  • Using an alias to create short-hand expressions for common commands.
  • Changing system defaults, usually by modifying environment variables such as PATH and EDITOR.
When researching how to customize your shell, you'll often see reference to both .bashrc and .bash_profile. Most systems are set up so that the difference between these two files doesn't matter and you can edit one or the other to the same effect.
Trivia
The actual difference is somewhere technical, reflecting distinctions that made more sense on the big mainframe computers of the 70s and 80s.