SlideShare a Scribd company logo
1 of 39
Download to read offline
https://github.com/syaifulahdan/os­practice|Operating System Practice |1 to 39 
OPERATING SYSTEMS PRACTICE
Working With Bash Shell
Practice : 5B

History on Bash Shell

Creating a Bash Shell Script
https://github.com/syaifulahdan/os­practice|
https://github.com/syaifulahdan/os­practice|Operating System Practice |2 to 39 
A. Objectives
1. Understanding the shell on Linux operating system.
2. Using feature history in Bash Shell.
3. Change the history feature in Bash Shell.
4. the shell prompt.
5. Configure Bash Shell to run scripts automatically.
6. Create and execute simple shell scripts via vi editor.
7. Understand the job control.
8. Understand the stack.
9. Using aliases
https://github.com/syaifulahdan/os­practice|Operating System Practice |3 to 39 
B. Basic Theory
https://github.com/syaifulahdan/os­practice|Operating System Practice |4 to 39 
1. SHELL
Shell is a Command executive, meaning the program awaits
the user's instructions, checks the syntax of the given
instruction, then executes the command.
Shell is marked with a prompt. For user use prompt $ and
for superuser use promp #.
shell type:

/bin/sh
Developed by UNIX Berkeley known as C-Shell

/bin/csh
Bourne shell, designed by Steve Bourne of AT & T

/bin/bash
Compatible with Bourne Shell and also adapting Korn-Shell's ability.
The fundamental difference between Shell is resolved almost non-
existent, except in programming and editing facilities.
https://github.com/syaifulahdan/os­practice|Operating System Practice |5 to 39 
1. SHELL
Shell is a Command executive, meaning the program awaits
the user's instructions, checks the syntax of the given
instruction, then executes the command.
Shell is marked with a prompt. For user use prompt $ and
for superuser use promp #.
shell type:

/bin/sh
Developed by UNIX Berkeley known as C-Shell

/bin/csh
Bourne shell, designed by Steve Bourne of AT & T

