SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
RedHat Enterprise Linux Essential
        Unit 6: The bash shell
Objectives
Upon completion of this unit, you should be able to:
 Use command-line shortcuts

 Use command-line expansion

 Use history and editing tricks

 Use the gnome-terminal
Bash Introduction

 "bourne Again Shell"

 Successor to sh, the original Unix shell
Bash Introduction
Bash Heritage
Command Line Shortcuts: File Globbing

 Globbing is wildcard expansion:

      .*                  matches zero or more characters

      .?                  matches any single character

      .[a-z]              matches a range of characters

      . [^a-z]            matches all except the range

ex:   touch test1.txt test2.txt test11.txt test1.mp3 test2.mp3

      ls *.txt ; ls test??.txt ; ls test[1-2].txt; ls test[^1].*
Command Line Shortcuts: The Tab Key

 Type Tab to complete command lines:
    For the command name, it will complete a command name

    For an argument, it will complete a file name

 Examples:
       $ xte<Tab>
       $ xterm
       $ ls myf<Tab>
       $ ls myfile.txt
Command Line Shortcuts: history


 Ex: history

 Try: !3

 Try: ^2^1

  example: ping 192.168.1.2

  try: ^2^1
Command Line Expansion: Tilde (~)

 Ex:    pwd

 cd ~

 cd /etc/

 cd ~

 cd ~user1
Command Line Expansion: Variable and Curly braces ({})



 echo $HOME

 cd /tmp

 touch {a,b}

 touch a{a,b}

 touch {a,b}.{1,2}
Command Line Expansion : Command and Math
Command Line Expansion : Command and Math


 hostname => localhost.localdomain (?)

 echo 'Hostname: "

 Echo Hostname: `hostname`“ ; echo Hostname:$(hostname)"

 Math: echo a, echo $HOME,

  echo $a . a=3 , echo $a

  echo $[$a + $c] ; echo $[$b + $c];

  echo $[$c / $b]; echo $[$b%$c]

  echo $[$a**$c]
Command Line Expansion: Backslash ()


 Backslash () is the escape character and makes the next
  character literal

       ex : echo Your cost is $5.00

 Used and last character on line to "continue command on
  next line“

  ex : ls
