SlideShare a Scribd company logo
Bash Scripting

       Prepared by Ahmed Magdy Ezzeldin
File System

●   / is not allowed in a file name
●   file extensions are not important
●   File and folder names are case sensitive
●   Names containing spaces are escaped by  or ""
●   Hidden files start with .
●   Current directory alias . and parent directory alias ..
●   ls, ls -a, ls -l, cp, mv, rm, rm -rdf, ln, ln -sf
Variable and Strings

●   Strings are enclosed in “” '' or just written with spaces escaped
    by 
    VAR=”How are you”
    VAR='How are you'
    VAR=HOW are you
●   Variables
    $VAR
    ${VAR} # e.g. ${FILE}.txt
    echo “my name is $NAME”
    echo “my name is “$NAME
    read VAR
    read VAR1 VAR2
Math

●   echo $((1+1))
●   echo $[1+1]
●   echo `expr 1 + 1`
●   A=$((B*C))
●   let A+=1
●   echo "3.4+7/8-(5.94*3.14)" | bc
File Ownership and Permissions

●   Group and Ownership
    chown, chgrp, ls -l
    chown user:group file
    sudo chown

●   Permissions of files and directories
    chmod 755 file
    chmod +x file
    chmod -x file
                   (r)ead     (w)rite      e(x)ecute

                     4           2            1
Users, su, sudo

●   su, sudo, visudo, /etc/sudoers, su user
●   sudo bash
●   /etc/passwd
●   ~/
Processes and Subshells

●   ps, pgrep, top, jobs, fg, &, kill, signals
●   Sub-shells from :
    ●   Loops
    ●   $()
    ●   Back ticks ``
    ●   bash command
●   /proc
●   fuser
Loops

●   While loop
    while read VAR; do echo $VAR; done
●   For each loop
    for VAR in {1..5}; do echo $VAR; done
    for VAR in 1 2 3 4 5; do echo $VAR; done
    for VAR in {0..10..2}; do echo $VAR; done
    for VAR in $(seq 0 2 10); do echo $VAR; done
●   For loop with counter
    for (( i=0; i<=10; i+=2 )); do echo $i; done
if and switch case

●   If then, else, elif, fi
    if [ -d $F ]; then
        rm -rdf $F
    elif [ -f $F ]; then
        rm $F
    else
        echo “Unknown file type”
    fi
●   case, esac
    while read l; do
     case $l in
      1) echo "One";;
      2) echo "Two";;
      3) echo "Three";;
      *) echo "Invalid"; break;;
     esac
    done
I/O Redirection

●   >, >>, <, &>, 2&>, 2>, |
    echo “error” 1>&2 # redirect std_output to std_err
    some_error_producing_command 2>&1
    some_command &>> log_file_errors_and_output
    some_command >> log_file_output_only
    some_command 2>> log_file_errors_only
    command | filter_command
    command < file
    command > file # truncates and writes into file
    command1 2>&1 | command2
    command1 |& command2
●   Mute by redirecting to /dev/null file
Named Pipes and Network and Signal Processing
●   Network
      exec 9<>/dev/tcp/google.com/80
      echo -e "GET / HTTP/1.0nn" >&9
      while read line <&9; do echo $line; done
●   Named Pipes
      mkfifo pipe
      while read l; do echo $l; done < pipe
      echo “hi” > pipe # on another terminal window
●   Signal Processing
      #!/bin/bash
      function handle_signal () {
         echo "Hi man I got the signal"
      }
      trap "handle_signal; exit" SIGINT
      sleep 100
Cool Stuff and GUI
●   Install these: libnotify-bin, zenity, festival
●   date '+%l oclock' | festival –tts
●   zenity --list --hide-header --text="Are you coming today?" --checklist --column
    "" --column "" FALSE "Yes" FALSE "No" FALSE "May be"
●   zenity --calendar --date-format="%Y/%m/%d"
●   zenity --text="Select Hour" --title="Select Hour" --scale --min-value=0 --max-
    value=24 --value=17
●   zenity --text="Select Minutes" --title="Select Minutes" --scale --min-value=0
    --max-value=59 --value=0
●   zenity --info --text="Did you know this info"
●   zenity --error --text="There is an error"
●   zenity --entry | festival --tts
●   zenity --file-selection
●   <progres command> | zenity --progress --auto-close
●   notify-send -t 10 "hi man" "details"
Launchers

  ● When you drag a file or folder onto a launcher
  it is sent as $1 to the launcher script
