Bash Shell On MAC and Linux
Bash Shell On MAC and Linux
Why bash?
Why Bash
UNIX Philosophy:
BSD:
Write programs that do one thing and do it
well OpenBSD, FreeBSD, NetBSD, Mac OS
Write programs to work together
BSD kernel, BSD Tools
Bash is the default shell on Mac OS and Linux but tools and
utilities differ
Introduction
MAC OS:
Open index.html - Opens html file in browser
Open . – Opens current directory in Finder
Open –a preview picture..jpg – Opens Picture.jpg with preview
Absolute paths and relative paths
Move: mv
Mv a b
Mv a dir/b
Mv a b c dir
Mv fir/a.
Mv * dir
Sed
Stream editor
Transform text
Replace words
Most common use: to replace “old” with “new”
Sed ‘s/old/new/g’
Awk
Complete programming language
Jobs and Processes
Job control
^Z Suspends a running job
Fg – send job to foreground
Bg- send job to background
Background jobs : cannot read i/p rfom user,
Killing