SlideShare a Scribd company logo
1 of 33
Download to read offline
L2B Linux First Course



S ession2


             Please visit our Facebook Group
L2B First Linux Course
L2B Linux course


     Session Outlines:
      Linux principles
      Bash Basics
      Users, Groups and Permissions
      Introduction to Bash Scripts
L2B First Linux Course
L2B Linux course


     Linux Principles
        Every thing is a file including hardware
        Small, single-purpose programs
        Ability to chain programs together to perform
         complex tasks
        Avoid captive user interfaces
        Configuration data stored in text
L2B First Linux Course
L2B Linux course


    Bash Basics
      Shell or bash is an interface between the user
       and the kernel
      Accepts the commands that a user enters,
       interprets these commands, and passes them
       to the kernel
L2B First Linux Course
L2B Linux course


     Bash Basics
       Command format:
           command [option] [argument]
       Option
         • Preceded by - if single character
         • Preceded by - - if more than one character
       Arguments are file names or other data
        needed by the command
L2B First Linux Course
L2B Linux course


     Bash Basics
       Full Path
         • Begins with a forward slash
         • Ends with the file location
       Relative path
         • Begins with your location
         • Ends with the file location
L2B First Linux Course
L2B Linux course


     Bash Basics
       .. refers to the parent directory
       . refers to the current directory
       Directory names is case sensitive
       Names may be up to 255 character
       You can use all characters except the
        forward-slash
L2B First Linux Course
L2B Linux course


     Bash Basics
       Clear :
            • Clear the terminal
         Cal
            • Display the calendar of current year
         cal year
            • Display calendar of this year
         cal month
            • Display calendar of this month
         Date
            • Display current date
L2B First Linux Course
L2B Linux course


     Bash Basics
       eject cdrom
       pwd
       cd
            •   cd ~
            •   cd path
            •   cd ..
            •   cd ../..
            •   cd .
            •   cd -
L2B First Linux Course
L2B Linux course


     Bash Basics
       ls
            •   ls -l
            •   ls -d
            •   ls -h
            •   ls -a
            •   ls -t
            •   ls -r
            •   ls -R
         dir
         tree          not installed by default in Ubuntu
L2B First Linux Course
L2B Linux course

     Bash Basics
       Touch
            • If you touched a file which exists you changes it's
              modification time
         cat & more
         nano file_name
L2B First Linux Course
L2B Linux course


     Bash Basics
       mkdir
            • mkdir -p
         cp
            •   cp -r
            •   cp -R
            •   cp -i
            •   cp -f
L2B First Linux Course
L2B Linux course


     Bash Basics
       rm
            • rm -r
              rm -R
         rmdir
            • rmdir -p
         Hint:
            • To remove a directory which you exists in, move to
              its parent directory or any other directory.
L2B First Linux Course
L2B Linux course


     Bash Basics
       cal
       Switching between users
            • su
            • su -
            • sudo
         Changing password
            • passwd [user_name]
L2B First Linux Course
L2B Linux course


     Bash Basics
       Adding users
            • adduser <user_name>
            • useradd <user_name>
         Removing users
            • userdel <user_name>
L2B First Linux Course
L2B Linux course


     Bash Basics
       Getting help
            •   command --help
            •   whatis    <command>
            •   man     <command>
            •   info   <command>
L2B First Linux Course
L2B Linux course


     Bash Basics
       Getting help
            • --help:
                   – Most commands have the options --help
                   – It prints a usage statement and list of options and
                     what they do
                   – [ any_thing ]    >>> It is optional
                   –       ......     >>> It is list of that thing
                   – < any_thing > >>> It is not optioinal
                   – { x,y,z } >>> At least one of the these things
                   – Options separated by | >>> one of them can be
                     used “or"
L2B First Linux Course
L2B Linux course


     Bash Basics
       Getting help
            • whatis
                   – Short description about the command
                   – Update it's database daily
                      » makewhatis as root
L2B First Linux Course
L2B Linux course


     Bash Basics
       Getting help
            •   man -f
            •   man -k &   apropos
            •   man -w
            •   manpath
