Linux Tutorial for Beginners

What is Linux?

Linux is an open source Operating System like Windows, Android, Mac OS, and iOS. An operating system is a software that enables communication between the user and the computer hardware. Linux is a version/clone of UNIX that was first created at the University of Helsinki by a Student named 'Linus Torvalds' and come into existence in 1991. It is a Cross-platform operating system that can be installed on PCs, laptops, Supercomputers, Mobiles, and more. Linux is an operating system which was developed under the GNU GPL, and its source code is freely available to everyone via the internet. Linux operating system is written in C programming language. Linux used for a wide variety of purposes including networking, Software development and as an end-user platform. Linux is a multi-tasking and multi-user operating system.

Why use Linux?

  • Linux is completely free and available as open-source software.
  • Linux never gets slow.
  • Linux systems are famous for their stability as they can run continuously for years without any major issue.
  • All security enhancement comes in the Linux. No need for antivirus.
  • Software Repository: Most of the Linux operating system have their own 'app store' or 'software repository.’
  • Better Updating Process: Updates in Linux is easy. Regular updates for your system, security, and applications.

 Core Components of a Linux Operating System

Linux operating system consists of following core components:
  1. Linux Kernel: It is the core part of the operating system. It manages the memory, CPU, and peripheral devices.
  2. Bootloader: Bootloader is also known as a boot manager. It is a process that handles the booting up of a system. It also loads the Linux kernel into the main memory.
  3. Daemons: I specifies various background services that start on a boot time or after log in to the desktop.
  4. Shell: In Linux distribution, the shell is termed as a Terminal. Shell is a command line interpreter that executes the command given by the user.
  5. Graphical Server: Sub-system that displays the graphics on the screen of your monitor.
  6. System Library: A set of programs and functions through which applications interrelate with the kernel.
  7. Desktop Environment: It is a group of applications and libraries that are collected together to provide graphical application to the user.

Properties/Features of Linux

Some of the essential features of the Linux Operating System are as follows:
  • Portable: It means Software can work on different types of hardware in the same way. We can install Linux based programs on any hardware platform.
  • Open-source: The source Code of Linux is freely available via the internet.
Many teams work together in collaboration with the Linux Foundation to enhance the capability of the operating system.
  • Multiuser: Multiuser means, more than one user can access the system resources like memory, RAM, or application programs at the same time.
  • Multiprogramming: Linux is a Multiprogramming operating System. It means, more than one application can run at the same time in the hard disk.
  • Hierarchal file system: Linux operating system provides a standard or tree-like file structure in which files or directories are arranged.
  • Shell: Linux provides the special type of interpreter program, by which multiple commands of the operating system can be executed.
  • Security: Linux operating system provides user security using various authentication features like password protection or controlled access to particular files.
  • Support's customized keyboard: Linux is used worldwide, hence it supports different type of language keyboards.

Linux Distribution

Linux Distribution (also known as 'Linux Distro') is an operating system which is a collection of Linux kernel and package management system. Linux user usually obtain their operating system by downloading one of the Linux distribution.

Some of the distributors of Linux are as follow:

  • RedHat
  • CentOS Linux
  • Fedora
  • Debian Linux
  • Ubuntu Linux
  • Linux Mint
  • OpenSUSE
  • Slackware Linux

Architecture of Linux

Architecture of Linux The architecture of Linux consists of the following layers:
  1. Hardware: It consists of all the peripheral devices attached to the system. For example, CPU, RAM, Motherboard, Hard disk, Printer, Scanner, etc.
  2. Kernel: Kernel is a core component of a Linux operating system. It interacts directly with the hardware. Kernel is a middle way between software and hardware which provides low-level services to upper layer Components or user mode's components.

Types of kernel

a) Monolithic kernel b) Micro kernel
  1. Shell: Shell is a command line or a graphical user interface between the user and the kernel. Shell is a command interpreter that executes the command given by the user.
  2. Applications/System Utilities: Utilities of the programs that provide the user most of the functionalities of the operating system.

Difference between Linux and Unix Operating system

     Unix Operating system       Linux Operating system
