0% found this document useful (0 votes)
19 views73 pages

Linux Desktop

Linux is an open-source operating system derived from UNIX, widely used across various devices and popular among developers. It has multiple distributions, each catering to different user needs, and is known for its stability and performance compared to Windows. The document also covers Linux installation, user management, and the file system structure, emphasizing the importance of understanding commands and directories.

Uploaded by

devkush13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views73 pages

Linux Desktop

Linux is an open-source operating system derived from UNIX, widely used across various devices and popular among developers. It has multiple distributions, each catering to different user needs, and is known for its stability and performance compared to Windows. The document also covers Linux installation, user management, and the file system structure, emphasizing the importance of understanding commands and directories.

Uploaded by

devkush13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 73

Linux Desktop

What is Linux?
 Linux is an open-source operating system like other
operating systems such as Microsoft Windows, Apple
Mac OS, iOS, Google android, etc.

 Linux is around us since the mid-90s. It can be used


from wristwatches to supercomputers. It is everywhere
in our phones, laptops, PCs, cars and even in
refrigerators. It is very much famous among
developers and normal computer users.
Linux Desktop
Evolution of Linux?
 Linux operating system is derived from UNIX OS.
 Unix was created in the 1960s by Dennis Ritchie and Ken Thompson.
Both of them also invented C Programming language.
 Linux was initially named GNU and was developed by Richard
Stallman.
 Linux was the name of the kernel created in 1991 by Linux Torvalds,
a student at the University of Helsinki.
 People started calling the GNU OS , Linux because of the name of
the kernel.
Linux Desktop
Linux Eco System Distribution
 Linux OS has multiple distributions that are derived from it’s initial
deployment.
 Most of them are free and offer full functionality:
 Ubuntu
 Linux Mint
 Debian
 Fedora
 Red hat Enterprise
 Cent OS
 OpenSUSE
 Arch Linux
 Etc.
Linux Desktop
Choosing a Linux Distro
Distribution Why To Use
UBuntu It works like Mac OS and easy to use.
Linux mint It works like windows and should be use by new comers.

Debian It provides stability but not recommended to a new user.

Fedora If you want to use red hat and latest software.

Red hat enterprise To be used commercially.


CentOS If you want to use red hat but without its trademark.

OpenSUSE It works same as Fedora but slightly older and more stable.

Arch Linux It is not for the beginners because every package has to be
installed by yourself.
Linux Desktop
Comparison with Windows
 Windows is easy to install. BUT it
 Is unstable.
 Performs poorly.
 Crashes frequently.

 Linux is trickier to install and configure. BUT


 Stable
 Performs better than Windows.
 Crashes more rarely than Windows.
 It is also more flexible than Windows. Linux takes
time to master, but it is very powerful.
Linux Desktop
Linux Installation
 First we need a bootable disk or bootable USB drive having
Linux Operating System in it.

 Turn off your system

 Insert the Disk Or USB drive into the system and turn on
your machine.

 There are two possible scenarios:


 The computer boots the USB drive automatically.
 You need to manually configure USB booting in
the Boot Menu or BIOS/UEFI.
Linux Desktop
Linux Installation

Click on Install Ubuntu


Linux Desktop
Linux Installation

Select Language

Click on continue

Select keyboard layout


Linux Desktop
Linux Installation

Click on Continue

Select Normal Installation


Linux Desktop
Linux Installation
Select Installation type

Click on Install Now


Linux Desktop
Linux Installation

Click on continue
Linux Desktop
Linux Installation

Select the location

Click on continue
Linux Desktop
Linux Installation

Provide the Username you want

Choose your password

Click on continue
Linux Desktop
Linux Installation

Installation is in proogress
Linux Desktop
Linux Installation

Click on Restart Now button to


complete the installation
Linux Desktop
Introduction To Users
 If more than one person use a single system, then everyone may have
their own user account.
Syntax: whoami
It tells you about the system's username.
Syntax: who
The who command gives the information about the users logged on to
the system.
Syntax: w
The who command gives the information about the users logged on to
the system.
Linux Desktop
Create User in Linux (Ubuntu)
There are two most common ways to add a user to a Linux server.

 Graphically through user manager


 By the useradd command (Terminal)

1. Graphically through user manager

To create a user to your Linux server, follow the below steps:


 Goto system search and search for the setting and navigate to Detail->
About.

 Click on the Users after that Unlock option given on the header. It will
ask for the system security password to enter the password and
click ok to continue. Consider the below image:
Linux Desktop
Create User in Linux (Ubuntu)

Click here to unlock