/bin/bash
Compatible with Bourne Shell and also adapting Korn-Shell's ability.
The fundamental difference between Shell is resolved almost non-
existent, except in programming and editing facilities.
https://github.com/syaifulahdan/os­practice|Operating System Practice |6 to 39 
2. PROFILE
At login time, the program will run some program that is:
1. /etc/profile
It contains a shell script that applies to all Linux users.
2. Profile for each user
In the home directory, the login will first check the .bash_profile file.
If no, then the .bash_login file will be searched. If .bash_login does not
exist, then look for file named .profile
3. .bashrc
This file will be executed for switching from one shell to another through
su.
4. .bash_logout
At logout, bash will search for file .bash_logout. When present, the file
will be executed before logout
https://github.com/syaifulahdan/os­practice|Operating System Practice |7 to 39 
The contents of / etc / profile:
# System wide environment and startup programs
# Functions and aliases go in /etc/bashrc
PATH=”$PATH:/usr/X11R6/bin”
PS1=”[u@h W]$ “
umask 022
USER=’id –un’
LOGNAME=$USER
MAIL=”/var/spool/mail/$USER”
HOSTNAME=’/bi n/hostname’
HISTSIZE=1000
HISTFILESIZE=1000
Export  PATH  PS1  HOSTNAME  HISTSIZE  HISTFILESIZE  USER 
LOGNAME MAIL
https://github.com/syaifulahdan/os­practice|Operating System Practice |8 to 39 
PATH merupakan daftar nama direktori. Bila sebuah instruksi
diberikan dari prompt shell, maka instruksi tersebut akan
dicari pada daftar tersebut.
PS1 adalah prompt dimana
u = Nama User
h = Nama Host
W = Nama working direktory
https://github.com/syaifulahdan/os­practice|Operating System Practice |9 to 39 
3. HISTORY
History is adapted from C-Shell, which is a record of all
the instructions that have so far been done. These
records can be viewed as history, then can be re-
selected, edited and executed. History allows the user to
re-edit complex and lengthy instructions, especially
when errors occur in the writing of instructions and
parameters.
^P (Ctrl-P) see previous instructions
^N (Ctrl-N see the next instruction
!! execution of previous instructions
!! –3 3 previous instructions will be repeated
!!88 repeat instruction no 88
https://github.com/syaifulahdan/os­practice|Operating System Practice |10 to 39 
4. BASH-SCRIPT
Bash-script is a file that contains a collection of executable
programs. For bash script execution use .
before the bash-script file which means shell and sign
execution ./ means the bash-script file is in the actual
directory.
https://github.com/syaifulahdan/os­practice|Operating System Practice |11 to 39 
5. JOB CONTROL
Job is a program execution given to the kernel. A Job is
deemed complete, when the execution of the program ends.
Execution Job is the same as the execution of the program,
both Background process and Foreground process.
https://github.com/syaifulahdan/os­practice|Operating System Practice |12 to 39 
5. EDITOR vi
Vi is a full screen editor, meaning the editor can take
advantage of the full-screen facility. Vi has 2 pieces mode,
namely:

Command line
The vi editor interprets the input as an instruction to be
executed by the editor, examples such as searching text,
changing text automatically and others.

Editing
The vi editor interprets the output as text to be inserted into
the buffer editor. At the bottom of the screen will display the
text "INSERTING".
https://github.com/syaifulahdan/os­practice|Operating System Practice |13 to 39 
At the beginning of vi run, the program enters command mode. With
pressing the "i" button will then enter editing. To return to
command mode, press the Esc key.
The keys of the vi editor text can be seen in the table as follows:
H Move cursor to left one character
J Move the cursor to the right of one character
K Pinda h kursor ke atas
L Move the cursor down
O Insert text (one line after cursor position) To exit the 5 insert lock
models next to this and
activate other keys, then we
must press the Esc key first
I Insert text (to the left of the cursor position)
A Insert text (to the right of the cursor position)
I (Shift i) Insert text (in the starting position of the line)
A (Shift a) Insert text (at the end of the line)
https://github.com/syaifulahdan/os­practice|Operating System Practice |14 to 39 
X Deleting 1 letter (to the right of the cursor position)
Dw Delete 1 word (to the right of the cursor position)
Dd Removing 1 row (to the right of cursor position)
Yy Copying 1 line
2yy Copying 2 lines
P (Paste) Displays a sentence line that has been copied with yy key.
Cw Replace 1 word that has been written to the right of the cursor position with another word
Cc Replace 1 sentence line that has been written to the right of the cursor position with
another sentence
ctrl- b Reverse one screen
ctrl- f Forward one screen
ctrl- d Forward half screen
B Move the cursor to the left of one word
W Move the cursor to the right of one word
^ Go to the beginning of the line
$ Go to the end of the line
U Cancel the last command
U Undoes all text changes on the line where the cursor is located
:! Quit temporarily from vi editor and execute another command
https://github.com/syaifulahdan/os­practice|Operating System Practice |15 to 39 
:wq Write and quite, save the file and exit
:q! Exit vi without saving
:se all Displays all set status options
:se nu Displays the line number on the left of the screen
/string Looking for strings forward
?string Looking for strings toward the back
N Forward the search for the same direction
N Continue searching for different directions
https://github.com/syaifulahdan/os­practice|Operating System Practice |16 to 39 
C. Step by Step
https://github.com/syaifulahdan/os­practice|Operating System Practice |17 to 39 
1 Login as user.
2 Open the Console Terminal and do the experiments
below and then analyze the results of the
experiment.
3 Conduct the experiments below and then analyze
the experimental results.
4 Complete the practice questions.
https://github.com/syaifulahdan/os­practice|Operating System Practice |18 to 39 
D. Experiment
https://github.com/syaifulahdan/os­practice|Operating System Practice |19 to 39 
Experiment 6 : Create and run Bash-
scripts
1. Create a p1.sh file
$ vi p1.sh
echo "bash Script Program"
2. Change the program to an executable
$ ls –l p1.sh
$ chmod +x p1.sh
$ ls –l p1.sh
https://github.com/syaifulahdan/os­practice|Operating System Practice |20 to 39 
3. Running the script
$ bash p1.sh
$ sh p1.sh
$ . p1.sh
$ ./p1.sh
4. The convention in shell script creation is expressed as
#!/ Bin/bash. Add to the p1.sh file of the convention.
$ vi p1.sh
#!/bin/bash
echo “Program bash script”
https://github.com/syaifulahdan/os­practice|Operating System Practice |21 to 39 
5. Create a p2.sh file
$ vi p2.sh
#!/bin/bash
echo “Program 2 bash script”
6. Running multiple shell programs in a single line of
instructions separated by a sign;
$ cat p1.sh ; cat p2.sh
$ ./p1.sh ; ./p2.sh
https://github.com/syaifulahdan/os­practice|Operating System Practice |22 to 39 
Experiment 7 : Job Control
1. Foreground process
2. Background Proses
$ ps x > hasil &
$ ps x
3. Each job has a single PID (unique). To see which jobs
active
$ jobs
https://github.com/syaifulahdan/os­practice|Operating System Practice |23 to 39 
4. Create a ploop.sh file. This file will never stop unless it
is pressed
Ctrl-C
$ vi ploop.sh
#!/bin/bash
while [ true ]
Do
      Sleep 10
      echo “Hallo”
done
https://github.com/syaifulahdan/os­practice|Operating System Practice |24 to 39 
5. Make a ploop.sh file into an executable. Run the
program, will display the word Hallo every 10 seconds. To
exit the program, press Ctrl-C (^ C)
$ chmod +x ploop.sh
$ ./ploop.sh
https://github.com/syaifulahdan/os­practice|Operating System Practice |25 to 39 
Experiment 8 : Manipulation stack for
Directories
1. Dirs instruction is used to view the directory stack, the
output is displayed only home directory ~
$ dirs
2. Create 3 directory pieces
$ mkdir marketing sales support
3. Dirs instruction is used to view the directory stack, the
output is displayed only home directory ~
$ dirs
https://github.com/syaifulahdan/os­practice|Operating System Practice |26 to 39 
Experiment 9 : Alias
1. Alias is a mechanism for naming aliases on one or a
group of instructions. To view aliases that have been
registered on the system:
$ alias
2. Create multiple aliases
$ alias del=’rm –i’
$ alias h=’history’
https://github.com/syaifulahdan/os­practice|Operating System Practice |27 to 39 
3. Gunakan instruksi hasil alias
$ ls
$ del hasil
$ h | more
4. To remove aliases use unalias instructions
$ unalias del
$ del files (Error Messages, why?)
https://github.com/syaifulahdan/os­practice|Operating System Practice |28 to 39 
E. Exercise
https://github.com/syaifulahdan/os­practice|Operating System Practice |29 to 39 

Exercise : Practice 5B
1 Execution of all existing profiles:
a. Edit the profile file /etc/profile and display the message
as follows:
echo 'Profile of / etc / profile'
b. Assuming your name is student, then edit all existing profiles:
/home/student /.bash_profile
/home/. student/.bash_login
/home/student /.profile
/home/student /.bashrc
https://github.com/syaifulahdan/os­practice|Operating System Practice |30 to 39 
c. Rename /home/student with your own name. , include the echo
instruction, eg On each file in
/home/student/.bash_profile:
echo "Profile from .bash_profile"
d. Do the same for other files, adjust the display with the
corresponding file name.
2 Run the user subtitute instruction, then exit with the command exit as
follows:
$ su student
$ exit
then use the - option as follows:
$ su – student
$ exit
Explain the differences between the two utilities.
https://github.com/syaifulahdan/os­practice|Operating System Practice |31 to 39 
3 Logout
a. Edit .bash_logout file, show message and hold for 5 seconds,
before execution logout
Echo "Thank you for the session given"
Sleep 5
Clear
4 History
a. Change the value of HISTSIZE from 1000 to 20
$ HISTSIZE=20
$ h
b. Use the history feature by editing the 5th line instruction from the
last instruction.
$ !­5
https://github.com/syaifulahdan/os­practice|Operating System Practice |32 to 39 
c. Repeat the last instruction. Use also ^ P and ^ N to navigate to the
history buffer
$ !!
d. Repeat the instructions on the history buffer of a certain number,
eg number 150
$ !150
e. Repeat instruction with "ls" prefix
$! ls
$!? ls?
Explain the different instructions above
https://github.com/syaifulahdan/os­practice|Operating System Practice |33 to 39 
5 Prompt String (PS)
a. Edit the .bash_profile file, replace the PS1 prompt with '>'. An
export instruction is required with the variable name of the variab le,
in order to change the PS1 variable known to all shells
PS1=’> ‘
export PS1
PS1 results experiment:
PS1=“! > “
69 > PS1=”d > “
Mon Sep 23 > PS1=”t > “
10:10:20 > PS1=”Saya=u > “
I =stD02001 > PS1=”w >”
~ > PS1=h >”
b. Change the color of the shell prompt in blue and blink.
https://github.com/syaifulahdan/os­practice|Operating System Practice |34 to 39 
6 Bash script
a. Create 3 p1sh, p2.sh, p3.sh script with their respective contents:
p1.sh
#! /bin/bash
echo “Program p1”
ls –l
p2.sh
#! /bin/bash
echo “Program p2”
Who
p3.sh
#! /bin/bash
echo “Program p3”
ps x
https://github.com/syaifulahdan/os­practice|Operating System Practice |35 to 39 
b. Run the following script and see the result:
$ ./p1.sh ; ./p3.sh ; ./p2.sh
$ ./p1.sh &
$ ./p1.sh $ ./p2.sh & ./p3.sh &
$ ( ./p1.sh ; ./p3.sh ) &
https://github.com/syaifulahdan/os­practice|Operating System Practice |36 to 39 
7 Jobs
a. Create a shell-script that does a loop with the name pwaktu.sh,
every 10 second, then save the date and time in the result file.
#!/bin/bash
while [ true ]
   Do
       date >> hasil
       Sleep 10
   Done
b. Run as background; then run one program (find utility)
$ jobs
$ find / ­print > files 2>/dev/null &
$ jobs
https://github.com/syaifulahdan/os­practice|Operating System Practice |37 to 39 
c. Make program 1 as foreground, press ^ Z and return the program
into the background
$ fg %1
$ bg
d. Stop background program with kill utility
$ ps x
$ kill [Nomor PID]
https://github.com/syaifulahdan/os­practice|Operating System Practice |38 to 39 

Practice Report : Practice 5B
1 Analyze your experimental results.
2 Do the above exercises and analyze the results.
3 Give a conclusion from this lab.
https://github.com/syaifulahdan/os­practice|Operating System Practice |39 to 39 

“Pleasure in a job makes perfection on the results 
achieved”. Aristoteles

“Believe you can. You're halfway”. Theodore Roosevelt

“You might be able to delay, but time will not wait”. 
Benjamin Franklin 

“The effort will work if someone does not give up”. 
Napoleon Hill

“Opportunity to find a better strength in us arises 
when life seems to be very challenging”. Joseph 
Campbell

More Related Content

What's hot

Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting BasicsDr.Ravi
 
Create your own composer package
Create your own composer packageCreate your own composer package
Create your own composer packageLattapon Yodsuwan
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyNikhil Mungel
 
Mastering unix
Mastering unixMastering unix
Mastering unixRaghu nath
 
Composer the right way - SunshinePHP
Composer the right way - SunshinePHPComposer the right way - SunshinePHP
Composer the right way - SunshinePHPRafael Dohms
 
Ten common mistakes made with Functional Java JBCNConf18
Ten common mistakes made with Functional Java JBCNConf18Ten common mistakes made with Functional Java JBCNConf18
Ten common mistakes made with Functional Java JBCNConf18Brian Vermeer
 
Don't Fear the Autotools
Don't Fear the AutotoolsDon't Fear the Autotools
Don't Fear the AutotoolsScott Garman
 
Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13Rafael Dohms
 
Common mistakes functional java vjug
Common mistakes functional java vjugCommon mistakes functional java vjug
Common mistakes functional java vjugBrian Vermeer
 
Common mistakes functional java | Oracle Code One 2018
Common mistakes functional java | Oracle Code One 2018Common mistakes functional java | Oracle Code One 2018
Common mistakes functional java | Oracle Code One 2018Brian Vermeer
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Building robust and friendly command line applications in go
Building robust and friendly command line applications in goBuilding robust and friendly command line applications in go
Building robust and friendly command line applications in goAndrii Soldatenko
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHubJames Gray
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with ComposerAdam Englander
 
OpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell ScriptingOpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell ScriptingOpen Gurukul
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell ScriptingMustafa Qasim
 

What's hot (20)

Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
 
Create your own composer package
Create your own composer packageCreate your own composer package
Create your own composer package
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in Ruby
 
Bash 4
Bash 4Bash 4
Bash 4
 
Mastering unix
Mastering unixMastering unix
Mastering unix
 
Composer the right way - SunshinePHP
Composer the right way - SunshinePHPComposer the right way - SunshinePHP
Composer the right way - SunshinePHP
 
Ten common mistakes made with Functional Java JBCNConf18
Ten common mistakes made with Functional Java JBCNConf18Ten common mistakes made with Functional Java JBCNConf18
Ten common mistakes made with Functional Java JBCNConf18
 
Don't Fear the Autotools
Don't Fear the AutotoolsDon't Fear the Autotools
Don't Fear the Autotools
 
Git::Hooks
Git::HooksGit::Hooks
Git::Hooks
 
Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13
 
Common mistakes functional java vjug
Common mistakes functional java vjugCommon mistakes functional java vjug
Common mistakes functional java vjug
 
Common mistakes functional java | Oracle Code One 2018
Common mistakes functional java | Oracle Code One 2018Common mistakes functional java | Oracle Code One 2018
Common mistakes functional java | Oracle Code One 2018
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
bash
bashbash
bash
 
Building robust and friendly command line applications in go
Building robust and friendly command line applications in goBuilding robust and friendly command line applications in go
Building robust and friendly command line applications in go
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
OpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell ScriptingOpenGurukul : Language : Shell Scripting
OpenGurukul : Language : Shell Scripting
 
Unix Shell Scripting
Unix Shell ScriptingUnix Shell Scripting
Unix Shell Scripting
 
groovy & grails - lecture 9
groovy & grails - lecture 9groovy & grails - lecture 9
groovy & grails - lecture 9
 

Similar to Operating System Practice : Meeting 8- bekerja dengan bash shell-b-slide

Operating System Practice : Meeting 2-basic commands linux operating system-s...
Operating System Practice : Meeting 2-basic commands linux operating system-s...Operating System Practice : Meeting 2-basic commands linux operating system-s...
Operating System Practice : Meeting 2-basic commands linux operating system-s...Syaiful Ahdan
 
Operating System Practice : Meeting 9 pemrograman shell - a -slide
Operating System Practice : Meeting 9   pemrograman shell - a -slideOperating System Practice : Meeting 9   pemrograman shell - a -slide
Operating System Practice : Meeting 9 pemrograman shell - a -slideSyaiful Ahdan
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using SwiftDiego Freniche Brito
 
Makefile for python projects
Makefile for python projectsMakefile for python projects
Makefile for python projectsMpho Mphego
 
The Scientific Filesystem
The Scientific FilesystemThe Scientific Filesystem
The Scientific FilesystemVanessa S
 
Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]Benny Siegert
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Pantheon
 
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Antonio Peric-Mazar
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshareCavelle Benjamin
 