Command line expansion: Quotes

 Single quotes (')      inhibit all expansion

 Double quotes ('')     inhibit all expansion,

    except:
       • $

       •   `

       •   

       •   !
History Tricks

 use the up and down arrow keys to scroll throuht previous commans

 Type <CTRL-R> to search for a command in command history.

    (reverse-i-search)":

 To recall last argument from previous command:
    <ESC>.

    <ALT + .>

   Ex: ping 192.168.1.1

       telnet   <ESC> .
Command Editing Tricks
 Ctrl-a moves to beginning of line

 Ctrl-e moves to end of line

 Ctrl-u deletes to beginning of line

 Ctrl-k deletes to end of line

 Ctrl-arrow moves left or right by word
gnome - terminal
 Applications/ System Tools / Terminal

 <Ctr - shift -t>             open a new tab

 <Ctrl - pgUp/ PgDn>          Next/ Prev tab

 <Alt-"N">                    changr to go to "N" tab

 <Ctrl - Shift-c/v>           Copy/ Paste

 <Ctrl-Shift-w>               Close a tab
Scripting Basics
 Shell scripts are text files that contain a series of commands or
  statements to be executed.

 Shell scripts are useful for:
    Automating commonly used commands

    Performing system administration and troubleshooting

    Creating simple applications

    Manipulation of text or files
Creating Shell Scripts
 Step 1: Use such as vi to create a text file containing
  commands
    First line contains the magic shebang sequence: #!

      • #!/bin/bash

 Comment your scripts!
    Comments start with a #
Creating Shell Scripts
                             continued
 Step 2: Make the script executable:

       $ chmod u+x myscript.sh

 To execute the new script:
    Place the script file in a directory in the executable path -OR-

    Specify the absolute or relative path to the script on the command line
Sample Shell Script
#!/bin/bash

# This script displays some information about your
  environment

echo "Greetings. The date and time are $(date)"

echo "Your working directory is: $(pwd)"
Unit 6 bash shell

Contenu connexe

Tendances

Linux shell env
Linux shell envLinux shell env
Linux shell envRahul Pola
 
Shell & Shell Script
Shell & Shell Script Shell & Shell Script
Shell & Shell Script Amit Ghosh
 
system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikarsystem management -shell programming by gaurav raikar
system management -shell programming by gaurav raikarGauravRaikar3
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filtersbhatvijetha
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting BasicsSudharsan S
 
DevChatt 2010 - *nix Cmd Line Kung Foo
DevChatt 2010 - *nix Cmd Line Kung FooDevChatt 2010 - *nix Cmd Line Kung Foo
DevChatt 2010 - *nix Cmd Line Kung Foobrian_dailey
 
Unix Commands
Unix CommandsUnix Commands
Unix CommandsDr.Ravi
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scriptingvceder
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell ScriptingMustafa Qasim
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examplesabclearnn
 
Course 102: Lecture 7: Simple Utilities
Course 102: Lecture 7: Simple Utilities Course 102: Lecture 7: Simple Utilities
Course 102: Lecture 7: Simple Utilities Ahmed El-Arabawy
 

Tendances (20)

Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
SHELL PROGRAMMING
SHELL PROGRAMMINGSHELL PROGRAMMING
SHELL PROGRAMMING
 
Shell programming
Shell programmingShell programming
Shell programming
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
 
Linux shell env
Linux shell envLinux shell env
Linux shell env
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Shell & Shell Script
Shell & Shell Script Shell & Shell Script
Shell & Shell Script
 
Shellscripting
ShellscriptingShellscripting
Shellscripting
 
system management -shell programming by gaurav raikar
system management -shell programming by gaurav raikarsystem management -shell programming by gaurav raikar
system management -shell programming by gaurav raikar
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filters
 
Unix shell scripting tutorial
Unix shell scripting tutorialUnix shell scripting tutorial
Unix shell scripting tutorial
 
Scripting and the shell in LINUX
Scripting and the shell in LINUXScripting and the shell in LINUX
Scripting and the shell in LINUX
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
 
DevChatt 2010 - *nix Cmd Line Kung Foo
DevChatt 2010 - *nix Cmd Line Kung FooDevChatt 2010 - *nix Cmd Line Kung Foo
DevChatt 2010 - *nix Cmd Line Kung Foo
 
Unix Commands
Unix CommandsUnix Commands
Unix Commands
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell Scripting
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Course 102: Lecture 7: Simple Utilities
Course 102: Lecture 7: Simple Utilities Course 102: Lecture 7: Simple Utilities
Course 102: Lecture 7: Simple Utilities
 

En vedette

Unit 4 user and group
Unit 4 user and groupUnit 4 user and group
Unit 4 user and grouproot_fibo
 
Unit 13 network client
Unit 13 network clientUnit 13 network client
Unit 13 network clientroot_fibo
 
Unit 9 basic system configuration tools
Unit 9 basic system configuration toolsUnit 9 basic system configuration tools
Unit 9 basic system configuration toolsroot_fibo
 
Administration 1 sw2012
Administration 1 sw2012Administration 1 sw2012
Administration 1 sw2012Lin Liyue
 
Unit 12 finding and processing files
Unit 12 finding and processing filesUnit 12 finding and processing files
Unit 12 finding and processing filesroot_fibo
 

En vedette (6)

Unit 4 user and group
Unit 4 user and groupUnit 4 user and group
Unit 4 user and group
 
Unit2 help
Unit2 helpUnit2 help
Unit2 help
 
Unit 13 network client
Unit 13 network clientUnit 13 network client
Unit 13 network client
 
Unit 9 basic system configuration tools
Unit 9 basic system configuration toolsUnit 9 basic system configuration tools
Unit 9 basic system configuration tools
 
Administration 1 sw2012
Administration 1 sw2012Administration 1 sw2012
Administration 1 sw2012
 
Unit 12 finding and processing files
Unit 12 finding and processing filesUnit 12 finding and processing files
Unit 12 finding and processing files
 

Similaire à Unit 6 bash shell

Similaire à Unit 6 bash shell (20)

Using Unix
Using UnixUsing Unix
Using Unix
 
Session3
Session3Session3
Session3
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Unix
UnixUnix
Unix
 
101 3.1 gnu and unix commands
101 3.1 gnu and unix commands101 3.1 gnu and unix commands
101 3.1 gnu and unix commands
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 
60761 linux
60761 linux60761 linux
60761 linux
 
basic shell scripting syntex
basic shell scripting syntexbasic shell scripting syntex
basic shell scripting syntex
 
Linux com
Linux comLinux com
Linux com
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 
Shell Scripting and Programming.pptx
Shell Scripting and Programming.pptxShell Scripting and Programming.pptx
Shell Scripting and Programming.pptx
 
IntroCommandLine.ppt
IntroCommandLine.pptIntroCommandLine.ppt
IntroCommandLine.ppt
 
IntroCommandLine.ppt
IntroCommandLine.pptIntroCommandLine.ppt
IntroCommandLine.ppt
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
101 3.1 gnu and unix commands v4
101 3.1 gnu and unix commands v4101 3.1 gnu and unix commands v4
101 3.1 gnu and unix commands v4
 

Dernier

The Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central BankingThe Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central BankingSelcen Ozturkcan
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
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
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Dernier (20)

The Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central BankingThe Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central Banking
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

Unit 6 bash shell

  • 1. RedHat Enterprise Linux Essential Unit 6: The bash shell
  • 2. Objectives Upon completion of this unit, you should be able to:  Use command-line shortcuts  Use command-line expansion  Use history and editing tricks  Use the gnome-terminal
  • 3. Bash Introduction  "bourne Again Shell"  Successor to sh, the original Unix shell
  • 6. Command Line Shortcuts: File Globbing  Globbing is wildcard expansion: .* matches zero or more characters .? matches any single character .[a-z] matches a range of characters . [^a-z] matches all except the range ex: touch test1.txt test2.txt test11.txt test1.mp3 test2.mp3 ls *.txt ; ls test??.txt ; ls test[1-2].txt; ls test[^1].*
  • 7. Command Line Shortcuts: The Tab Key  Type Tab to complete command lines:  For the command name, it will complete a command name  For an argument, it will complete a file name  Examples: $ xte<Tab> $ xterm $ ls myf<Tab> $ ls myfile.txt
  • 8. Command Line Shortcuts: history  Ex: history  Try: !3  Try: ^2^1 example: ping 192.168.1.2 try: ^2^1
  • 9. Command Line Expansion: Tilde (~)  Ex: pwd  cd ~  cd /etc/  cd ~  cd ~user1
  • 10. Command Line Expansion: Variable and Curly braces ({})  echo $HOME  cd /tmp  touch {a,b}  touch a{a,b}  touch {a,b}.{1,2}
  • 11. Command Line Expansion : Command and Math
  • 12. Command Line Expansion : Command and Math  hostname => localhost.localdomain (?)  echo 'Hostname: "  Echo Hostname: `hostname`“ ; echo Hostname:$(hostname)"  Math: echo a, echo $HOME, echo $a . a=3 , echo $a echo $[$a + $c] ; echo $[$b + $c]; echo $[$c / $b]; echo $[$b%$c] echo $[$a**$c]
  • 13. Command Line Expansion: Backslash ()  Backslash () is the escape character and makes the next character literal ex : echo Your cost is $5.00  Used and last character on line to "continue command on next line“ ex : ls
  • 14. Command line expansion: Quotes  Single quotes (') inhibit all expansion  Double quotes ('') inhibit all expansion,  except: • $ • ` • • !
  • 15. History Tricks  use the up and down arrow keys to scroll throuht previous commans  Type <CTRL-R> to search for a command in command history.  (reverse-i-search)":  To recall last argument from previous command:  <ESC>.  <ALT + .> Ex: ping 192.168.1.1 telnet <ESC> .
  • 16. Command Editing Tricks  Ctrl-a moves to beginning of line  Ctrl-e moves to end of line  Ctrl-u deletes to beginning of line  Ctrl-k deletes to end of line  Ctrl-arrow moves left or right by word
  • 17. gnome - terminal  Applications/ System Tools / Terminal  <Ctr - shift -t> open a new tab  <Ctrl - pgUp/ PgDn> Next/ Prev tab  <Alt-"N"> changr to go to "N" tab  <Ctrl - Shift-c/v> Copy/ Paste  <Ctrl-Shift-w> Close a tab
  • 18. Scripting Basics  Shell scripts are text files that contain a series of commands or statements to be executed.  Shell scripts are useful for:  Automating commonly used commands  Performing system administration and troubleshooting  Creating simple applications  Manipulation of text or files
  • 19. Creating Shell Scripts  Step 1: Use such as vi to create a text file containing commands  First line contains the magic shebang sequence: #! • #!/bin/bash  Comment your scripts!  Comments start with a #
  • 20. Creating Shell Scripts continued  Step 2: Make the script executable: $ chmod u+x myscript.sh  To execute the new script:  Place the script file in a directory in the executable path -OR-  Specify the absolute or relative path to the script on the command line
  • 21. Sample Shell Script #!/bin/bash # This script displays some information about your environment echo "Greetings. The date and time are $(date)" echo "Your working directory is: $(pwd)"