Linux Desktop
Create User in Linux (Ubuntu)

Click to add user


Linux Desktop
Create User in Linux (Ubuntu)

Choose password option Fill user details


Linux Desktop
Create User in Linux (Ubuntu)

Click on Add
Linux Desktop
Create User in Linux (Ubuntu)

Created user will be listed here

User can be removed from here


Linux Desktop
Create User in Linux (Ubuntu)
2. By the Linux useradd command

 In Linux, useradd command is a command-line utility which is used to


add or remove a user.

 In a different type of Linux distribution, the useradd command may be


slightly different.

 The useradd command performs the below tasks:

 It edits the files for newly created user


like /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow

 It creates and opens a new home directory.

 It allows us to set ownerships and permissions to the home directory.


Linux Desktop
Create User in Linux (Ubuntu)
 In order to use the useradd command, we have to log-in with root or sudo
access.

 Before using Linux useradd command, let's understand some common


terms that are used in the Linux command line.

Username: A username is a name that is used to login to the Linux system.


It is displayed when we turn on our machine. The username length should
be between 1 to 32 characters.

Password: A password is a secret code that is used to protect your system


from unauthorized access. It is stored in etc/shadow file in an encrypted
format.
Linux Desktop
Create User in Linux (Ubuntu)

User ID (UID): Linux provide a unique Id to every user; it is called user


identification number or User ID or UID. By default, the UID for the root
user is reserved as zero, and the remaining UID from 1 to 99 is reserved for
other predefined accounts. Further, UID's from 100-999 are reserved for
groups and system accounts.

Group ID (GID): The GID or Group ID is a group identification number


provided by the Linux system. It is stored in /etc/group file.

User Info: It allows us to define some additional information about the user,
such as user full name. It is optional.

Home Directory: It is an absolute location for a user.

Shell: It is an absolute location of a user's shell i.e. /bin/bash.


Linux Desktop
Create User in Linux (Ubuntu)
 To create a new user by useradd command, execute the useradd command followed
by username as follows:

 To set the password for the newly created user, execute the below command.

 The command will ask for the new password, enter the password and retype the new
password.

 It will update the password for the specified user.

 Consider the below output.


Linux Desktop
Create User in Linux (Ubuntu)
Create a user with a home directory
 Sometimes the newly created user may or may not assign a home directory. To
create a user and to forcefully assign a home directory to it, execute the below
command

 The above command will ask for the system administration password and create a
directory home/demo for the user demo.
Linux Desktop
Create User in Linux (Ubuntu)
Create a user with a different home directory

 Linux allows us to create a home directory on a different place instead of the default
folder. Use the -d option with useradd command to create a different home directory.
Execute the below command

 The above command will create a Demo folder under the root directory for the
user test.
Linux Desktop
Create User in Linux (Ubuntu)
Create a user with an expiry date

 To create a user with an expiry date that means after a particular date, it will be
auto-deleted.

 The above command will create a user with a specified expiry date. It will create a
user named demo2, which will be auto-deleted after 1 Aug 2021.
Linux Desktop
Linux User Management
 User management includes everything from creating a user to deleting a user on
your system. User management can be done in three ways on a Linux system.

 Graphical tools are easy and suitable for new users, as it makes sure you'll not
run into any trouble.
 Command line tools includes commands like useradd, userdel, passwd, etc.
These are mostly used by the server administrators.
 Edit the local configuration filesThird and very rare tool is to directly using vi.

 The local user database in Linux is /etc/passwd directory.


Linux Desktop
Layout of a Linux OS
The Linux operating system's architecture mainly contains some
of the components: the Kernel, System Library, Hardware
layer, System, and Shell utility.
Linux Desktop
Layout of a Linux OS
Kernel:- The kernel is one of the core section of an operating
system. It is responsible for each of the major actions of the Linux
OS. This operating system contains distinct types of modules and
cooperates with underlying hardware directly. The kernel
facilitates required abstraction for hiding details of low-level
hardware or application programs to the system. There are some
of the important kernel types which are mentioned below:

 Monolithic Kernel
 Micro kernels
 Exo kernels
 Hybrid kernels
Linux Desktop
Layout of a Linux OS
System Libraries:- These libraries can be specified as some
special functions. These are applied for implementing the
operating system's functionality and don't need code access
rights of the modules of kernel.

System Utility Programs:- It is responsible for doing specialized


level and individual activities.

Hardware layer:- Linux operating system contains a hardware