Red Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift MessengerRed Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift MessengerJustin Bui
 
BACKGROUND A shell provides a command-line interface for users. I.docx
BACKGROUND A shell provides a command-line interface for users. I.docxBACKGROUND A shell provides a command-line interface for users. I.docx
BACKGROUND A shell provides a command-line interface for users. I.docxwilcockiris
 
Operating System Practice : Meeting 3 - operasi input output-slide
Operating System Practice : Meeting 3 - operasi input output-slideOperating System Practice : Meeting 3 - operasi input output-slide
Operating System Practice : Meeting 3 - operasi input output-slideSyaiful Ahdan
 
Linuxppt
LinuxpptLinuxppt
LinuxpptReka
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008guestd9065
 

Similar to Operating System Practice : Meeting 8- bekerja dengan bash shell-b-slide (20)

Operating System Practice : Meeting 2-basic commands linux operating system-s...
Operating System Practice : Meeting 2-basic commands linux operating system-s...Operating System Practice : Meeting 2-basic commands linux operating system-s...
Operating System Practice : Meeting 2-basic commands linux operating system-s...
 
Licão 05 scripts exemple
Licão 05 scripts exempleLicão 05 scripts exemple
Licão 05 scripts exemple
 
Operating System Practice : Meeting 9 pemrograman shell - a -slide
Operating System Practice : Meeting 9   pemrograman shell - a -slideOperating System Practice : Meeting 9   pemrograman shell - a -slide
Operating System Practice : Meeting 9 pemrograman shell - a -slide
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
Makefile for python projects
Makefile for python projectsMakefile for python projects
Makefile for python projects
 