L2B First Linux Course
L2B Linux course

     Bash Basics
       Getting help
            • man page format and how to use it
            • man [chapter_number] command
            • man sections/chapters
                   1- user commands
                   2- system calls / functions provided by the kernel
                   3- Library calls
                   4- special files
                   5- configuration files formats
                   6- games
                   7- packages
                   8- administrative commands
L2B First Linux Course
L2B Linux course


     Bash Basics
       Getting help
            • info pages
                   –   More details than man
                   –   Like a web site
                   –   Divided into nodes (*)
                   –   Try >>> (info ls)
L2B First Linux Course
L2B Linux course


     Bash Basics
       Type Tab to complete command lines
       Type Tab to command name
       For an argument, it will complete a file name
       Examples:
         • $ xte<Tab>
         • $ xterm
         • $ ls myf<Tab>
         • $ ls myfile.txt
L2B First Linux Course
L2B Linux course


     Bash Basics
       echo command
       file command
       Virtual consoles
L2B First Linux Course
L2B Linux course


     Bash Basics Exercise
       What man option you will use to search the
        description of every manual page for a
        keyword.
       What man option you will use to search the
        entire text (all of the page) of every manual
        page.
L2B First Linux Course
L2B Linux course


     Bash Basics Exercise
       What is the option added to “ls” command to
        display long list results.
       What is the option added to “ls” command to
        display long list results with human-readable
        descriptions.
L2B First Linux Course
L2B Linux course


     Bash Basics Exercise
       Given the following:
                foo -x | -y [-abcde]      FILENAME
                Which one is right?
            •   foo    -x -y -a file.txt
            •   foo
            •   foo   -y     -abc      file1.txt      file2.txt
            •   foo      -abc file1.txt      file2.txt       file3.txt
L2B First Linux Course
L2B Linux course


     Users, Groups and permissions
       Every user is assigned a unique User ID (UID)
       UID 0 identifies root
       Users' names and UIDs are stored in
        /etc/passwd
       Users are assigned to groups
       Each group is assigned a unique Group ID
        (gid)
       GIDs are stored in /etc/group
L2B First Linux Course
L2B Linux course


     Users, Groups and permissions
       Every file is owned by a UID and a GID
       Permission Types:
            •r
            •w
            •X
         To display permissions of a file use
          ls -l file
L2B First Linux Course
L2B Linux course


     Users, Groups and permissions
       To change access modes:
       chmod [-R] mode file
       Where mode is:
       u,g or o for user, group and other
       + or - for grant or deny
       r, w or x for read, write and execute
       Examples:
            • ugo+r: Grant read access to all
            • o-wx: Deny write and execute to others
L2B First Linux Course
L2B Linux course


     Users, Groups and permissions
       To change access modes:
            • chmod [-R] mode file
         Where mode is:
            • u,g or o for user, group and other
            • + or - for grant or deny
            • r, w or x for read, write and execute
         Examples:
            • ugo+r: Grant read access to all
            • o-wx: Deny write and execute to others
L2B First Linux Course
L2B Linux course


     Users, Groups and permissions
       Uses a three-digit mode number
       first digit specifies owner's permissions
       second digit specifies group permissions
       third digit represents others' permissions
       Permissions are calculated by adding:
            • 4 (for read)
            • 2 (for write)
            • 1 (for execute)
         Example:
            • chmod 640 myfile
L2B First Linux Course
L2B Linux course

     Introduction to Bash Scripts
         What is a script?
         sc extension recommended
         Steps to create a script
           • Step 1: Use such as vi or nano to create a text file
             containing commands:
                   – #!/bin/bash
                   – Comments start with a #
                   – Write your commands.
            • Step 2: Make the script executable:
                   – $ chmod u+x myscript.sh
            • Step 3: To execute the new script:
                   – Use relative path or full path
For More info Please Visit Our Facebook Group

More Related Content

What's hot

Linux week 2
Linux week 2Linux week 2
Linux week 2Vinoth Sn
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Scriptsbmguys
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Wave Digitech
 