layer that consists of several peripheral devices like CPU, HDD,
and RAM.
Linux Desktop
Layout of a Linux OS
Shell:- It is an interface among the kernel and user. It can afford the services
of kernel. It can take commands through the user and runs the functions of the
kernel. The shell is available in distinct types of OSes. These operating
systems are categorized into two different types, which are the graphical
shells and command-line shells.
The graphical line shells facilitate the graphical user interface, while the
command line shells facilitate the command line interface. Thus, both of these
shells implement operations. However, the graphical user interface shells work
slower as compared to the command-line interface shells.
There are a few types of these shells which are categorized as follows:
•Korn shell
•Bourne shell
•C shell
•POSIX shell
Linux Desktop
Layout of a Linux OS
There are a few types of these shells which are categorized as
follows:

 Korn shell
 Bourne shell
 C shell
 POSIX shell
Linux Desktop
Directory Structure
Linux Desktop
Directory Description
The directory called “root.” It is the starting point
/ for the file system hierarchy. Note that this is not
related to the root, or superuser, account.

/bin Binaries and other executable programs.

/etc System configuration files.


/home Home directories.
/opt Optional or third party software.

/tmp Temporary space, typically cleared on reboot.

/usr User related programs.


/var Variable data, most notably log files.
Linux Desktop
Directory Description
The directory called “root.” It is the starting point
/ for the file system hierarchy. Note that this is not
related to the root, or superuser, account.

The /bin directory is where you will find binary or


executable files. Programs are written in source code
which is human readable text. Source code is then
compiled into machine readable binaries. They are
/bin called binaries because machine code is a series of
zeros and ones. The import thing to know is that
commands, programs, and applications that you can
use are sometimes located in /bin.
Linux Desktop
Directory Description
Configuration files control how the operating
The
system directory called “root.”behave.
or applications It is the starting point
For example,
//etc for
therethe is
file asystem
file in hierarchy.
/etc that Note
tells that
thethis is not
operating
related
system towhether
the root,toorbootsuperuser,
into a account.
text mode or a
graphical mode.
The /bin directory is where you will find binary or
User home
executable directories
files. Programs arearewritten
located in /home.
in source code If
your
whichaccount
is humanname is “xxxx”
readable your home
text. Source code isdirectory
then
will be /home/xxxx.
compiled into machineLinux systems
readable canThey
binaries. andare often
/bin do have
called multiple
binaries usermachine
because accounts. codeHome directories
is a series of
/home
zeros
allow andeach ones.userThetoimport thing their
separate to knowdatais that
from the
commands,
other usersprograms,on the and applications
system. The pat that you can is
directory
use
knows are as
sometimes located inA/bin.
a subdirectory. subdirectory is simply
a directory that resides inside another directory.
Linux Desktop
Directory Description
The /opt directory houses optional or third party
software. Software that is not bundled with the
operating system will often been installed in /opt.
/opt
For example, the Google Earth application is not
part of the standard Linux operating system and
gets installed in the /opt/google/earth directory.
Temporary space is allocated in /tmp. Most Linux
distributions clear the contents of /tmp at boot
time. Be aware that if you put files in /tmp and the
/tmp Linux system reboots, your files will more than
likely be gone. The /tmp directory is a great place
to store temporary files, but do not put anything
in /tmp that you want to keep long term.
Linux Desktop
Directory Description
The /usr directory is called “user.” You will find
user related binary programs and executables in
/usr
the /usr/bin directory.

Variable data such as log files reside in /var.


Specifically, the /var/log directory contains logs
/var generated by the operating system and other
applications.
Linux Desktop
Linux Files
 In Linux system, everything is a file and if it is not a
file, it is a process.

 A file doesn't include only text files, images and


compiled programs but also include partitions,
hardware device drivers and directories.

 Linux consider everything as as file.

 Files are always case sensitive.


Linux Desktop
Linux Files
 In Linux system, everything is a file and if it is not a
file, it is a process.

 A file doesn't include only text files, images and


compiled programs but also include partitions,
hardware device drivers and directories.

 Linux consider everything as as file.

 Files are always case sensitive.


Linux Desktop
Types of Files
 Regular files (-): It contain programs, executable files
and text files.

 Directory files (d): It is shown in blue color. It contain list


of files.

 Special files:
 Block file (b)
 Character device file (c)
 Named pipe file (p)
 Symbolic link file (l)
 Socket file (s)
Linux Desktop
Linux File System
 A Linux file system is a structured collection of files on a disk
drive or a partition.
 A partition is a segment of memory and contains some specific
data.
 In our machine, there can be various partitions of the memory.
 Generally, every partition contains a file system.
 The general-purpose computer system needs to store data
