SlideShare ist ein Scribd-Unternehmen logo
1 von 26
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

Weitere ähnliche Inhalte

Ähnlich wie Using Unix Commands.pptx

Ähnlich wie Using Unix Commands.pptx (20)

IntroCommandLine.ppt
IntroCommandLine.pptIntroCommandLine.ppt
IntroCommandLine.ppt
 
IntroCommandLine.ppt
IntroCommandLine.pptIntroCommandLine.ppt
IntroCommandLine.ppt
 
Unix lab manual
Unix lab manualUnix lab manual
Unix lab manual
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux
LinuxLinux
Linux
 
58518522 study-aix
58518522 study-aix58518522 study-aix
58518522 study-aix
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
 
Linux Cheat Sheet.pdf
Linux Cheat Sheet.pdfLinux Cheat Sheet.pdf
Linux Cheat Sheet.pdf
 
Sudo
SudoSudo
Sudo
 
60761 linux
60761 linux60761 linux
60761 linux
 
Linux
LinuxLinux
Linux
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Red hat linux essentials
Red hat linux essentialsRed hat linux essentials
Red hat linux essentials
 
Linux
LinuxLinux
Linux
 
Managing Processes in Unix.pptx
Managing Processes in Unix.pptxManaging Processes in Unix.pptx
Managing Processes in Unix.pptx
 
Managing Processes in Unix.pptx
Managing Processes in Unix.pptxManaging Processes in Unix.pptx
Managing Processes in Unix.pptx
 
Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
 
Unix_Introduction_BCA.pptx the very basi
Unix_Introduction_BCA.pptx the very basiUnix_Introduction_BCA.pptx the very basi
Unix_Introduction_BCA.pptx the very basi
 

Mehr von Harsha Patel

Introduction to Reinforcement Learning.pptx
Introduction to Reinforcement Learning.pptxIntroduction to Reinforcement Learning.pptx
Introduction to Reinforcement Learning.pptxHarsha Patel
 
Introduction to Association Rules.pptx
Introduction  to  Association  Rules.pptxIntroduction  to  Association  Rules.pptx
Introduction to Association Rules.pptxHarsha Patel
 
Introduction to Clustering . pptx
Introduction    to     Clustering . pptxIntroduction    to     Clustering . pptx
Introduction to Clustering . pptxHarsha Patel
 
Introduction to Classification . pptx
Introduction  to   Classification . pptxIntroduction  to   Classification . pptx
Introduction to Classification . pptxHarsha Patel
 
Introduction to Regression . pptx
Introduction     to    Regression . pptxIntroduction     to    Regression . pptx
Introduction to Regression . pptxHarsha Patel
 
Intro of Machine Learning Models .pptx
Intro of Machine  Learning  Models .pptxIntro of Machine  Learning  Models .pptx
Intro of Machine Learning Models .pptxHarsha Patel
 
Introduction to Machine Learning.pptx
Introduction  to  Machine  Learning.pptxIntroduction  to  Machine  Learning.pptx
Introduction to Machine Learning.pptxHarsha Patel
 
Unit-V-Introduction to Data Mining.pptx
Unit-V-Introduction to  Data Mining.pptxUnit-V-Introduction to  Data Mining.pptx
Unit-V-Introduction to Data Mining.pptxHarsha Patel
 
Unit-IV-Introduction to Data Warehousing .pptx
Unit-IV-Introduction to Data Warehousing .pptxUnit-IV-Introduction to Data Warehousing .pptx
Unit-IV-Introduction to Data Warehousing .pptxHarsha Patel
 
Unit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution'sUnit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution'sHarsha Patel
 
Unit-II-Introduction of Artifiial Intelligence.pptx
Unit-II-Introduction of Artifiial Intelligence.pptxUnit-II-Introduction of Artifiial Intelligence.pptx
Unit-II-Introduction of Artifiial Intelligence.pptxHarsha Patel
 
Unit-I-Introduction to Recent Trends.pptx
Unit-I-Introduction to Recent Trends.pptxUnit-I-Introduction to Recent Trends.pptx
Unit-I-Introduction to Recent Trends.pptxHarsha Patel
 