The Scientific Filesystem
The Scientific FilesystemThe Scientific Filesystem
The Scientific Filesystem
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 
Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
 
Dependent things dependency management for apple sw - slideshare
Dependent things   dependency management for apple sw - slideshareDependent things   dependency management for apple sw - slideshare
Dependent things dependency management for apple sw - slideshare
 
Red Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift MessengerRed Teaming macOS Environments with Hermes the Swift Messenger
Red Teaming macOS Environments with Hermes the Swift Messenger
 
Composer Helpdesk
Composer HelpdeskComposer Helpdesk
Composer Helpdesk
 
Python1
Python1Python1
Python1
 
BACKGROUND A shell provides a command-line interface for users. I.docx
BACKGROUND A shell provides a command-line interface for users. I.docxBACKGROUND A shell provides a command-line interface for users. I.docx
BACKGROUND A shell provides a command-line interface for users. I.docx
 
Operating System Practice : Meeting 3 - operasi input output-slide
Operating System Practice : Meeting 3 - operasi input output-slideOperating System Practice : Meeting 3 - operasi input output-slide
Operating System Practice : Meeting 3 - operasi input output-slide
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008
 
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 

More from Syaiful Ahdan

Sertifikat EC00202128391
 Sertifikat EC00202128391 Sertifikat EC00202128391
