SlideShare a Scribd company logo
Using Unix Commands
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
A process means program in execution. It generally takes an input, processes
it and gives us the appropriate output. Check Introduction to Process
Management for more details about a process. There are basically 2 types of
processes.
1.Foreground processes: Such kind of processes are also known
as interactive processes. These are the processes which are to be executed or
initiated by the user or the programmer, they can not be initialized by system
services. Such processes take input from the user and return the output. While
these processes are running we can not directly initiate a new process from the
same terminal.
2.Background processes: Such kind of processes are also known as non
interactive processes. These are the processes that are to be executed or
initiated by the system itself or by users, though they can even be managed by
users. These processes have a unique PID or process if assigned to them and we
can initiate other processes within the same terminal from which they are
initiated.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
External Commands : Commands which aren’t built into the shell.
When an external command has to be executed, the shell looks for its
path given in the PATH variable, and also a new process has to be
spawned and the command gets executed. They are usually located in
/bin or /usr/bin. For example, when you execute the “cat” command,
which usually is at /usr/bin, the executable /usr/bin/cat gets executed.
Examples: ls, cat etc.
The type command: The type command is used to describe how its
argument would be translated if used as commands. It is also used to
find out whether it is built-in or external binary file.
Syntax: type [Options] command names
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Example:
Options:
-a : This option is used to find out whether it is an alias, keyword or a function
and it also displays the path of an executable, if available.
Example: type -a pwd
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
-t : This option will display a single word as an output.
 alias – if command is a shell alias
 keyword – if command is a shell reserved word
 builtin – if command is a shell builtin
 function – if command is a shell function
 file – if command is a disk file