Example Codes

●   Bluetooth Obex-push
    NEW_FILE_NAME=`echo $1 | awk -vFS="/" '{print $NF;}'`
    ussp-push 00:22:65:89:22:E6@9 "$1" "$NEW_FILE_NAME"
●   Close the computer when your browser finishes downloading
    your_file
    while true; do sleep 5; if [ -z "`fuser ~/your_file`" ]; then break;
    fi; done; sudo init 0
●   Tell me the time whenever I lock my screen or unlock it
●   Simple spider using curl and wget
●   Log your time easily and report to a Redmine service
●   Think of more ...
Thank you
References


    http://www.linuxcommand.org/lts0040.php

    http://www.cyberciti.biz/faq/bash-for-loop/

       http://linuxcommand.org/wss0160.php

  http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-10.html


 http://wiki.bash-hackers.org/syntax/redirection

  http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.html

More Related Content

What's hot (20)

Comets notes
Comets notes
Ilija Dukovski
 
React PHP: the NodeJS challenger
React PHP: the NodeJS challenger
vanphp
 
The promise of asynchronous PHP
The promise of asynchronous PHP
Wim Godden
 
How to send files to remote server via ssh in php
How to send files to remote server via ssh in php
Andolasoft Inc
 
Unix cheatsheet
Unix cheatsheet
Dhaval Shukla
 
ZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 Version
Ian Barber
 
How to stand on the shoulders of giants
How to stand on the shoulders of giants
Ian Barber
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
Ian Barber
 
Clojure + MongoDB on Heroku
Clojure + MongoDB on Heroku
Naoyuki Kakuda
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101
hendrikvb
 
Any event intro
Any event intro
qiang
 
Créer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heure
Amaury Bouchard
 
Parsing JSON with a single regex
Parsing JSON with a single regex
brian d foy
 
Shell Script
Shell Script
Adam Victor Brandizzi
 
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Puppet
 
Coming Out Of Your Shell - A Comparison of *Nix Shells
Coming Out Of Your Shell - A Comparison of *Nix Shells
Kel Cecil
 
Devinsampa nginx-scripting
Devinsampa nginx-scripting
Tony Fabeen
 
Puppet Camp 2012
Puppet Camp 2012
Server Density
 
Perl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one liners
Kirk Kimmel
 
Laporan setting dns
Laporan setting dns
Septian Adi
 
React PHP: the NodeJS challenger
React PHP: the NodeJS challenger
vanphp
 
The promise of asynchronous PHP
The promise of asynchronous PHP
Wim Godden
 
How to send files to remote server via ssh in php
How to send files to remote server via ssh in php
Andolasoft Inc
 
ZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 Version
Ian Barber
 
How to stand on the shoulders of giants
How to stand on the shoulders of giants
Ian Barber
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
Ian Barber
 
Clojure + MongoDB on Heroku
Clojure + MongoDB on Heroku
Naoyuki Kakuda
 
Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101
hendrikvb
 
Any event intro
Any event intro
qiang
 
Créer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heure
Amaury Bouchard
 
Parsing JSON with a single regex
Parsing JSON with a single regex
brian d foy
 
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Absolute Beginners Guide to Puppet Through Types - PuppetConf 2014
Puppet
 
Coming Out Of Your Shell - A Comparison of *Nix Shells
Coming Out Of Your Shell - A Comparison of *Nix Shells
Kel Cecil
 
Devinsampa nginx-scripting
Devinsampa nginx-scripting
Tony Fabeen
 
Perl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one liners
Kirk Kimmel
 
Laporan setting dns
Laporan setting dns
Septian Adi
 

Similar to Bash Scripting Workshop (20)

One-Liners to Rule Them All
One-Liners to Rule Them All
egypt
 
Unix tips and tricks
Unix tips and tricks
Aleksandar Bilanovic
 
Shell scripting
Shell scripting
Ashrith Mekala
 
Perl basics for Pentesters
Perl basics for Pentesters
Sanjeev Kumar Jaiswal
 
Mac OSX Terminal 101
Mac OSX Terminal 101
Murugun Murugun
 
Shell Scripts
Shell Scripts
Dr.Ravi
 
IO Streams, Files and Directories
IO Streams, Files and Directories
Krasimir Berov (Красимир Беров)
 
Linux And perl
Linux And perl
Sagar Kumar
 
101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects
Acácio Oliveira
 
Python build your security tools.pdf
Python build your security tools.pdf
TECHNOLOGY CONTROL CO.
 