1. Unix is an operating system which can only be used by its copyrighters. 1. Linux is an operating system which is freely available to everyone.
2. Unix mainly uses for Command Line Interface. 2. Linux mainly uses the GUI with an optional Command Line Interface.
3. It is not portable. 3. Linux operating system is portable.
4. AIS, HP-UX, BSD, and Iris are the different versions of Unix. 4. Ubuntu, Linux Mint, RedHat, Solaris are the different versions of Linux.
5. Unix is not flexible. It has a rigid environment of hardware. Hence, it cannot be installed on every other system. 5. Linux is very flexible and can be installed on home-based PCs, mobile phones, and desktops.
6. zfs, js, hfx, gps, xfs, vxf are some file systems supported by Unix. 6. xfs, ramfs, nfs, vfat, cramfsm, ext3, ext4, ext2, ext1 are some file systems supported by the Linux.

Difference between Linux and Windows Operating system:

Linux operating system  Windows operating system
1.       Linux is free of cost. 1.      Windows is expensive.
2.       Linux is customizable. 2.      Windows is not customizable.
3.       It is an open source Operating System. 3.      Windows Operating system is commercial.
4.       Linux provides high security than windows because it is an open source. 4.      It provides less security than Linux.
5.       In Linux, file names are Case-Sensitive. 5.      Windows filenames are not case-sensitive.
6.       In Linux, Office is free. 6.      Windows pay for the Microsoft Office.
7.       Linux kernel was released on 17 September In 1991. 7.      Windows was first released in 1985.
8.       Linux user has access source code of kernel. 8.      Windows user does not have access to the source code.
9.       File Support system: Ext2, Ext3, Ext4, ReiserFS,Jfs , Xfs, FAT, NTFS, FAT32. 9.   File support system: FAT, FAT32, NTFS, exFAT.
10.    Examples: Ubuntu, Red Hat, Fedora, Debian, Linux Mint, etc. 10. Examples: Window 7, 8, 8.1, 10, XP, Vista.

Installing Linux (Ubuntu 18.04) Alongside With Windows 7/8/10

For installing Linux with Windows, you have to follow these steps:

Download Ubuntu ISO:

  1. You have to download the ISO file from this link: https://www.ubuntu.com/download/desktop.
Download Ubuntu iso
  1. Click on the Download option for the Ubuntu 18.04.2. And your   downloading of .iso File will start.
  2. After 2-3 Minutes, file will be downloaded in your system.

Make a Bootable USB drive:

  1. To make a USB Bootable download the free software Universal USB Installer from this link: https://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/. It will open a browser for downloading the .exe file for universal USB installer.
  2. When .exe file is downloaded then run it. After it, a Window will appear like following image:
Make a Bootable USB drive 3. In the above window, there are three Steps are as follows:
  1. Select Ubuntu.
  2. Select the ubuntu-18.04.2-desktop-amd64.iso file.
  3. Select the USB drive.
  4. Now click on the Create Button. And after it, a Confirmation screen will appear.
Universal usb installer 4. Click on yes button. 5. Now, the installation process is in progress. ubuntu installation process is in progress 6. When the process is completed, then you will see this screen: ubuntu process is completed Now, your Ubuntu Bootable USB is ready to use. Use this USB to install the Ubuntu operating system on your system.

Create Space on Your Hard Drive

Make some space for Linux partition on your system's hard drive. Use the 'Disk management tool' to shrink the space for Windows partition. To use this tool, follow the below steps:   a) To open the Disk management tool, first right click on the Computer icon displayed on your Desktop. Select the option Manage as shown in below figure: Make some space for Linux partition on your system b) After it, a Window will appear. Click on the Disk management option, as shown in the figure: Click on the Disk management option c) A window will appear which shows all the available drives: window will appear which shows all the available drives d) Right click on drive D which has the maximum free space and select the 'Shrink volume' option as shown below Shrink volume optione) A window will appear. Adjust the size as per your requirement and click on the 'shrink' button. requirement and click on the shrink button f) Once the shrinking process is completed, a new allocated partition is created as shown in the figure. Now, this partition is used to install the Linux. partition is used to install the Linux Now, it's time to run the Ubuntu live environment by restarting your system and then installing it.