Sertifikat EC00202128391Syaiful Ahdan
 
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...Syaiful Ahdan
 
Sertifikat ec00202059774
Sertifikat ec00202059774Sertifikat ec00202059774
Sertifikat ec00202059774Syaiful Ahdan
 
Sertifikat ec00202059775
Sertifikat ec00202059775Sertifikat ec00202059775
Sertifikat ec00202059775Syaiful Ahdan
 
Sertifikat EC00202045078
Sertifikat EC00202045078Sertifikat EC00202045078
Sertifikat EC00202045078Syaiful Ahdan
 
Sertifikat EC00202044723
 Sertifikat EC00202044723 Sertifikat EC00202044723
Sertifikat EC00202044723Syaiful Ahdan
 
Sertifikat EC00202023523
Sertifikat EC00202023523Sertifikat EC00202023523
Sertifikat EC00202023523Syaiful Ahdan
 
Sertifikat EC00201826309
Sertifikat EC00201826309Sertifikat EC00201826309
Sertifikat EC00201826309Syaiful Ahdan
 
Sertifikat EC00202023149
Sertifikat EC00202023149Sertifikat EC00202023149
Sertifikat EC00202023149Syaiful Ahdan
 
Sertifikat EC00202022868
Sertifikat EC00202022868Sertifikat EC00202022868
Sertifikat EC00202022868Syaiful Ahdan
 
Sertifikat EC00202021343
Sertifikat EC00202021343Sertifikat EC00202021343
Sertifikat EC00202021343Syaiful Ahdan
 
Sertifikat EC00202022755
Sertifikat EC00202022755Sertifikat EC00202022755
Sertifikat EC00202022755Syaiful Ahdan
 
Sertifikat EC00201987196
Sertifikat EC00201987196Sertifikat EC00201987196
Sertifikat EC00201987196Syaiful Ahdan
 
Sertifikat EC00201856484
Sertifikat EC00201856484Sertifikat EC00201856484
Sertifikat EC00201856484Syaiful Ahdan
 
Sertifikat EC00201856352
Sertifikat EC00201856352Sertifikat EC00201856352
Sertifikat EC00201856352Syaiful Ahdan
 
Sertifikat EC00201856994
Sertifikat EC00201856994Sertifikat EC00201856994
Sertifikat EC00201856994Syaiful Ahdan
 
Sertifikat EC00201856895
Sertifikat EC00201856895Sertifikat EC00201856895
Sertifikat EC00201856895Syaiful Ahdan
 
Meeting 2 introdcution network administrator
Meeting 2   introdcution network administratorMeeting 2   introdcution network administrator
Meeting 2 introdcution network administratorSyaiful Ahdan
 

More from Syaiful Ahdan (20)

Sertifikat EC00202128391
 Sertifikat EC00202128391 Sertifikat EC00202128391
Sertifikat EC00202128391
 
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
SP2JPB - Aplikasi Sistem Pelayanan Pemesanan Jasa Perbaikan Pada Bengkel Alam...
 
Sertifikat ec00202059774
Sertifikat ec00202059774Sertifikat ec00202059774
Sertifikat ec00202059774
 
Sertifikat ec00202059775
Sertifikat ec00202059775Sertifikat ec00202059775
Sertifikat ec00202059775
 
Sertifikat EC00202045078
Sertifikat EC00202045078Sertifikat EC00202045078
Sertifikat EC00202045078
 
Sertifikat EC00202044723
 Sertifikat EC00202044723 Sertifikat EC00202044723
Sertifikat EC00202044723
 
Sertifikat EC00202023523
Sertifikat EC00202023523Sertifikat EC00202023523
Sertifikat EC00202023523
 
Sertifikat EC00201826309
Sertifikat EC00201826309Sertifikat EC00201826309
Sertifikat EC00201826309
 
Sertifikat EC00202023149
Sertifikat EC00202023149Sertifikat EC00202023149
Sertifikat EC00202023149
 