Unit 10 investigating and managing
Unit 10 investigating and managing
root_fibo
 
Unix shell scripting basics
Unix shell scripting basics
Abhay Sapru
 
Unix Shell Scripting Basics
Unix Shell Scripting Basics
Dr.Ravi
 
Really useful linux commands
Really useful linux commands
Michael J Geiser
 
Phishing for Root (How I Got Access to Root on Your Computer With 8 Seconds o...
Phishing for Root (How I Got Access to Root on Your Computer With 8 Seconds o...
Vi Grey
 
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON
 
A journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service management
Lubomir Rintel
 
Logrotate sh
Logrotate sh
Ben Pope
 
Shell Scripting
Shell Scripting
Gaurav Shinde
 
Ansible tips & tricks
Ansible tips & tricks
bcoca
 
One-Liners to Rule Them All
One-Liners to Rule Them All
egypt
 
Shell Scripts
Shell Scripts
Dr.Ravi
 
101 3.4 use streams, pipes and redirects
101 3.4 use streams, pipes and redirects
Acácio Oliveira
 
Unit 10 investigating and managing
Unit 10 investigating and managing
root_fibo
 
Unix shell scripting basics
Unix shell scripting basics
Abhay Sapru
 
Unix Shell Scripting Basics
Unix Shell Scripting Basics
Dr.Ravi
 
Really useful linux commands
Really useful linux commands
Michael J Geiser
 
Phishing for Root (How I Got Access to Root on Your Computer With 8 Seconds o...
Phishing for Root (How I Got Access to Root on Your Computer With 8 Seconds o...
Vi Grey
 
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON
 
A journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service management
Lubomir Rintel
 
Logrotate sh
Logrotate sh
Ben Pope
 
Ansible tips & tricks
Ansible tips & tricks
bcoca
 
Ad

More from Ahmed Magdy Ezzeldin, MSc. (12)

Distributed RDBMS: Challenges, Solutions & Trade-offs
Distributed RDBMS: Challenges, Solutions & Trade-offs
Ahmed Magdy Ezzeldin, MSc.
 
Win any Interview like a Boss
Win any Interview like a Boss
Ahmed Magdy Ezzeldin, MSc.
 
Answer Selection and Validation for Arabic Questions
Answer Selection and Validation for Arabic Questions
Ahmed Magdy Ezzeldin, MSc.
 
Arabic Question Answering: Challenges, Tasks, Approaches, Test-sets, Tools, A...
Arabic Question Answering: Challenges, Tasks, Approaches, Test-sets, Tools, A...
Ahmed Magdy Ezzeldin, MSc.
 
A survey of fault prediction using machine learning algorithms
A survey of fault prediction using machine learning algorithms
Ahmed Magdy Ezzeldin, MSc.
 
GATE : General Architecture for Text Engineering
GATE : General Architecture for Text Engineering
Ahmed Magdy Ezzeldin, MSc.
 
Networks and Natural Language Processing
Networks and Natural Language Processing
Ahmed Magdy Ezzeldin, MSc.
 
Distributed Coordination-Based Systems
Distributed Coordination-Based Systems
Ahmed Magdy Ezzeldin, MSc.
 
Distributed Systems Naming
Distributed Systems Naming
Ahmed Magdy Ezzeldin, MSc.
 
Cyclcone a safe dialect of C
Cyclcone a safe dialect of C
Ahmed Magdy Ezzeldin, MSc.
 
Objective C Memory Management
Objective C Memory Management
Ahmed Magdy Ezzeldin, MSc.
 
Object Role Modeling
Object Role Modeling
Ahmed Magdy Ezzeldin, MSc.
 
Ad

Recently uploaded (20)

Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...
Matsushita Laboratory
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
Analysis of the changes in the attitude of the news comments caused by knowin...
Analysis of the changes in the attitude of the news comments caused by knowin...
Matsushita Laboratory
 
June Patch Tuesday
June Patch Tuesday
Ivanti
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 

Bash Scripting Workshop

  • 1. Bash Scripting Prepared by Ahmed Magdy Ezzeldin
  • 2. File System ● / is not allowed in a file name ● file extensions are not important ● File and folder names are case sensitive ● Names containing spaces are escaped by or "" ● Hidden files start with . ● Current directory alias . and parent directory alias .. ● ls, ls -a, ls -l, cp, mv, rm, rm -rdf, ln, ln -sf
  • 3. Variable and Strings ● Strings are enclosed in “” '' or just written with spaces escaped by VAR=”How are you” VAR='How are you' VAR=HOW are you ● Variables $VAR ${VAR} # e.g. ${FILE}.txt echo “my name is $NAME” echo “my name is “$NAME read VAR read VAR1 VAR2
  • 4. Math ● echo $((1+1)) ● echo $[1+1] ● echo `expr 1 + 1` ● A=$((B*C)) ● let A+=1 ● echo "3.4+7/8-(5.94*3.14)" | bc
  • 5. File Ownership and Permissions ● Group and Ownership chown, chgrp, ls -l chown user:group file sudo chown ● Permissions of files and directories chmod 755 file chmod +x file chmod -x file (r)ead (w)rite e(x)ecute 4 2 1
  • 6. Users, su, sudo ● su, sudo, visudo, /etc/sudoers, su user ● sudo bash ● /etc/passwd ● ~/
  • 7. Processes and Subshells ● ps, pgrep, top, jobs, fg, &, kill, signals ● Sub-shells from : ● Loops ● $() ● Back ticks `` ● bash command ● /proc ● fuser
  • 8. Loops ● While loop while read VAR; do echo $VAR; done ● For each loop for VAR in {1..5}; do echo $VAR; done for VAR in 1 2 3 4 5; do echo $VAR; done for VAR in {0..10..2}; do echo $VAR; done for VAR in $(seq 0 2 10); do echo $VAR; done ● For loop with counter for (( i=0; i<=10; i+=2 )); do echo $i; done
  • 9. if and switch case ● If then, else, elif, fi if [ -d $F ]; then rm -rdf $F elif [ -f $F ]; then rm $F else echo “Unknown file type” fi ● case, esac while read l; do case $l in 1) echo "One";; 2) echo "Two";; 3) echo "Three";; *) echo "Invalid"; break;; esac done
  • 10. I/O Redirection ● >, >>, <, &>, 2&>, 2>, | echo “error” 1>&2 # redirect std_output to std_err some_error_producing_command 2>&1 some_command &>> log_file_errors_and_output some_command >> log_file_output_only some_command 2>> log_file_errors_only command | filter_command command < file command > file # truncates and writes into file command1 2>&1 | command2 command1 |& command2 ● Mute by redirecting to /dev/null file
  • 11. Named Pipes and Network and Signal Processing ● Network exec 9<>/dev/tcp/google.com/80 echo -e "GET / HTTP/1.0nn" >&9 while read line <&9; do echo $line; done ● Named Pipes mkfifo pipe while read l; do echo $l; done < pipe echo “hi” > pipe # on another terminal window ● Signal Processing #!/bin/bash function handle_signal () { echo "Hi man I got the signal" } trap "handle_signal; exit" SIGINT sleep 100
  • 12. Cool Stuff and GUI ● Install these: libnotify-bin, zenity, festival ● date '+%l oclock' | festival –tts ● zenity --list --hide-header --text="Are you coming today?" --checklist --column "" --column "" FALSE "Yes" FALSE "No" FALSE "May be" ● zenity --calendar --date-format="%Y/%m/%d" ● zenity --text="Select Hour" --title="Select Hour" --scale --min-value=0 --max- value=24 --value=17 ● zenity --text="Select Minutes" --title="Select Minutes" --scale --min-value=0 --max-value=59 --value=0 ● zenity --info --text="Did you know this info" ● zenity --error --text="There is an error" ● zenity --entry | festival --tts ● zenity --file-selection ● <progres command> | zenity --progress --auto-close ● notify-send -t 10 "hi man" "details"
  • 13. Launchers ● When you drag a file or folder onto a launcher it is sent as $1 to the launcher script
  • 14. Example Codes ● Bluetooth Obex-push NEW_FILE_NAME=`echo $1 | awk -vFS="/" '{print $NF;}'` ussp-push 00:22:65:89:22:E6@9 "$1" "$NEW_FILE_NAME" ● Close the computer when your browser finishes downloading your_file while true; do sleep 5; if [ -z "`fuser ~/your_file`" ]; then break; fi; done; sudo init 0 ● Tell me the time whenever I lock my screen or unlock it ● Simple spider using curl and wget ● Log your time easily and report to a Redmine service ● Think of more ...
  • 16. References http://www.linuxcommand.org/lts0040.php http://www.cyberciti.biz/faq/bash-for-loop/ http://linuxcommand.org/wss0160.php http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-10.html http://wiki.bash-hackers.org/syntax/redirection http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.html