Run and install the Ubuntu

  • To run Ubuntu Live environment, first you need to insert the Bootable USB drive in your hard disk and reboot your system.
  • Now, load the boot-up menu by using the shortcut keys such as F10 or F12 or F8 (according to your system).
  • Once the boot-up menu appears, select the option 'USB Flash Drive' and press enter key, once the booting process is completed, then there will be an option for ' install Ubuntu 18.04 LTS' select the option and press enter.
Run and install the Ubuntu
  1. After clicking on 'install Ubuntu' option, a wizard will open, and ubuntu installation process will begin.
  2. Select a language and click continue.
ubuntu installation process will begin
  1. Now, choose the keyboard layout and Click on the continue button to move further.
choose the keyboard layout and Click on the continue
  1. On the next screen, you need to select the option:
  • Type of installation (Normal installation or Minimal installation)
  • Download updates while installing Ubuntu (If your system connect with the      Internet during installation, select this option).
Download updates while installing Ubuntu Now, Click on 'Continue' Button to proceed with the installation.
  1. On next Screen, Installer shows the various installation options as shown in the figure. Choose the last option 'something else' and click continue.
Installer shows the various installation
  1. In this step, you will create a partition for Ubuntu. Select the free space and then click on the '+' sign.
create a partition for Ubuntu     / (root):     swap:             swap     /(home)   home
  1. Now, click on 'Install Now' button, and a new window will appear, click on continue to write the changes to disk.
write the changes to disk
  1. On this screen, select your location from map and click on 'continue' button to move forward for installation.
 
  1. Enter your name, and then your computer's name.
Now, create a user name and password and confirm your password. Click on Continue button.  
  1. The files will now be copied to your system, as shown in the below figure, and Ubuntu will be installed.
 
  1. Once the installation completes, remove the bootable USB Drive and click on the 'Restart Now' button.
 
  1. When the system is restarted, you will see the boot menu first.
On the screen, you can choose options either for login to Ubuntu or also boot into Windows 7. Now, you will boot into Ubuntu.  
  1. After completing the booting process, you will see a login screen.
Now, enter the password to log in.  
  1. Congratulations! You have successfully installed Ubuntu along with the windows. Now, you're a Linux user.
 

Basic Commands used in Linux

S.No. Command Description
Terminal Commands
1. clear This command is used to clear the terminal screen.
2. history This command displays the recently used commands.
3. echo <line of text> This command is used to display the line of text.
4. exit This command is used to close or exit the terminal.
             Commands syntax for Files and Directories
5.    cp <file1 file2> This command is used to copy files and directories.
6.  mkdir <dir_name> This command is used to create a new directory.
7. mv <file1 file2> This command is used to rename or move the files and directories.
8. rm <file_name> or rm <dir_name> This command is used to remove the files and directories.
9. ln -s<file link> This command is used to create a symbolic links to the file.
10. cd <’/’ or ‘~’> This command is used to change the directory to home.
11. cd <dir_name> This command is used to change the directory to dir_name.
12. pwd This command displays the present working directory.
13. ls This command displays the list of files and directories in the current working directory.
14. cat <file_name> This command is used to show the content of the file.
15. head <file_name> This command is used to display the first 10 lines of a file.
16. tail <file_name> This command is used to display the last 10 line of a file.
17. touch <file_name> This command is used to create the new file.
18. sort <file_name> Use this command to sort the file in ascending order.
19. sort -r <file_name> Use this command to sort the file in descending order.
20. wc <file_name> This command is used to display the count of line, word count, and bytes, i.e., size for the given file.
    System Information and system process commands
21. Date This command shows the Current date and time.
22. cal This command shows the month,s calendar.
23. uptime This command is used to show the current uptime.
24. free Use this command to check the total amount, free and used amount of a RAM on a system.
25. w This command ‘w’ displays who is online.
26. df This command shows the disk space of a file system.
27. ps This command shows the processes that are started from the shell.
28. ps -A This command is used to display all the information about the processes that are currently running on your system.
29. Ps aux This command is used to display all the processes currently running for all the users on your system with useful information such as CPU loads, starting time of a process.
30. top Just like ps, it also displays all the Running processes, but its updates show every second.
          Commands syntax for managing users
31.        whoami This command displays the current username.
32.           id This command is used to show the current user and the group.
33.       passwd This command is used to update or create a user password.
34. sudo adduser                       <user_name> This command is used to to create a user.
35. sudo deluser <user_name> This command is used to deletes a user.