Unix _linux_fundamentals_for_hpc-_b
Unix  _linux_fundamentals_for_hpc-_bUnix  _linux_fundamentals_for_hpc-_b
Unix _linux_fundamentals_for_hpc-_bMohammad Reza Beygi
 
Linux: Everyting-as-a-service
Linux: Everyting-as-a-serviceLinux: Everyting-as-a-service
Linux: Everyting-as-a-serviceRohit Sansiya
 
Linux presentation
Linux presentationLinux presentation
Linux presentationNikhil Jain
 
Linux powerpoint
Linux powerpointLinux powerpoint
Linux powerpointbijanshr
 
Course 102: Lecture 28: Virtual FileSystems
Course 102: Lecture 28: Virtual FileSystems Course 102: Lecture 28: Virtual FileSystems
Course 102: Lecture 28: Virtual FileSystems Ahmed El-Arabawy
 
Linux admin interview questions
Linux admin interview questionsLinux admin interview questions
Linux admin interview questionsKavya Sri
 
Linux basics part 1
Linux basics part 1Linux basics part 1
Linux basics part 1Lilesh Pathe
 
Linux beginner's Workshop
Linux beginner's WorkshopLinux beginner's Workshop
Linux beginner's Workshopfutureshocked
 
Linux Interview Questions Quiz
Linux Interview Questions QuizLinux Interview Questions Quiz
Linux Interview Questions QuizUtkarsh Sengar
 

What's hot (20)

Linux week 2
Linux week 2Linux week 2
Linux week 2
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Script
 
Linux commands
Linux commandsLinux commands
Linux commands
 
cisco
ciscocisco
cisco
 
3. intro
3. intro3. intro
3. intro
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Linux
LinuxLinux
Linux
 
Unix _linux_fundamentals_for_hpc-_b
Unix  _linux_fundamentals_for_hpc-_bUnix  _linux_fundamentals_for_hpc-_b
Unix _linux_fundamentals_for_hpc-_b
 
Linux: Everyting-as-a-service
Linux: Everyting-as-a-serviceLinux: Everyting-as-a-service
Linux: Everyting-as-a-service
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Linux powerpoint
Linux powerpointLinux powerpoint
Linux powerpoint
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Course 102: Lecture 28: Virtual FileSystems
Course 102: Lecture 28: Virtual FileSystems Course 102: Lecture 28: Virtual FileSystems
Course 102: Lecture 28: Virtual FileSystems
 
Linux
LinuxLinux
Linux
 
Linux admin interview questions
Linux admin interview questionsLinux admin interview questions
Linux admin interview questions
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux basics part 1
Linux basics part 1Linux basics part 1
Linux basics part 1
 
Linux beginner's Workshop
Linux beginner's WorkshopLinux beginner's Workshop
Linux beginner's Workshop
 
Linux Interview Questions Quiz
Linux Interview Questions QuizLinux Interview Questions Quiz
Linux Interview Questions Quiz
 

Similar to Session2 (20)

001 linux revision
001 linux revision001 linux revision
001 linux revision
 
LINUX_admin_commands.pptx
LINUX_admin_commands.pptxLINUX_admin_commands.pptx
LINUX_admin_commands.pptx
 
Presentation for RHCE in linux
Presentation  for  RHCE in linux Presentation  for  RHCE in linux
Presentation for RHCE in linux
 
Class 2
Class   2Class   2
Class 2
 
Linux again
Linux againLinux again
Linux again
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
LinuxCommands (1).pdf
LinuxCommands (1).pdfLinuxCommands (1).pdf
LinuxCommands (1).pdf
 
Linux CLI
Linux CLILinux CLI
Linux CLI
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux Fundamental
Linux FundamentalLinux Fundamental
Linux Fundamental
 
Ch3 gnu make
Ch3 gnu makeCh3 gnu make
Ch3 gnu make
 
ITCP PRACTICAL-1.pptx
ITCP PRACTICAL-1.pptxITCP PRACTICAL-1.pptx
ITCP PRACTICAL-1.pptx
 