Sertifikat EC00202022868
Sertifikat EC00202022868Sertifikat EC00202022868
Sertifikat EC00202022868
 
Sertifikat EC00202021343
Sertifikat EC00202021343Sertifikat EC00202021343
Sertifikat EC00202021343
 
Sertifikat EC00202022755
Sertifikat EC00202022755Sertifikat EC00202022755
Sertifikat EC00202022755
 
Sertifikat EC00201987196
Sertifikat EC00201987196Sertifikat EC00201987196
Sertifikat EC00201987196
 
Sertifikat EC00201856484
Sertifikat EC00201856484Sertifikat EC00201856484
Sertifikat EC00201856484
 
Sertifikat EC00201856352
Sertifikat EC00201856352Sertifikat EC00201856352
Sertifikat EC00201856352
 
Sertifikat EC00201856994
Sertifikat EC00201856994Sertifikat EC00201856994
Sertifikat EC00201856994
 
Sertifikat EC00201856895
Sertifikat EC00201856895Sertifikat EC00201856895
Sertifikat EC00201856895
 
Meeting 2 introdcution network administrator
Meeting 2   introdcution network administratorMeeting 2   introdcution network administrator
Meeting 2 introdcution network administrator
 
Pertemuan 5
Pertemuan 5Pertemuan 5
Pertemuan 5
 
Pertemuan 4
Pertemuan 4Pertemuan 4
Pertemuan 4
 

Recently uploaded

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 

Recently uploaded (20)

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