Using Vi Editor.pptx
Using Vi Editor.pptxUsing Vi Editor.pptx
Using Vi Editor.pptxHarsha Patel
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptxHarsha Patel
 
Introduction to Unix Concets.pptx
Introduction to Unix Concets.pptxIntroduction to Unix Concets.pptx
Introduction to Unix Concets.pptxHarsha Patel
 
Handling Files Under Unix.pptx
Handling Files Under Unix.pptxHandling Files Under Unix.pptx
Handling Files Under Unix.pptxHarsha Patel
 
Introduction to OS.pptx
Introduction to OS.pptxIntroduction to OS.pptx
Introduction to OS.pptxHarsha Patel
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptxHarsha Patel
 
Introduction to Unix Concets.pptx
Introduction to Unix Concets.pptxIntroduction to Unix Concets.pptx
Introduction to Unix Concets.pptxHarsha Patel
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptxHarsha Patel
 

Mehr von Harsha Patel (20)

Introduction to Reinforcement Learning.pptx
Introduction to Reinforcement Learning.pptxIntroduction to Reinforcement Learning.pptx
Introduction to Reinforcement Learning.pptx
 
Introduction to Association Rules.pptx
Introduction  to  Association  Rules.pptxIntroduction  to  Association  Rules.pptx
Introduction to Association Rules.pptx
 
Introduction to Clustering . pptx
Introduction    to     Clustering . pptxIntroduction    to     Clustering . pptx
Introduction to Clustering . pptx
 
Introduction to Classification . pptx
Introduction  to   Classification . pptxIntroduction  to   Classification . pptx
Introduction to Classification . pptx
 
Introduction to Regression . pptx
Introduction     to    Regression . pptxIntroduction     to    Regression . pptx
Introduction to Regression . pptx
 
Intro of Machine Learning Models .pptx
Intro of Machine  Learning  Models .pptxIntro of Machine  Learning  Models .pptx
Intro of Machine Learning Models .pptx
 
Introduction to Machine Learning.pptx
Introduction  to  Machine  Learning.pptxIntroduction  to  Machine  Learning.pptx
Introduction to Machine Learning.pptx
 
Unit-V-Introduction to Data Mining.pptx
Unit-V-Introduction to  Data Mining.pptxUnit-V-Introduction to  Data Mining.pptx
Unit-V-Introduction to Data Mining.pptx
 
Unit-IV-Introduction to Data Warehousing .pptx
Unit-IV-Introduction to Data Warehousing .pptxUnit-IV-Introduction to Data Warehousing .pptx
Unit-IV-Introduction to Data Warehousing .pptx
 
Unit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution'sUnit-III-AI Search Techniques and solution's
Unit-III-AI Search Techniques and solution's
 
Unit-II-Introduction of Artifiial Intelligence.pptx
Unit-II-Introduction of Artifiial Intelligence.pptxUnit-II-Introduction of Artifiial Intelligence.pptx
Unit-II-Introduction of Artifiial Intelligence.pptx
 
Unit-I-Introduction to Recent Trends.pptx
Unit-I-Introduction to Recent Trends.pptxUnit-I-Introduction to Recent Trends.pptx
Unit-I-Introduction to Recent Trends.pptx
 
Using Vi Editor.pptx
Using Vi Editor.pptxUsing Vi Editor.pptx
Using Vi Editor.pptx
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 
Introduction to Unix Concets.pptx
Introduction to Unix Concets.pptxIntroduction to Unix Concets.pptx
Introduction to Unix Concets.pptx
 
Handling Files Under Unix.pptx
Handling Files Under Unix.pptxHandling Files Under Unix.pptx
Handling Files Under Unix.pptx
 
Introduction to OS.pptx
Introduction to OS.pptxIntroduction to OS.pptx
Introduction to OS.pptx
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptx
 
Introduction to Unix Concets.pptx
Introduction to Unix Concets.pptxIntroduction to Unix Concets.pptx
Introduction to Unix Concets.pptx
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 

Kürzlich hochgeladen

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Kürzlich hochgeladen (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

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