proj2-the UNIX SYSTEM.ppt
proj2-the UNIX SYSTEM.pptproj2-the UNIX SYSTEM.ppt
proj2-the UNIX SYSTEM.ppt
 
Hands On: Linux survival skills
Hands On: Linux survival skillsHands On: Linux survival skills
Hands On: Linux survival skills
 
Linux Fundamentals
Linux FundamentalsLinux Fundamentals
Linux Fundamentals
 
Linux Day2
Linux Day2Linux Day2
Linux Day2
 
Operating Systems: Linux in Detail
Operating Systems: Linux in DetailOperating Systems: Linux in Detail
Operating Systems: Linux in Detail
 
The Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows AdminsThe Ultimate IBM and Lotus on Linux Workshop for Windows Admins
The Ultimate IBM and Lotus on Linux Workshop for Windows Admins
 
Linux1
Linux1Linux1
Linux1
 

Recently uploaded

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 

Recently uploaded (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 

Session2

  • 1. L2B Linux First Course S ession2 Please visit our Facebook Group
  • 2. L2B First Linux Course L2B Linux course Session Outlines:  Linux principles  Bash Basics  Users, Groups and Permissions  Introduction to Bash Scripts
  • 3. L2B First Linux Course L2B Linux course  Linux Principles  Every thing is a file including hardware  Small, single-purpose programs  Ability to chain programs together to perform complex tasks  Avoid captive user interfaces  Configuration data stored in text
  • 4. L2B First Linux Course L2B Linux course  Bash Basics  Shell or bash is an interface between the user and the kernel  Accepts the commands that a user enters, interprets these commands, and passes them to the kernel
  • 5. L2B First Linux Course L2B Linux course  Bash Basics  Command format: command [option] [argument]  Option • Preceded by - if single character • Preceded by - - if more than one character  Arguments are file names or other data needed by the command
  • 6. L2B First Linux Course L2B Linux course  Bash Basics  Full Path • Begins with a forward slash • Ends with the file location  Relative path • Begins with your location • Ends with the file location
  • 7. L2B First Linux Course L2B Linux course  Bash Basics  .. refers to the parent directory  . refers to the current directory  Directory names is case sensitive  Names may be up to 255 character  You can use all characters except the forward-slash
  • 8. L2B First Linux Course L2B Linux course  Bash Basics  Clear : • Clear the terminal  Cal • Display the calendar of current year  cal year • Display calendar of this year  cal month • Display calendar of this month  Date • Display current date
  • 9. L2B First Linux Course L2B Linux course  Bash Basics  eject cdrom  pwd  cd • cd ~ • cd path • cd .. • cd ../.. • cd . • cd -
  • 10. L2B First Linux Course L2B Linux course  Bash Basics  ls • ls -l • ls -d • ls -h • ls -a • ls -t • ls -r • ls -R  dir  tree not installed by default in Ubuntu
  • 11. L2B First Linux Course L2B Linux course  Bash Basics  Touch • If you touched a file which exists you changes it's modification time  cat & more  nano file_name
  • 12. L2B First Linux Course L2B Linux course  Bash Basics  mkdir • mkdir -p  cp • cp -r • cp -R • cp -i • cp -f
  • 13. L2B First Linux Course L2B Linux course  Bash Basics  rm • rm -r rm -R  rmdir • rmdir -p  Hint: • To remove a directory which you exists in, move to its parent directory or any other directory.
  • 14. L2B First Linux Course L2B Linux course  Bash Basics  cal  Switching between users • su • su - • sudo  Changing password • passwd [user_name]
  • 15. L2B First Linux Course L2B Linux course  Bash Basics  Adding users • adduser <user_name> • useradd <user_name>  Removing users • userdel <user_name>
  • 16. L2B First Linux Course L2B Linux course  Bash Basics  Getting help • command --help • whatis <command> • man <command> • info <command>
  • 17. L2B First Linux Course L2B Linux course  Bash Basics  Getting help • --help: – Most commands have the options --help – It prints a usage statement and list of options and what they do – [ any_thing ] >>> It is optional – ...... >>> It is list of that thing – < any_thing > >>> It is not optioinal – { x,y,z } >>> At least one of the these things – Options separated by | >>> one of them can be used “or"
  • 18. L2B First Linux Course L2B Linux course  Bash Basics  Getting help • whatis – Short description about the command – Update it's database daily » makewhatis as root
  • 19. L2B First Linux Course L2B Linux course  Bash Basics  Getting help • man -f • man -k & apropos • man -w • manpath
  • 20. L2B First Linux Course L2B Linux course  Bash Basics  Getting help • man page format and how to use it • man [chapter_number] command • man sections/chapters 1- user commands 2- system calls / functions provided by the kernel 3- Library calls 4- special files 5- configuration files formats 6- games 7- packages 8- administrative commands
  • 21. L2B First Linux Course L2B Linux course  Bash Basics  Getting help • info pages – More details than man – Like a web site – Divided into nodes (*) – Try >>> (info ls)
  • 22. L2B First Linux Course L2B Linux course  Bash Basics  Type Tab to complete command lines  Type Tab to command name  For an argument, it will complete a file name  Examples: • $ xte<Tab> • $ xterm • $ ls myf<Tab> • $ ls myfile.txt
  • 23. L2B First Linux Course L2B Linux course  Bash Basics  echo command  file command  Virtual consoles
  • 24. L2B First Linux Course L2B Linux course  Bash Basics Exercise  What man option you will use to search the description of every manual page for a keyword.  What man option you will use to search the entire text (all of the page) of every manual page.
  • 25. L2B First Linux Course L2B Linux course  Bash Basics Exercise  What is the option added to “ls” command to display long list results.  What is the option added to “ls” command to display long list results with human-readable descriptions.
  • 26. L2B First Linux Course L2B Linux course  Bash Basics Exercise  Given the following: foo -x | -y [-abcde] FILENAME Which one is right? • foo -x -y -a file.txt • foo • foo -y -abc file1.txt file2.txt • foo -abc file1.txt file2.txt file3.txt
  • 27. L2B First Linux Course L2B Linux course  Users, Groups and permissions  Every user is assigned a unique User ID (UID)  UID 0 identifies root  Users' names and UIDs are stored in /etc/passwd  Users are assigned to groups  Each group is assigned a unique Group ID (gid)  GIDs are stored in /etc/group
  • 28. L2B First Linux Course L2B Linux course  Users, Groups and permissions  Every file is owned by a UID and a GID  Permission Types: •r •w •X  To display permissions of a file use ls -l file
  • 29. L2B First Linux Course L2B Linux course  Users, Groups and permissions  To change access modes:  chmod [-R] mode file  Where mode is:  u,g or o for user, group and other  + or - for grant or deny  r, w or x for read, write and execute  Examples: • ugo+r: Grant read access to all • o-wx: Deny write and execute to others
  • 30. L2B First Linux Course L2B Linux course  Users, Groups and permissions  To change access modes: • chmod [-R] mode file  Where mode is: • u,g or o for user, group and other • + or - for grant or deny • r, w or x for read, write and execute  Examples: • ugo+r: Grant read access to all • o-wx: Deny write and execute to others
  • 31. L2B First Linux Course L2B Linux course  Users, Groups and permissions  Uses a three-digit mode number  first digit specifies owner's permissions  second digit specifies group permissions  third digit represents others' permissions  Permissions are calculated by adding: • 4 (for read) • 2 (for write) • 1 (for execute)  Example: • chmod 640 myfile
  • 32. L2B First Linux Course L2B Linux course  Introduction to Bash Scripts  What is a script?  sc extension recommended  Steps to create a script • Step 1: Use such as vi or nano to create a text file containing commands: – #!/bin/bash – Comments start with a # – Write your commands. • Step 2: Make the script executable: – $ chmod u+x myscript.sh • Step 3: To execute the new script: – Use relative path or full path
  • 33. For More info Please Visit Our Facebook Group