Operating System Practice : Meeting 8- bekerja dengan bash shell-b-slide

  • 1. https://github.com/syaifulahdan/os­practice|Operating System Practice |1 to 39  OPERATING SYSTEMS PRACTICE Working With Bash Shell Practice : 5B  History on Bash Shell  Creating a Bash Shell Script https://github.com/syaifulahdan/os­practice|
  • 2. https://github.com/syaifulahdan/os­practice|Operating System Practice |2 to 39  A. Objectives 1. Understanding the shell on Linux operating system. 2. Using feature history in Bash Shell. 3. Change the history feature in Bash Shell. 4. the shell prompt. 5. Configure Bash Shell to run scripts automatically. 6. Create and execute simple shell scripts via vi editor. 7. Understand the job control. 8. Understand the stack. 9. Using aliases
  • 4. https://github.com/syaifulahdan/os­practice|Operating System Practice |4 to 39  1. SHELL Shell is a Command executive, meaning the program awaits the user's instructions, checks the syntax of the given instruction, then executes the command. Shell is marked with a prompt. For user use prompt $ and for superuser use promp #. shell type:  /bin/sh Developed by UNIX Berkeley known as C-Shell  /bin/csh Bourne shell, designed by Steve Bourne of AT & T  /bin/bash Compatible with Bourne Shell and also adapting Korn-Shell's ability. The fundamental difference between Shell is resolved almost non- existent, except in programming and editing facilities.
  • 5. https://github.com/syaifulahdan/os­practice|Operating System Practice |5 to 39  1. SHELL Shell is a Command executive, meaning the program awaits the user's instructions, checks the syntax of the given instruction, then executes the command. Shell is marked with a prompt. For user use prompt $ and for superuser use promp #. shell type:  /bin/sh Developed by UNIX Berkeley known as C-Shell  /bin/csh Bourne shell, designed by Steve Bourne of AT & T  /bin/bash Compatible with Bourne Shell and also adapting Korn-Shell's ability. The fundamental difference between Shell is resolved almost non- existent, except in programming and editing facilities.
  • 6. https://github.com/syaifulahdan/os­practice|Operating System Practice |6 to 39  2. PROFILE At login time, the program will run some program that is: 1. /etc/profile It contains a shell script that applies to all Linux users. 2. Profile for each user In the home directory, the login will first check the .bash_profile file. If no, then the .bash_login file will be searched. If .bash_login does not exist, then look for file named .profile 3. .bashrc This file will be executed for switching from one shell to another through su. 4. .bash_logout At logout, bash will search for file .bash_logout. When present, the file will be executed before logout
  • 7. https://github.com/syaifulahdan/os­practice|Operating System Practice |7 to 39  The contents of / etc / profile: # System wide environment and startup programs # Functions and aliases go in /etc/bashrc PATH=”$PATH:/usr/X11R6/bin” PS1=”[u@h W]$ “ umask 022 USER=’id –un’ LOGNAME=$USER MAIL=”/var/spool/mail/$USER” HOSTNAME=’/bi n/hostname’ HISTSIZE=1000 HISTFILESIZE=1000 Export  PATH  PS1  HOSTNAME  HISTSIZE  HISTFILESIZE  USER  LOGNAME MAIL
  • 8. https://github.com/syaifulahdan/os­practice|Operating System Practice |8 to 39  PATH merupakan daftar nama direktori. Bila sebuah instruksi diberikan dari prompt shell, maka instruksi tersebut akan dicari pada daftar tersebut. PS1 adalah prompt dimana u = Nama User h = Nama Host W = Nama working direktory
  • 9. https://github.com/syaifulahdan/os­practice|Operating System Practice |9 to 39  3. HISTORY History is adapted from C-Shell, which is a record of all the instructions that have so far been done. These records can be viewed as history, then can be re- selected, edited and executed. History allows the user to re-edit complex and lengthy instructions, especially when errors occur in the writing of instructions and parameters. ^P (Ctrl-P) see previous instructions ^N (Ctrl-N see the next instruction !! execution of previous instructions !! –3 3 previous instructions will be repeated !!88 repeat instruction no 88
  • 10. https://github.com/syaifulahdan/os­practice|Operating System Practice |10 to 39  4. BASH-SCRIPT Bash-script is a file that contains a collection of executable programs. For bash script execution use . before the bash-script file which means shell and sign execution ./ means the bash-script file is in the actual directory.
  • 11. https://github.com/syaifulahdan/os­practice|Operating System Practice |11 to 39  5. JOB CONTROL Job is a program execution given to the kernel. A Job is deemed complete, when the execution of the program ends. Execution Job is the same as the execution of the program, both Background process and Foreground process.
  • 12. https://github.com/syaifulahdan/os­practice|Operating System Practice |12 to 39  5. EDITOR vi Vi is a full screen editor, meaning the editor can take advantage of the full-screen facility. Vi has 2 pieces mode, namely:  Command line The vi editor interprets the input as an instruction to be executed by the editor, examples such as searching text, changing text automatically and others.  Editing The vi editor interprets the output as text to be inserted into the buffer editor. At the bottom of the screen will display the text "INSERTING".
  • 13. https://github.com/syaifulahdan/os­practice|Operating System Practice |13 to 39  At the beginning of vi run, the program enters command mode. With pressing the "i" button will then enter editing. To return to command mode, press the Esc key. The keys of the vi editor text can be seen in the table as follows: H Move cursor to left one character J Move the cursor to the right of one character K Pinda h kursor ke atas L Move the cursor down O Insert text (one line after cursor position) To exit the 5 insert lock models next to this and activate other keys, then we must press the Esc key first I Insert text (to the left of the cursor position) A Insert text (to the right of the cursor position) I (Shift i) Insert text (in the starting position of the line) A (Shift a) Insert text (at the end of the line)
  • 14. https://github.com/syaifulahdan/os­practice|Operating System Practice |14 to 39  X Deleting 1 letter (to the right of the cursor position) Dw Delete 1 word (to the right of the cursor position) Dd Removing 1 row (to the right of cursor position) Yy Copying 1 line 2yy Copying 2 lines P (Paste) Displays a sentence line that has been copied with yy key. Cw Replace 1 word that has been written to the right of the cursor position with another word Cc Replace 1 sentence line that has been written to the right of the cursor position with another sentence ctrl- b Reverse one screen ctrl- f Forward one screen ctrl- d Forward half screen B Move the cursor to the left of one word W Move the cursor to the right of one word ^ Go to the beginning of the line $ Go to the end of the line U Cancel the last command U Undoes all text changes on the line where the cursor is located :! Quit temporarily from vi editor and execute another command
  • 15. https://github.com/syaifulahdan/os­practice|Operating System Practice |15 to 39  :wq Write and quite, save the file and exit :q! Exit vi without saving :se all Displays all set status options :se nu Displays the line number on the left of the screen /string Looking for strings forward ?string Looking for strings toward the back N Forward the search for the same direction N Continue searching for different directions
  • 17. https://github.com/syaifulahdan/os­practice|Operating System Practice |17 to 39  1 Login as user. 2 Open the Console Terminal and do the experiments below and then analyze the results of the experiment. 3 Conduct the experiments below and then analyze the experimental results. 4 Complete the practice questions.
  • 19. https://github.com/syaifulahdan/os­practice|Operating System Practice |19 to 39  Experiment 6 : Create and run Bash- scripts 1. Create a p1.sh file $ vi p1.sh echo "bash Script Program" 2. Change the program to an executable $ ls –l p1.sh $ chmod +x p1.sh $ ls –l p1.sh
  • 20. https://github.com/syaifulahdan/os­practice|Operating System Practice |20 to 39  3. Running the script $ bash p1.sh $ sh p1.sh $ . p1.sh $ ./p1.sh 4. The convention in shell script creation is expressed as #!/ Bin/bash. Add to the p1.sh file of the convention. $ vi p1.sh #!/bin/bash echo “Program bash script”
  • 21. https://github.com/syaifulahdan/os­practice|Operating System Practice |21 to 39  5. Create a p2.sh file $ vi p2.sh #!/bin/bash echo “Program 2 bash script” 6. Running multiple shell programs in a single line of instructions separated by a sign; $ cat p1.sh ; cat p2.sh $ ./p1.sh ; ./p2.sh
  • 22. https://github.com/syaifulahdan/os­practice|Operating System Practice |22 to 39  Experiment 7 : Job Control 1. Foreground process 2. Background Proses $ ps x > hasil & $ ps x 3. Each job has a single PID (unique). To see which jobs active $ jobs
  • 23. https://github.com/syaifulahdan/os­practice|Operating System Practice |23 to 39  4. Create a ploop.sh file. This file will never stop unless it is pressed Ctrl-C $ vi ploop.sh #!/bin/bash while [ true ] Do       Sleep 10       echo “Hallo” done
  • 24. https://github.com/syaifulahdan/os­practice|Operating System Practice |24 to 39  5. Make a ploop.sh file into an executable. Run the program, will display the word Hallo every 10 seconds. To exit the program, press Ctrl-C (^ C) $ chmod +x ploop.sh $ ./ploop.sh
  • 25. https://github.com/syaifulahdan/os­practice|Operating System Practice |25 to 39  Experiment 8 : Manipulation stack for Directories 1. Dirs instruction is used to view the directory stack, the output is displayed only home directory ~ $ dirs 2. Create 3 directory pieces $ mkdir marketing sales support 3. Dirs instruction is used to view the directory stack, the output is displayed only home directory ~ $ dirs
  • 26. https://github.com/syaifulahdan/os­practice|Operating System Practice |26 to 39  Experiment 9 : Alias 1. Alias is a mechanism for naming aliases on one or a group of instructions. To view aliases that have been registered on the system: $ alias 2. Create multiple aliases $ alias del=’rm –i’ $ alias h=’history’
  • 27. https://github.com/syaifulahdan/os­practice|Operating System Practice |27 to 39  3. Gunakan instruksi hasil alias $ ls $ del hasil $ h | more 4. To remove aliases use unalias instructions $ unalias del $ del files (Error Messages, why?)
  • 29. https://github.com/syaifulahdan/os­practice|Operating System Practice |29 to 39   Exercise : Practice 5B 1 Execution of all existing profiles: a. Edit the profile file /etc/profile and display the message as follows: echo 'Profile of / etc / profile' b. Assuming your name is student, then edit all existing profiles: /home/student /.bash_profile /home/. student/.bash_login /home/student /.profile /home/student /.bashrc
  • 30. https://github.com/syaifulahdan/os­practice|Operating System Practice |30 to 39  c. Rename /home/student with your own name. , include the echo instruction, eg On each file in /home/student/.bash_profile: echo "Profile from .bash_profile" d. Do the same for other files, adjust the display with the corresponding file name. 2 Run the user subtitute instruction, then exit with the command exit as follows: $ su student $ exit then use the - option as follows: $ su – student $ exit Explain the differences between the two utilities.
  • 31. https://github.com/syaifulahdan/os­practice|Operating System Practice |31 to 39  3 Logout a. Edit .bash_logout file, show message and hold for 5 seconds, before execution logout Echo "Thank you for the session given" Sleep 5 Clear 4 History a. Change the value of HISTSIZE from 1000 to 20 $ HISTSIZE=20 $ h b. Use the history feature by editing the 5th line instruction from the last instruction. $ !­5
  • 32. https://github.com/syaifulahdan/os­practice|Operating System Practice |32 to 39  c. Repeat the last instruction. Use also ^ P and ^ N to navigate to the history buffer $ !! d. Repeat the instructions on the history buffer of a certain number, eg number 150 $ !150 e. Repeat instruction with "ls" prefix $! ls $!? ls? Explain the different instructions above
  • 33. https://github.com/syaifulahdan/os­practice|Operating System Practice |33 to 39  5 Prompt String (PS) a. Edit the .bash_profile file, replace the PS1 prompt with '>'. An export instruction is required with the variable name of the variab le, in order to change the PS1 variable known to all shells PS1=’> ‘ export PS1 PS1 results experiment: PS1=“! > “ 69 > PS1=”d > “ Mon Sep 23 > PS1=”t > “ 10:10:20 > PS1=”Saya=u > “ I =stD02001 > PS1=”w >” ~ > PS1=h >” b. Change the color of the shell prompt in blue and blink.
  • 34. https://github.com/syaifulahdan/os­practice|Operating System Practice |34 to 39  6 Bash script a. Create 3 p1sh, p2.sh, p3.sh script with their respective contents: p1.sh #! /bin/bash echo “Program p1” ls –l p2.sh #! /bin/bash echo “Program p2” Who p3.sh #! /bin/bash echo “Program p3” ps x
  • 35. https://github.com/syaifulahdan/os­practice|Operating System Practice |35 to 39  b. Run the following script and see the result: $ ./p1.sh ; ./p3.sh ; ./p2.sh $ ./p1.sh & $ ./p1.sh $ ./p2.sh & ./p3.sh & $ ( ./p1.sh ; ./p3.sh ) &
  • 36. https://github.com/syaifulahdan/os­practice|Operating System Practice |36 to 39  7 Jobs a. Create a shell-script that does a loop with the name pwaktu.sh, every 10 second, then save the date and time in the result file. #!/bin/bash while [ true ]    Do        date >> hasil        Sleep 10    Done b. Run as background; then run one program (find utility) $ jobs $ find / ­print > files 2>/dev/null & $ jobs
  • 37. https://github.com/syaifulahdan/os­practice|Operating System Practice |37 to 39  c. Make program 1 as foreground, press ^ Z and return the program into the background $ fg %1 $ bg d. Stop background program with kill utility $ ps x $ kill [Nomor PID]
  • 38. https://github.com/syaifulahdan/os­practice|Operating System Practice |38 to 39   Practice Report : Practice 5B 1 Analyze your experimental results. 2 Do the above exercises and analyze the results. 3 Give a conclusion from this lab.
  • 39. https://github.com/syaifulahdan/os­practice|Operating System Practice |39 to 39   “Pleasure in a job makes perfection on the results  achieved”. Aristoteles  “Believe you can. You're halfway”. Theodore Roosevelt  “You might be able to delay, but time will not wait”.  Benjamin Franklin   “The effort will work if someone does not give up”.  Napoleon Hill  “Opportunity to find a better strength in us arises  when life seems to be very challenging”. Joseph  Campbell