Example:
type -t pwd type -t cp type -t ls type -t while
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
-p : This option displays the name of the disk file which would be
executed by the shell. It will return nothing if the command is not a disk
file.
Example: type -p dash
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
The man command: man command in Linux is used to display the user
manual of any command that we can run on the terminal. It provides a detailed
view of the command which includes NAME, SYNOPSIS, DESCRIPTION,
OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS,
EXAMPLES, AUTHORS and SEE ALSO.
Every manual is divided into the following sections:
 Executable programs or shell commands
 System calls (functions provided by the kernel)
 Library calls (functions within program libraries
 Games
 Special files (usually found in /dev)
 File formats and conventions eg /etc/passwd
 Miscellaneous (including macro packages and conventions), e.g. groff(7)
 System administration commands (usually only for root)
 Kernel routines [Non standard]
Syntax : $man [OPTION]... [COMMAND NAME]...
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Options and Examples:
1.No Option: It displays the whole manual of the command.
 Syntax : $ man [COMMAND NAME]
 Example: $ man printf
 Output:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
In this example, manual pages of the command ‘printf‘ are simply returned.
2. Section-num: Since a manual is divided into multiple sections so this option is
used to display only a specific section of a manual.
 Syntax : $ man [SECTION-NUM] [COMMAND NAME]
 Example: $ man 2 intro
 Output:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
In this example, the manual pages of command ‘intro‘ are returned which lies in
the section 2.
3. -f option: One may not be able to remember the sections in which a command
is present. So this option gives the section in which the given command is present.
 Syntax: $ man -f [COMMAND NAME]
 Example: $ man -f ls
 Output:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
In this example, the command ‘ls‘ is returned with its section number.
4. -a option: This option helps us to display all the available intro manual pages
in succession.
 Syntax: $ man -a [COMMAND NAME]
 Example: $ man -a intro
 Output:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
In this example you can move through the manual pages(sections) i.e either
reading(by pressing Enter) or skipping(by pressing ctrl+D) or exiting(by pressing
ctrl+C).
5. -k option: This option searches the given command as a regular expression in
all the manuals and it returns the manual pages with the section number in which
it is found.
 Syntax: $ man -k [COMMAND NAME]
 Example: $ man -k cd
 Output:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
The command ‘cd‘ is searched in all the manual pages by considering it as a
regular expression.
6. -w option: This option returns the location in which the manual page of a
given command is present.
 Syntax: $ man -w [COMMAND NAME]
 Example: $ man -w ls
 Output:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
The location of command ‘ls‘ is returned.
7. -I option: It considers the command as case sensitive.
 Syntax: $ man -I [COMMAND NAME]
 Example: $ man -I printf
 Output:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
The command ‘printf‘ is taken as case-sensitive i.e ‘printf‘ returns the manual
pages but ‘Printf‘ gives error.
User terminal:
 A Unix Terminal is really just a way to pump characters into a /dev/tty device
and read characters and control characters from the same device. A terminal by
itself does not offer
 To be able to parse user input, interpret that input as commands to run and
display results, we need a Unix Shell. The Shell manages things like prompt,
where you write your commands much functionality.
 A terminal (also called TeleTYpewriter (_tty_)) is an interface to the
underlying OS, which is connected to a server. Some terminals are
provided by the kernel on behalf of a hardware device, with the input coming
from the keyboard and the output going to a text mode screen.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
The root login:-Root is the superuser account in Unix and Linux. It is a user
account for administrative purposes, and typically has the highest access rights on
the system.
Usually, the root user account is called root. However, in Unix and Linux, any
account with user id 0 is a root account, regardless of the name. It is fairly
common for certain system administrators to have their own root accounts on a
system, with their own passwords.
Root is the superuser account in Unix and Linux. It is a user account for
administrative purposes, and typically has the highest access rights on the system.
Usually, the root user account is called root . However, in Unix and Linux, any
account with user id 0 is a root account, regardless of the name.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
The root is the super-user account on Linux-based operating systems. The root
user has all the rights that are necessary to perform administrative tasks or access
some files, execute privileged commands, and much more. The root user is also
referred to as a superuser or root.
In Linux, you can run privileged commands using the sudo keyword. However,
sometimes it becomes a tedious act when you are doing administrative tasks and
each command requires root privileges. To get rid of such a situation, become a
root user and then execute commands.
su command: The su command allows you to switch the user to someone else
by providing its username. However, if the name is not specified,
the su command would allow you to execute the commands with root privileges.
The su command allows you to run a shell as another user.
 Syntax : su <username>
 Example : su jtp
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
user account is changed from sssit to jtp
su to root
You can change the user to root when you know the root password.
Syntax : su root
su as root
The root user can become any existing user without knowing that
user's password. Otherwise, password is needed.
Example : su - sssit
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Look at the above snapshot, it is asking for password while switching
from user jtp to sssit.
Now let's look at the following example.
Example : su - jtp
Look at the above snapshot, we are at user root. While switching from
root to jtp it didn't ask for password and we're successfully arrived at
user jtp.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Authentication with /etc/passwd and /etc/shadow
 In older Linux systems, user information, including passwords and usernames,
are kept in a system file called /etc/passwd. This plaintext database is used to
keep track of every user on the Linux system. The file is owned by the root and
can only be modified by root or users with sudo privileges, although it is
readable by all system users.
 Each user's password is stored in an encrypted form within the /etc/passwd
file. These credentials are hashed using a one-way hash function so they cannot
be decrypted. So, user authentication takes place by comparing the contents of
the /etc/passwd file to the user's encrypted password upon logging in -- after
the password is rehashed with the key or salt.
 If there is a mismatch, the user cannot access the system. However, the reuse of
passwords -- a common problem among users -- and the increasing use
of rainbow tables by threat actors to crack password hashes and gain entry into
Linux systems have made this old system insecure.
 The /etc/shadow file provides an enhanced authentication mechanism for
Linux systems by tightening access at the account level. This text file stores
actual passwords in hashed format, along with additional information related
to these passwords.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Commands to add, modify and delete users.
Add a user in Linux:
 To add users, run the useradd command, like so:
sudo useradd -m <name of the user>
For example, if you want to add the user named john, then the command will be
like:
sudo useradd -m john
 By default, useradd creates a user without creating a home directory. So, to
make useradd create a home folder, we’ve used the -m switch.
 If the command is successful, it won’t have any output, like so:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 Behind the scenes, it automatically creates the user john by assigning a unique
user ID for the user, and adding the user’s details to the /etc/passwd file. It also
creates a home directory for the user under /home (so the full path
is /home/john).
 At this point, the user has been created, but they don’t have a password and
can’t log in. So, to assign a password to the newly created user, run
the passwd command like so:
sudo passwd <username>
The command will ask for the new password, and ask you to confirm it:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 This command adds the user’s password in /etc/shadow in an encrypted
format. After running this command, the new user should be able to login as
usual.
 You can view the new user’s ID by using id -u <username>. In our
case, john was given an ID of 1001:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Thanks !!!
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune

More Related Content

PPTX
Chapter 3 Using Unix Commands
MeenalJabde
 
PDF
Linux advanced privilege escalation
Jameel Nabbo
 
PPT
Linux
sravan kumar
 
PDF
Basics of Linux Commands, Git and Github
Devang Garach
 
PPT
Unix Basics 04sp
Dr.Ravi
 
PPTX
Linux
Srinivas Reddy
 
PPT
Tutorial 2
tech2click
 
PPTX
Learning Linux Series Administrator Commands.pptx
Shashwat Shriparv
 
Chapter 3 Using Unix Commands
MeenalJabde
 
Linux advanced privilege escalation
Jameel Nabbo
 
Basics of Linux Commands, Git and Github
Devang Garach
 
Unix Basics 04sp
Dr.Ravi
 
Tutorial 2
tech2click
 
Learning Linux Series Administrator Commands.pptx
Shashwat Shriparv
 

Similar to Using Unix Commands.pptx (20)

PPT
IntroCommandLine.ppt
GowthamRaju15
 
PPT
IntroCommandLine.ppt
TECHWORLDwithphotoed
 
DOCX
Unix lab manual
Tanzeem Syed
 
PPT
Linux commands
Ajaigururaj R
 
PPT
Linux commands
Hemakumar.S
 
PPT
Linux commands
Hemakumar.S
 
PPTX
Linux
Srinivas Reddy
 
DOC
58518522 study-aix
homeworkping3
 
PPTX
Chapter 2 Introduction to Unix Concepts
MeenalJabde
 
PDF
Linux Cheat Sheet.pdf
roschahacker
 
DOC
Sudo
Hemakumar.S
 
PPT
commands and_ in _shell presentation.ppt
Serah48
 
PDF
60761 linux
Ritika Ahlawat
 
PPT
Linux
SINGH PROJECTS
 
PPT
Linux filesystemhierarchy
Dr. C.V. Suresh Babu
 
PPTX
Red hat linux essentials
Haitham Raik
 
PPTX
OS-Module 2 Linux Programming Important topics
JithinS34
 
PPT
Linux
Rathan Raj
 
PPTX
Managing Processes in Unix.pptx
Harsha Patil
 
PPTX
Managing Processes in Unix.pptx
Harsha Patil
 
IntroCommandLine.ppt
GowthamRaju15
 
IntroCommandLine.ppt
TECHWORLDwithphotoed
 
Unix lab manual
Tanzeem Syed
 
Linux commands
Ajaigururaj R
 
Linux commands
Hemakumar.S
 
Linux commands
Hemakumar.S
 
58518522 study-aix
homeworkping3
 
Chapter 2 Introduction to Unix Concepts
MeenalJabde
 
Linux Cheat Sheet.pdf
roschahacker
 
commands and_ in _shell presentation.ppt
Serah48
 
60761 linux
Ritika Ahlawat
 
Linux filesystemhierarchy
Dr. C.V. Suresh Babu
 
Red hat linux essentials
Haitham Raik
 
OS-Module 2 Linux Programming Important topics
JithinS34
 
Linux
Rathan Raj
 
Managing Processes in Unix.pptx
Harsha Patil
 
Managing Processes in Unix.pptx
Harsha Patil
 
Ad

More from Harsha Patil (20)

PDF
Unit 5-Introduction of GUI Programming-Part2.pdf
Harsha Patil
 
PDF
Unit 3-Classes ,Objects and Inheritance.pdf
Harsha Patil
 
PDF
Unit 6-Introduction of Python Libraries.pdf
Harsha Patil
 
PDF
Unit 5-Introduction of GUI Programming-Part1.pdf
Harsha Patil
 
PDF
Unit-2 Introduction of Modules and Packages.pdf
Harsha Patil
 
PDF
Unit 4-Exception Handling in Python.pdf
Harsha Patil
 
PDF
Unit 1-Part-4-Lists, tuples and dictionaries.pdf
Harsha Patil
 
PDF
Unit 1-Part-1-Introduction to Python.pdf
Harsha Patil
 
PDF
Unit 1-Part-5-Functions and Set Operations.pdf
Harsha Patil
 
PDF
Unit 1-Part-3 - String Manipulation.pdf
Harsha Patil
 
PDF
Unit 1- Part-2-Control and Loop Statements.pdf
Harsha Patil
 
PPTX
Introduction to Reinforcement Learning.pptx
Harsha Patil
 
PPTX
Introduction to Association Rules.pptx
Harsha Patil
 
PPTX
Introduction to Clustering . pptx
Harsha Patil
 
PPTX
Introduction to Classification . pptx
Harsha Patil
 
PPTX
Introduction to Regression . pptx
Harsha Patil
 
PPTX
Intro of Machine Learning Models .pptx
Harsha Patil
 
PPTX
Introduction to Machine Learning.pptx
Harsha Patil
 
PPTX
Unit-V-Introduction to Data Mining.pptx
Harsha Patil
 
PPTX
Unit-IV-Introduction to Data Warehousing .pptx
Harsha Patil
 
Unit 5-Introduction of GUI Programming-Part2.pdf
Harsha Patil
 
Unit 3-Classes ,Objects and Inheritance.pdf
Harsha Patil
 
Unit 6-Introduction of Python Libraries.pdf
Harsha Patil
 
Unit 5-Introduction of GUI Programming-Part1.pdf
Harsha Patil
 
Unit-2 Introduction of Modules and Packages.pdf
Harsha Patil
 
Unit 4-Exception Handling in Python.pdf
Harsha Patil
 
Unit 1-Part-4-Lists, tuples and dictionaries.pdf
Harsha Patil
 
Unit 1-Part-1-Introduction to Python.pdf
Harsha Patil
 
Unit 1-Part-5-Functions and Set Operations.pdf
Harsha Patil
 
Unit 1-Part-3 - String Manipulation.pdf
Harsha Patil
 
Unit 1- Part-2-Control and Loop Statements.pdf
Harsha Patil
 
Introduction to Reinforcement Learning.pptx
Harsha Patil
 
Introduction to Association Rules.pptx
Harsha Patil
 
Introduction to Clustering . pptx
Harsha Patil
 
Introduction to Classification . pptx
Harsha Patil
 
Introduction to Regression . pptx
Harsha Patil
 
Intro of Machine Learning Models .pptx
Harsha Patil
 
Introduction to Machine Learning.pptx
Harsha Patil
 
Unit-V-Introduction to Data Mining.pptx
Harsha Patil
 
Unit-IV-Introduction to Data Warehousing .pptx
Harsha Patil
 
Ad

Recently uploaded (20)

PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
Strengthening open access through collaboration: building connections with OP...
Jisc
 
PPTX
Introduction and Scope of Bichemistry.pptx
shantiyogi
 
PDF
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
PDF
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
PPTX
Understanding operators in c language.pptx
auteharshil95
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
RAKESH SAJJAN
 
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
Sourav Kr Podder
 
PDF
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PDF
Electricity-Magnetic-and-Heating-Effects 4th Chapter/8th-science-curiosity.pd...
Sandeep Swamy
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PDF
High Ground Student Revision Booklet Preview
jpinnuck
 
PDF
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
Sandeep Swamy
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
PPTX
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Strengthening open access through collaboration: building connections with OP...
Jisc
 
Introduction and Scope of Bichemistry.pptx
shantiyogi
 
1.Natural-Resources-and-Their-Use.ppt pdf /8th class social science Exploring...
Sandeep Swamy
 
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
Understanding operators in c language.pptx
auteharshil95
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
RAKESH SAJJAN
 
Open Quiz Monsoon Mind Game Prelims.pptx
Sourav Kr Podder
 
The Picture of Dorian Gray summary and depiction
opaliyahemel
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
Electricity-Magnetic-and-Heating-Effects 4th Chapter/8th-science-curiosity.pd...
Sandeep Swamy
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
High Ground Student Revision Booklet Preview
jpinnuck
 
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
Sandeep Swamy
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 

Using Unix Commands.pptx

  • 1. Using Unix Commands Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 2. A process means program in execution. It generally takes an input, processes it and gives us the appropriate output. Check Introduction to Process Management for more details about a process. There are basically 2 types of processes. 1.Foreground processes: Such kind of processes are also known as interactive processes. These are the processes which are to be executed or initiated by the user or the programmer, they can not be initialized by system services. Such processes take input from the user and return the output. While these processes are running we can not directly initiate a new process from the same terminal. 2.Background processes: Such kind of processes are also known as non interactive processes. These are the processes that are to be executed or initiated by the system itself or by users, though they can even be managed by users. These processes have a unique PID or process if assigned to them and we can initiate other processes within the same terminal from which they are initiated. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 3. External Commands : Commands which aren’t built into the shell. When an external command has to be executed, the shell looks for its path given in the PATH variable, and also a new process has to be spawned and the command gets executed. They are usually located in /bin or /usr/bin. For example, when you execute the “cat” command, which usually is at /usr/bin, the executable /usr/bin/cat gets executed. Examples: ls, cat etc. The type command: The type command is used to describe how its argument would be translated if used as commands. It is also used to find out whether it is built-in or external binary file. Syntax: type [Options] command names Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 4. Example: Options: -a : This option is used to find out whether it is an alias, keyword or a function and it also displays the path of an executable, if available. Example: type -a pwd Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 5. -t : This option will display a single word as an output.  alias – if command is a shell alias  keyword – if command is a shell reserved word  builtin – if command is a shell builtin  function – if command is a shell function  file – if command is a disk file Example: type -t pwd type -t cp type -t ls type -t while Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 6. -p : This option displays the name of the disk file which would be executed by the shell. It will return nothing if the command is not a disk file. Example: type -p dash Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 7. The man command: man command in Linux is used to display the user manual of any command that we can run on the terminal. It provides a detailed view of the command which includes NAME, SYNOPSIS, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES, AUTHORS and SEE ALSO. Every manual is divided into the following sections:  Executable programs or shell commands  System calls (functions provided by the kernel)  Library calls (functions within program libraries  Games  Special files (usually found in /dev)  File formats and conventions eg /etc/passwd  Miscellaneous (including macro packages and conventions), e.g. groff(7)  System administration commands (usually only for root)  Kernel routines [Non standard] Syntax : $man [OPTION]... [COMMAND NAME]... Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 8. Options and Examples: 1.No Option: It displays the whole manual of the command.  Syntax : $ man [COMMAND NAME]  Example: $ man printf  Output: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 9. In this example, manual pages of the command ‘printf‘ are simply returned. 2. Section-num: Since a manual is divided into multiple sections so this option is used to display only a specific section of a manual.  Syntax : $ man [SECTION-NUM] [COMMAND NAME]  Example: $ man 2 intro  Output: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 10. In this example, the manual pages of command ‘intro‘ are returned which lies in the section 2. 3. -f option: One may not be able to remember the sections in which a command is present. So this option gives the section in which the given command is present.  Syntax: $ man -f [COMMAND NAME]  Example: $ man -f ls  Output: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 11. In this example, the command ‘ls‘ is returned with its section number. 4. -a option: This option helps us to display all the available intro manual pages in succession.  Syntax: $ man -a [COMMAND NAME]  Example: $ man -a intro  Output: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 12. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 13. In this example you can move through the manual pages(sections) i.e either reading(by pressing Enter) or skipping(by pressing ctrl+D) or exiting(by pressing ctrl+C). 5. -k option: This option searches the given command as a regular expression in all the manuals and it returns the manual pages with the section number in which it is found.  Syntax: $ man -k [COMMAND NAME]  Example: $ man -k cd  Output: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 14. The command ‘cd‘ is searched in all the manual pages by considering it as a regular expression. 6. -w option: This option returns the location in which the manual page of a given command is present.  Syntax: $ man -w [COMMAND NAME]  Example: $ man -w ls  Output: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 15. The location of command ‘ls‘ is returned. 7. -I option: It considers the command as case sensitive.  Syntax: $ man -I [COMMAND NAME]  Example: $ man -I printf  Output: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 16. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 17. The command ‘printf‘ is taken as case-sensitive i.e ‘printf‘ returns the manual pages but ‘Printf‘ gives error. User terminal:  A Unix Terminal is really just a way to pump characters into a /dev/tty device and read characters and control characters from the same device. A terminal by itself does not offer  To be able to parse user input, interpret that input as commands to run and display results, we need a Unix Shell. The Shell manages things like prompt, where you write your commands much functionality.  A terminal (also called TeleTYpewriter (_tty_)) is an interface to the underlying OS, which is connected to a server. Some terminals are provided by the kernel on behalf of a hardware device, with the input coming from the keyboard and the output going to a text mode screen. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 18. The root login:-Root is the superuser account in Unix and Linux. It is a user account for administrative purposes, and typically has the highest access rights on the system. Usually, the root user account is called root. However, in Unix and Linux, any account with user id 0 is a root account, regardless of the name. It is fairly common for certain system administrators to have their own root accounts on a system, with their own passwords. Root is the superuser account in Unix and Linux. It is a user account for administrative purposes, and typically has the highest access rights on the system. Usually, the root user account is called root . However, in Unix and Linux, any account with user id 0 is a root account, regardless of the name. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 19. The root is the super-user account on Linux-based operating systems. The root user has all the rights that are necessary to perform administrative tasks or access some files, execute privileged commands, and much more. The root user is also referred to as a superuser or root. In Linux, you can run privileged commands using the sudo keyword. However, sometimes it becomes a tedious act when you are doing administrative tasks and each command requires root privileges. To get rid of such a situation, become a root user and then execute commands. su command: The su command allows you to switch the user to someone else by providing its username. However, if the name is not specified, the su command would allow you to execute the commands with root privileges. The su command allows you to run a shell as another user.  Syntax : su <username>  Example : su jtp Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 20. user account is changed from sssit to jtp su to root You can change the user to root when you know the root password. Syntax : su root su as root The root user can become any existing user without knowing that user's password. Otherwise, password is needed. Example : su - sssit Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 21. Look at the above snapshot, it is asking for password while switching from user jtp to sssit. Now let's look at the following example. Example : su - jtp Look at the above snapshot, we are at user root. While switching from root to jtp it didn't ask for password and we're successfully arrived at user jtp. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 22. Authentication with /etc/passwd and /etc/shadow  In older Linux systems, user information, including passwords and usernames, are kept in a system file called /etc/passwd. This plaintext database is used to keep track of every user on the Linux system. The file is owned by the root and can only be modified by root or users with sudo privileges, although it is readable by all system users.  Each user's password is stored in an encrypted form within the /etc/passwd file. These credentials are hashed using a one-way hash function so they cannot be decrypted. So, user authentication takes place by comparing the contents of the /etc/passwd file to the user's encrypted password upon logging in -- after the password is rehashed with the key or salt.  If there is a mismatch, the user cannot access the system. However, the reuse of passwords -- a common problem among users -- and the increasing use of rainbow tables by threat actors to crack password hashes and gain entry into Linux systems have made this old system insecure.  The /etc/shadow file provides an enhanced authentication mechanism for Linux systems by tightening access at the account level. This text file stores actual passwords in hashed format, along with additional information related to these passwords. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 23. Commands to add, modify and delete users. Add a user in Linux:  To add users, run the useradd command, like so: sudo useradd -m <name of the user> For example, if you want to add the user named john, then the command will be like: sudo useradd -m john  By default, useradd creates a user without creating a home directory. So, to make useradd create a home folder, we’ve used the -m switch.  If the command is successful, it won’t have any output, like so: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 24.  Behind the scenes, it automatically creates the user john by assigning a unique user ID for the user, and adding the user’s details to the /etc/passwd file. It also creates a home directory for the user under /home (so the full path is /home/john).  At this point, the user has been created, but they don’t have a password and can’t log in. So, to assign a password to the newly created user, run the passwd command like so: sudo passwd <username> The command will ask for the new password, and ask you to confirm it: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 25.  This command adds the user’s password in /etc/shadow in an encrypted format. After running this command, the new user should be able to login as usual.  You can view the new user’s ID by using id -u <username>. In our case, john was given an ID of 1001: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 26. Thanks !!! Mrs.Harsha V Patil, MIT ACSC Alandi , Pune