systematically so that we can easily access the files in less
time.
Linux Desktop
Linux File System
 It stores the data on hard disks (HDD) or some equivalent
storage type there may be below reasons for maintaining the
file system:

 Primarily the computer saves data to the RAM storage; it


may lose the data if it gets turned off. However, there is
non-volatile RAM (Flash RAM and SSD) that is available to
maintain the data after the power interruption.

 Data storage is preferred on hard drives as compared to


standard RAM as RAM costs more than disk space. The
hard disks costs are dropping gradually comparatively the
RAM.
Linux Desktop
Linux File System
The Linux file system contains the following sections:

 The root directory (/)

 A specific data storage format (EXT3, EXT4, BTRFS,


XFS and so on)

 A partition or logical volume having a particular file


system.
Linux Desktop
What is Linux File System ?
 Linux file system is generally a built-in layer of a Linux
operating system used to handle the data management of the
storage.

 It helps to arrange the file on the disk storage.

 It manages the file name, file size, creation date, and much
more information about a file.

 If we have an unsupported file format in our file system, we


can download software to deal with it.
Linux Desktop
Ext3 File System
 Ext3 is developed through Ext2; it is an upgraded version of
Ext2 and contains backward compatibility.
 The Ext 3 file system prevents loss of data integrity in the
event that an unclean system shutdown occurs.
 The Ext3 allows you to choose the type and level of
protection that your data receives.
 With regard to the state of the file system ext3 volumns are
configured to keep a high level of data consistency by
default.
 The major drawback of Ext3 is that it does not support
servers because this file system does not support file
recovery and disk snapshot.
Linux Desktop
Ext4 File System
 Ext4 file system is a salable extension of the ext3
file system.

 Ext4 the default file system of Red Hat Enterprise


Linux 6.

 It can support files and filesystems up to 16 TB.

 It also supports unlimited no of sub-directories.


Linux Desktop
ReiserFS File System
 ReiserFS is an alternative to the Ext3 file system.

 It has improved performance and advanced


features.

 In the earlier time, the ReiserFS was used as the


default file system in SUSE Linux, but later it has
changed some policies, so SUSE returned to Ext3.

 This file system dynamically supports the file


extension, but it has some drawbacks in
performance.
Linux Desktop
B Tree File System (BtrFS)
 Btrfs stands for the B tree file system.

 It is used for fault tolerance, repair system, fun


administration, extensive storage configuration, and
more.

 It is not a good suit for the production system.


Linux Desktop
XFS
XFS File System :

 JFS(Journaled File System), and it is developed by IBM for


AIX Unix.
 It is an alternative to the Ext file system.
 It can also be used in place of Ext4, where stability is
needed with few resources.
 XFS file system was considered as high-speed JFS, which
is developed for parallel I/O processing.
Linux Desktop
Linux I/O Redirection
 Redirection can be defined as changing the way from
where commands read input to where commands
sends output. You can redirect input and output of a
command.

 For redirection, meta characters are used. Redirection


can be into a file (shell meta characters are
angle brackets '<', '>') or a program ( shell meta
characters are pipesymbol '|').
Linux Desktop
Linux I/O Redirection
Standard Streams In I/O Redirection
The bash shell has three standard streams in I/O redirection:

 standard input (stdin) : The stdin stream is numbered as


stdin (0). The bash shell takes input from stdin. By default,
keyboard is used as input.
 standard output (stdout) : The stdout stream is numbered
as stdout (1). The bash shell sends output to stdout. Output
goes to display.
 standard error (stderr) : The stderr stream is numbered
as stderr (2). The bash shell sends error message to stderr.
Error message goes to display.
Linux Desktop
Linux I/O Redirection
Redirection Into A File
Each stream uses redirection commands. Single bracket '>' or double
bracket '>>' can be used to redirect standard output. If the target file
doesn't exist, a new file with the same name will be created.

Overwrite
Commands with a single bracket '>' overwrite existing file content.
 > : standard output
 < : standard input
 2> : standard error

Note: Writing '1>' or '>' and '0<' or '<' is same thing. But for stderr you
have to write '2>'.
Linux Desktop
Linux I/O Redirection
Syntax: cat > <fileName>

Example:
cat > sample.txt
Linux Desktop
Linux I/O Redirection
Append
Commands with a double bracket '>>' do not overwrite the existing
file content.

 >> - standard output


 << - standard input
 2>> - standard error

Syntax: cat >> <fileName>


Linux Desktop
Linux I/O Redirection
Example: cat >> sample.txt

