Linux Desktop
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.
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.
Insert the Disk Or USB drive into the system and turn on
your machine.
Select Language
Click on continue
Click on Continue
Click on continue
Linux Desktop
Linux Installation
Click on continue
Linux Desktop
Linux Installation
Click on continue
Linux Desktop
Linux Installation
Installation is in proogress
Linux Desktop
Linux Installation
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 on Add
Linux Desktop
Create User in Linux (Ubuntu)
User Info: It allows us to define some additional information about the user,
such as user full name. It is optional.
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.
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.
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.
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.
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:
It manages the file name, file size, creation date, and much
more information about a file.
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.
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.
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.
> 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
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’.