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

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
 

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
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PDF
Bridging CAD, IBM TRIRIGA & GIS with FME: The Portland Public Schools Case
Safe Software
 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
PDF
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
PDF
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Bridging CAD, IBM TRIRIGA & GIS with FME: The Portland Public Schools Case
Safe Software
 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
Ad

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