Look at the above snapshot, here again we have created two files with the same name
using '>>' in command "cat >> sample.txt". But this time, content doesn't overwrite
and everything is displayed.
Linux Desktop
Linux I/O Redirection
Append
Commands with a double bracket '>>' do not overwrite the existing
file content.

 >> - standard output


 << - standard input
 2>> - standard error

Syntax: cat >> <fileName>


Linux Desktop
Linux I/O Redirection
Redirection Into A Program

 Pipe redirects a stream from one program to another. When pipe is


used to send standard output of one program to another program,
first program's data will not be displayed on the terminal, only the
second program's data will be displayed.

 Although the functionality of pipe may look similar to that of '>' and
'>>' but has a significance difference. Pipe redirects data from one
program to another while brackets are only used in redirection of
files.
Linux Desktop
Linux I/O Redirection
Example: ls *.txt | cat > txtFile

Look at the above snapshot, command "ls *.txt | cat > txtFile" has put all the '.txt' files
into a newly created file 'txtFile'.
Linux Desktop
Linux I/O Redirection
Linux Input Redirection

< stdin
The bash shell uses stdin to take input. In input redirection, a file is
made input to the command and this redirection is done with the help of
'<' sign.

Look at the above snapshot, command "cat < file.txt" has taken
'file.txt' as input and displayed its content.
Linux Desktop
Linux I/O Redirection
<<< here string
The here string is used to directly pass strings to a command.

Look at the above snapshot, in this example we have used base64


which we'll study later. Command "base64 <<< format.txt" has
decoded file 'format.txt' and then by using command 'base64 -d' we got
back our file 'format.txt'.
Linux Desktop
Linux I/O Redirection
<< here document
 The here document (sometimes also called here-is-document) is a way in
which you can enter input until a certain sequence (usually EOF) is typed.
 The EOF (End Of File) can be typed or can be called by pressing (ctrl + d)
keys.
 Any word can be used in place of 'EOF' like we have used 'last’.

Look at the above snapshot, in first example, 'file.txt' is ended when we


typed 'EOF' and 'last' in second example.
Linux Desktop
Linux I/O Redirection
Linux Output Redirection

> stdout
The stdout is redirected with a '>' greater than sign. When shell meets
the '>' sign, it will clear the file (as you already know).

Look at the above snapshot, greater than sign '>' redirects the
command 'echo' output into a file 'afile.txt'.
Linux Desktop
Linux I/O Redirection
Output File Is Erased

In output redirection, during scanning of a command line, shell


will encounter through '>' sign and will clear the file.

Look at the above snapshot, command "zcho Welcome > afile.txt" is


wrong but still file 'afile.txt' is cleared.
Linux Desktop
Linux I/O Redirection
noclobber
We can prevent file deletion while using '>' sign with the help of
noclobber option.

 Look at the above snapshot, command "set -o noclobber" prevents


file from getting overwrite.
 But command "set +o noclobber" allows you to overwrite the
existing file.
Linux Desktop
Linux I/O Redirection
Overruling noclobber

 Overruling noclobber means you can overwrite an existing file while


noclobber is set by using '>|' sign.

 Look at the above snapshot, with greater than '>' sign, bash doesn't
allow to overwrite the file 'newfile.txt'. But with '>|' sign file is
overwritten.
Linux Desktop
Linux I/O Redirection
>>append

Append '>>' sign doesn't let the file content to be overwritten and hence,
displays new as well as old file content.

Look at the above snapshot, file 'newfile.txt' is not overwritten with append
command. New content is displyed with the old one.
Linux Desktop
Linux I/O Redirection
Linux Error Redirection
2> stderr
Command '2>' redirects the error of an output.It helps us you to keep our
display less messy by redirecting error messages.

By using command "zcho hyii 2> /dev/null" (here echo command is wrong),
we didn't get any error message. But when we use command "zcho
hyii" error message is displayed in the terminal. Hence, '2>' redirects the error
message in the mentioned directory keeping your terminal error message free.
Linux Desktop
Linux I/O Redirection
2>&1

This command helps in redirecting the stdout and stderr in the same file.

Look at the above snapshot, 'abc.txt and error.txt' is directing to the same file
'newfile.txt’.

If you'll write: ls > dirlist 2>&1


 Then, stdout and stderr both will be directed to the file dirlist.

But if you'll write: ls 2>&1 > dirlist


 Then, only stdout will be redirected to dirlist. This is because, before the
stdout is redirected to dirlist, stderr has made a copy of stdout.
Linux Desktop

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy