SlideShare a Scribd company logo
Terminal 101
Unix Commands for Mac OSX
History of the Mac
●
Unix Based (Free BSD / AT&T 6th
Edition Unix)
●
Kernel called Darwin (open sourced)
●
Xnu – Developed by NeXT later bought by
Apple (Tim invented the internet on NeXT, while at CERN. So
the internet was created on the MAC...)
●
uname -a (to see the version)
●
Basically they got Mach Kernel (Carnegie Mellon University) and
built new drivers using the Objective C apis.
Finding Help
●
man --help , xman (if you have X11 or XQuartz),
whatis, info
●
Developer.apple.com
●
Macrumors.com (Forums)
●
Lifehacker.com
●
Ss64.com/osx
●
Mac OSX Unix Toolbox (Book)
Types of Commands
●
Core or Default Set
●
File or Folder Management
●
System Administration
●
Networking, Email & Internet
●
Text, Editors and Manipulation
●
Pipes, Redirection and scripting
●
Developer Commands
Types of Shells
●
bash – Bourne Again 1989 (Default)
●
zsh – Z Shell 1990
●
tcsh – C Shell 1978
●
sh – Bourne Shell 1977
●
Korn Shell 1983
●
Thompson Shell 1971
●
echo $SHELL ; chsh -s /bin/zsh
for version in "${maya_versions[@]}";
do
echo -n "Checking for ..... Maya $version";
maya_script_dir="$HOME/Library/Preferences/Autodesk/maya/$version-x64/scripts";
# echo $maya_script_dir
if [ -w "$maya_script_dir" ];
then
echo " ... Yes Found!";
echo "... $maya_script_dir";
echo -n "... Checking for existing files ...";
if [ -f "$maya_script_dir/mkUtils.pyc" ];
then
echo " Yes Found!";
echo "... $maya_script_dir/mkUtils.pyc";
mv "$maya_script_dir/mkUtils.pyc" ~/.Trash/;
echo "... mkUtils.pyc moved to Trash!"
else
echo " Not Found!";
fi
cp ./mkUtils.py $maya_script_dir
echo "... Installed mkUtils.py"
else
echo " ... Not found!";
fi
done
Lets get started...
Navigating...
●
ls - List
●
pwd – print working directory
●
cd – change directory
●
clear – Clear Screen
●
./ - current directory
●
../ - parent directory
●
~ - user home directory
●
- - last path
Example...
$ cd ~
$ ls -a
$ ls -l
$ ls -R
$ ls -lh
$ cd ../Shared/
$ pwd
File and Folder Management
●
touch – create new file
●
cp – copy
●
mv – move / rename
●
rm – remove
●
mkdir – create new
directory
●
rmdir – remove directory
(empty only)
Example
$ cd ~/Desktop
$ mkdir -p Test/First
$ touch ./Test/First/newFile.txt
●
$ cd Test/First
●
$ ls
●
$ cp newFile.txt ../secondFile.txt
●
$ rm newFile.txt
●
$ cd ..
●
$ rmdir First/
●
$ cd ..
●
$ rm -r Test/
System Administration 1
●
top – currently running
processes
●
ps – process status
●
kill – stop running process
●
open – open files and
directories
●
pgrep – find process by name
●
installer – install mac
packages
●
softwareupdate – mac updates
●
df – display free disk space
●
du – display disk usage
●
diskutil – mac disk utils
Example
$ open -a firefox
$ ps -ax
$ pgrep firefox
$ kill 905
$ df -h
$ du -h
$ installer -pkg
Package.pkg /
$ softwareupdate --list
Permissions, Groups & Users
●
chown – change ownership
●
chmod – change access
permission
●
dscl – directory service
command line (create,
modify users and groups)
●
Example
$ chmod u+x
$ chown kumar file.txt
drwx------+
Directory File Link | User Read Write Execute Group Read Write Execute Other Read Write Execute
Viewing Text (Logs)
●
cat – concatenate
●
less – view less
●
more – view more
●
head – view head
●
tail – view tail
●
syslog – view
system.log
Examples
$ cat /var/log/system.log
$ less /var/log/system.log
$ more /var/log/system.log
$ head /var/log/system.log
$ tail /var/log/system.log
$ ls ~/Library/Logs/
$ ls /var/log
Selecting Searching Sorting
●
grep – text pattern search
●
find – path file search
●
locate – indexed search,
disabled by default
●
mdfind – Spotlight cli
●
sort – sort text
●
uniq – find duplicates
Examples
$ grep AppleTalk /etc/services
$ find /Volumes/Data/Magazine/ -iname "*mac*"
$ mdfind -name TextEdit
$ mdfind -onlyin ~/Desktop/ Artist
$ ls -l | sort -fi
$ sort sortingTest.txt
$ sort sortingTest.txt | uniq
Manipulating Text
●
awk - pattern-directed scanning
and processing language
●
sed - stream editor language
●
vim - Vi IMproved, a programmers
text editor
●
emacs - GNU project Emacs
●
nano - Nano's ANOther editor, an
enhanced free Pico clone
●
pico – pine package text editor
Vim - : , i , :wq , :help, :x
CTRL-] to jump to a subject under the cursor.
CTRL-O to jump back (repeat to go further
back).
Emacs – Control + x followed by Control + c (to
quit)
^ means Control
●
ls -l | awk '{print $3}'
●
echo Hi there how are you? |
sed s/you/me/
●
$ ls -l | sed
s/staff/Kumaran/
●
emacs
●
Esc + x
●
tetris
Pipes and Redirection
●
| - pipe or pass
●
> - redirect output
●
>> - Append
●
< - Read input
●
curl -s http://www.angeltv.org | grep Description |
awk -F = '{print $3}' | sed 's/>//'
●
cat /usr/share/dict/words | grep -E '(Aaron|Moses)'
●
echo "Hi there how are you" >> test.txt
●
tr "[:lower:]" "[:upper:]" < test.txt
●
ifconfig | grep broadcast | ping -c 3 “$(awk
'{print $6}')” | grep 'bytes from' | awk '{print
$4}' | sort | unique
Networking 1
●
ifconfig – network card
configuration
●
ipconfig - view and
control IP
●
traceroute - print the
route packets take to
network host
●
nslookup - query Internet
name servers
●
ping - check a remote host
for reachability
●
telnet - TELNET protocol
Examples
$ ping -c 3 www.google.com
$ ping -i 60 182.19.95.34
$ ping -S 192.168.1.73
192.168.1.1
$ ipconfig getifaddr en0
$ nslookup openmail.angeltv.org
$ telnet towel.blinkenlights.nl
Networking 2
Examples
# Get ip address
$ ipconfig getifaddr en1
# Enable Network Interface
$ ifconfig en1 up
# Disable Network Interface
$ ifconfig en1 down
# Set ip address
$ ifconfig en1 inet 192.168.2.1
# Set netmask
$ ifconfig en1 netmask
255.255.255.0
Examples
# Change MTU
$ ifconfig en1 mtu 1000
networksetup -listallnetworkservices
networksetup -getdnsservers Wi-Fi
networksetup -setmanual Wi-Fi
10.0.0.2 255.255.255.0 10.0.0.1
netstat -nr # routing tables
netstat -at # all sockets
lsof -n -i4TCP # ports binary
iostat -d disk0 # disk stats
dscacheutil -flushcache # 10.5-6
sudo killall -HUP mDNSResponder
arp -ad # Flush arp cache
Internet
●
mail
●
sendmail
●
curl - transfer a
URL
●
wget – Need to
install (Popular)
●
ftp - Internet file
transfer program
$ curl -s http://www.angeltv.org
$ curl
http://edge.sin1.swiftserve.com/ange
ltv/angeltvlfd/downloads/GOTK_Englis
h_Ver4.pdf -O
$ curl -u user:pass -O
ftp://.../file.zip
$ echo “Hi how are you?” | mail -s
“From Mac” kumar@angeltv.org
$ printf “Subject: Hi how are you?”
| sendmail -f kumar@angeltv.org
kumar@angeltv.org
Misc... Stuff
●
date – Date and Time
●
time – time processes
●
cal – calender
●
dc – desktop calculator
●
GetFileInfo - HFS+
●
history – command history
●
pbcopy – clipboard copy
●
pbpaste – clipboard paste
●
zip – PKZip zip
●
unzip – PKZip unzip
●
shutdown
●
who, whoami, hostname,
finger
●
wc – word/line count
●
say – speak
●
caffeinate – prevent
sleep
●
yes – stress test
●
md5, shasum – file hash
●
alias, unalias, ln
Closing Thoughts...
There are many more commands, too much to cover in one sitting.
If needed we could do a 202 level course and cover more
advanced stuff.
Example : remote connection to another system, transferring files, mounting and
partitioning raids, scheduling commands to run at a specific date and time and
further automation.
If needed, we could do a 303 level course and cover bash scripting
and other such workflows.
A 404 level course will be the highest, where we go into the
developer commands, like make and git.
But we should consider, moving on to python, ruby or other such
scripting languages to better automate things and build better
applications. Mac has python and ruby already inside it...
Thank you,
The end...By : Kumar (kumar@angeltv.org)

More Related Content

What's hot

Basic linux commands
Basic linux commands Basic linux commands
Basic linux commands
Raghav Arora
 
Tips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development EfficiencyTips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development Efficiency
Olivier Bourgeois
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsTop 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu Commands
Yusuf Felly
 
BASIC COMMANDS OF LINUX
BASIC COMMANDS OF LINUXBASIC COMMANDS OF LINUX
Common linux ubuntu commands overview
Common linux  ubuntu commands overviewCommon linux  ubuntu commands overview
Common linux ubuntu commands overview
Ameer Sameer
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
Dheeraj Nambiar
 
Unix Ramblings
Unix RamblingsUnix Ramblings
Unix Ramblings
Bill Miller
 
Linux networking
Linux networkingLinux networking
Linux networking
Arie Bregman
 
Comets notes
Comets notesComets notes
Comets notes
Ilija Dukovski
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Rizky Abdilah
 
linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014
Peter Martin
 
Anandha ganesh linux1.ppt
Anandha ganesh linux1.pptAnandha ganesh linux1.ppt
Anandha ganesh linux1.ppt
anandha ganesh
 
Unix - Filters/Editors
Unix - Filters/EditorsUnix - Filters/Editors
Unix - Filters/Editors
ananthimurugesan
 
Unix for Librarians
Unix for LibrariansUnix for Librarians
Unix for Librarians
Ravi Mynampaty
 
Linux commd
Linux commdLinux commd
Linux commd
ragav03
 
Linux commd
Linux commdLinux commd
Linux commd
ragav03
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
sathish sak
 
Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash script
Simon Su
 
Basic linux day 5
Basic linux day 5Basic linux day 5
Basic linux day 5
Saikumar Daram
 
Shell programming
Shell programmingShell programming
Shell programming
Moayad Moawiah
 

What's hot (20)

Basic linux commands
Basic linux commands Basic linux commands
Basic linux commands
 
Tips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development EfficiencyTips and Tricks for Increased Development Efficiency
Tips and Tricks for Increased Development Efficiency
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsTop 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu Commands
 
BASIC COMMANDS OF LINUX
BASIC COMMANDS OF LINUXBASIC COMMANDS OF LINUX
BASIC COMMANDS OF LINUX
 
Common linux ubuntu commands overview
Common linux  ubuntu commands overviewCommon linux  ubuntu commands overview
Common linux ubuntu commands overview
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Unix Ramblings
Unix RamblingsUnix Ramblings
Unix Ramblings
 
Linux networking
Linux networkingLinux networking
Linux networking
 
Comets notes
Comets notesComets notes
Comets notes
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014
 
Anandha ganesh linux1.ppt
Anandha ganesh linux1.pptAnandha ganesh linux1.ppt
Anandha ganesh linux1.ppt
 
Unix - Filters/Editors
Unix - Filters/EditorsUnix - Filters/Editors
Unix - Filters/Editors
 
Unix for Librarians
Unix for LibrariansUnix for Librarians
Unix for Librarians
 
Linux commd
Linux commdLinux commd
Linux commd
 
Linux commd
Linux commdLinux commd
Linux commd
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
 
Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash script
 
Basic linux day 5
Basic linux day 5Basic linux day 5
Basic linux day 5
 
Shell programming
Shell programmingShell programming
Shell programming
 

Similar to Mac OSX Terminal 101

Linux
LinuxLinux
An Introduction To Linux
An Introduction To LinuxAn Introduction To Linux
An Introduction To Linux
Ishan A B Ambanwela
 
Perl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one linersPerl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one liners
Kirk Kimmel
 
Bullwinkle introduction
Bullwinkle introductionBullwinkle introduction
Bullwinkle introduction
Turner England
 
Bash Scripting Workshop
Bash Scripting WorkshopBash Scripting Workshop
Bash Scripting Workshop
Ahmed Magdy Ezzeldin, MSc.
 
Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet
Isham Rashik
 
Linux device drivers
Linux device drivers Linux device drivers
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
Hanan Nmr
 
A journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service managementA journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service management
Lubomir Rintel
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01
Chander Pandey
 
Linux tech talk
Linux tech talkLinux tech talk
Linux tech talk
Prince Raj
 
2018-Summer-Tutorial-Intro-to-Linux.pdf
2018-Summer-Tutorial-Intro-to-Linux.pdf2018-Summer-Tutorial-Intro-to-Linux.pdf
2018-Summer-Tutorial-Intro-to-Linux.pdf
sanjeevkuraganti
 
Unit 10 investigating and managing
Unit 10 investigating and managingUnit 10 investigating and managing
Unit 10 investigating and managing
root_fibo
 
Linux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compact
Alessandro Selli
 
Creating a Benchmarking Infrastructure That Just Works
Creating a Benchmarking Infrastructure That Just WorksCreating a Benchmarking Infrastructure That Just Works
Creating a Benchmarking Infrastructure That Just Works
Tim Callaghan
 
008-Basic-Linux-Commands.pdf
008-Basic-Linux-Commands.pdf008-Basic-Linux-Commands.pdf
008-Basic-Linux-Commands.pdf
ssuser584832
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
southees
 
Unix tips and tricks
Unix tips and tricksUnix tips and tricks
Unix tips and tricks
Aleksandar Bilanovic
 
Adhocr T-dose 2012
Adhocr T-dose 2012Adhocr T-dose 2012
Adhocr T-dose 2012
Gratien D'haese
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
dotCloud
 

Similar to Mac OSX Terminal 101 (20)

Linux
LinuxLinux
Linux
 
An Introduction To Linux
An Introduction To LinuxAn Introduction To Linux
An Introduction To Linux
 
Perl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one linersPerl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one liners
 
Bullwinkle introduction
Bullwinkle introductionBullwinkle introduction
Bullwinkle introduction
 
Bash Scripting Workshop
Bash Scripting WorkshopBash Scripting Workshop
Bash Scripting Workshop
 
Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
A journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service managementA journey through the years of UNIX and Linux service management
A journey through the years of UNIX and Linux service management
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01
 
Linux tech talk
Linux tech talkLinux tech talk
Linux tech talk
 
2018-Summer-Tutorial-Intro-to-Linux.pdf
2018-Summer-Tutorial-Intro-to-Linux.pdf2018-Summer-Tutorial-Intro-to-Linux.pdf
2018-Summer-Tutorial-Intro-to-Linux.pdf
 
Unit 10 investigating and managing
Unit 10 investigating and managingUnit 10 investigating and managing
Unit 10 investigating and managing
 
Linux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compact
 
Creating a Benchmarking Infrastructure That Just Works
Creating a Benchmarking Infrastructure That Just WorksCreating a Benchmarking Infrastructure That Just Works
Creating a Benchmarking Infrastructure That Just Works
 
008-Basic-Linux-Commands.pdf
008-Basic-Linux-Commands.pdf008-Basic-Linux-Commands.pdf
008-Basic-Linux-Commands.pdf
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
Unix tips and tricks
Unix tips and tricksUnix tips and tricks
Unix tips and tricks
 
Adhocr T-dose 2012
Adhocr T-dose 2012Adhocr T-dose 2012
Adhocr T-dose 2012
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 

Recently uploaded

原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 

Recently uploaded (20)

原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 

Mac OSX Terminal 101

  • 2. History of the Mac ● Unix Based (Free BSD / AT&T 6th Edition Unix) ● Kernel called Darwin (open sourced) ● Xnu – Developed by NeXT later bought by Apple (Tim invented the internet on NeXT, while at CERN. So the internet was created on the MAC...) ● uname -a (to see the version) ● Basically they got Mach Kernel (Carnegie Mellon University) and built new drivers using the Objective C apis.
  • 3. Finding Help ● man --help , xman (if you have X11 or XQuartz), whatis, info ● Developer.apple.com ● Macrumors.com (Forums) ● Lifehacker.com ● Ss64.com/osx ● Mac OSX Unix Toolbox (Book)
  • 4. Types of Commands ● Core or Default Set ● File or Folder Management ● System Administration ● Networking, Email & Internet ● Text, Editors and Manipulation ● Pipes, Redirection and scripting ● Developer Commands
  • 5. Types of Shells ● bash – Bourne Again 1989 (Default) ● zsh – Z Shell 1990 ● tcsh – C Shell 1978 ● sh – Bourne Shell 1977 ● Korn Shell 1983 ● Thompson Shell 1971 ● echo $SHELL ; chsh -s /bin/zsh
  • 6. for version in "${maya_versions[@]}"; do echo -n "Checking for ..... Maya $version"; maya_script_dir="$HOME/Library/Preferences/Autodesk/maya/$version-x64/scripts"; # echo $maya_script_dir if [ -w "$maya_script_dir" ]; then echo " ... Yes Found!"; echo "... $maya_script_dir"; echo -n "... Checking for existing files ..."; if [ -f "$maya_script_dir/mkUtils.pyc" ]; then echo " Yes Found!"; echo "... $maya_script_dir/mkUtils.pyc"; mv "$maya_script_dir/mkUtils.pyc" ~/.Trash/; echo "... mkUtils.pyc moved to Trash!" else echo " Not Found!"; fi cp ./mkUtils.py $maya_script_dir echo "... Installed mkUtils.py" else echo " ... Not found!"; fi done Lets get started...
  • 7. Navigating... ● ls - List ● pwd – print working directory ● cd – change directory ● clear – Clear Screen ● ./ - current directory ● ../ - parent directory ● ~ - user home directory ● - - last path Example... $ cd ~ $ ls -a $ ls -l $ ls -R $ ls -lh $ cd ../Shared/ $ pwd
  • 8. File and Folder Management ● touch – create new file ● cp – copy ● mv – move / rename ● rm – remove ● mkdir – create new directory ● rmdir – remove directory (empty only) Example $ cd ~/Desktop $ mkdir -p Test/First $ touch ./Test/First/newFile.txt ● $ cd Test/First ● $ ls ● $ cp newFile.txt ../secondFile.txt ● $ rm newFile.txt ● $ cd .. ● $ rmdir First/ ● $ cd .. ● $ rm -r Test/
  • 9. System Administration 1 ● top – currently running processes ● ps – process status ● kill – stop running process ● open – open files and directories ● pgrep – find process by name ● installer – install mac packages ● softwareupdate – mac updates ● df – display free disk space ● du – display disk usage ● diskutil – mac disk utils Example $ open -a firefox $ ps -ax $ pgrep firefox $ kill 905 $ df -h $ du -h $ installer -pkg Package.pkg / $ softwareupdate --list
  • 10. Permissions, Groups & Users ● chown – change ownership ● chmod – change access permission ● dscl – directory service command line (create, modify users and groups) ● Example $ chmod u+x $ chown kumar file.txt drwx------+ Directory File Link | User Read Write Execute Group Read Write Execute Other Read Write Execute
  • 11. Viewing Text (Logs) ● cat – concatenate ● less – view less ● more – view more ● head – view head ● tail – view tail ● syslog – view system.log Examples $ cat /var/log/system.log $ less /var/log/system.log $ more /var/log/system.log $ head /var/log/system.log $ tail /var/log/system.log $ ls ~/Library/Logs/ $ ls /var/log
  • 12. Selecting Searching Sorting ● grep – text pattern search ● find – path file search ● locate – indexed search, disabled by default ● mdfind – Spotlight cli ● sort – sort text ● uniq – find duplicates Examples $ grep AppleTalk /etc/services $ find /Volumes/Data/Magazine/ -iname "*mac*" $ mdfind -name TextEdit $ mdfind -onlyin ~/Desktop/ Artist $ ls -l | sort -fi $ sort sortingTest.txt $ sort sortingTest.txt | uniq
  • 13. Manipulating Text ● awk - pattern-directed scanning and processing language ● sed - stream editor language ● vim - Vi IMproved, a programmers text editor ● emacs - GNU project Emacs ● nano - Nano's ANOther editor, an enhanced free Pico clone ● pico – pine package text editor Vim - : , i , :wq , :help, :x CTRL-] to jump to a subject under the cursor. CTRL-O to jump back (repeat to go further back). Emacs – Control + x followed by Control + c (to quit) ^ means Control ● ls -l | awk '{print $3}' ● echo Hi there how are you? | sed s/you/me/ ● $ ls -l | sed s/staff/Kumaran/ ● emacs ● Esc + x ● tetris
  • 14. Pipes and Redirection ● | - pipe or pass ● > - redirect output ● >> - Append ● < - Read input ● curl -s http://www.angeltv.org | grep Description | awk -F = '{print $3}' | sed 's/>//' ● cat /usr/share/dict/words | grep -E '(Aaron|Moses)' ● echo "Hi there how are you" >> test.txt ● tr "[:lower:]" "[:upper:]" < test.txt ● ifconfig | grep broadcast | ping -c 3 “$(awk '{print $6}')” | grep 'bytes from' | awk '{print $4}' | sort | unique
  • 15. Networking 1 ● ifconfig – network card configuration ● ipconfig - view and control IP ● traceroute - print the route packets take to network host ● nslookup - query Internet name servers ● ping - check a remote host for reachability ● telnet - TELNET protocol Examples $ ping -c 3 www.google.com $ ping -i 60 182.19.95.34 $ ping -S 192.168.1.73 192.168.1.1 $ ipconfig getifaddr en0 $ nslookup openmail.angeltv.org $ telnet towel.blinkenlights.nl
  • 16. Networking 2 Examples # Get ip address $ ipconfig getifaddr en1 # Enable Network Interface $ ifconfig en1 up # Disable Network Interface $ ifconfig en1 down # Set ip address $ ifconfig en1 inet 192.168.2.1 # Set netmask $ ifconfig en1 netmask 255.255.255.0 Examples # Change MTU $ ifconfig en1 mtu 1000 networksetup -listallnetworkservices networksetup -getdnsservers Wi-Fi networksetup -setmanual Wi-Fi 10.0.0.2 255.255.255.0 10.0.0.1 netstat -nr # routing tables netstat -at # all sockets lsof -n -i4TCP # ports binary iostat -d disk0 # disk stats dscacheutil -flushcache # 10.5-6 sudo killall -HUP mDNSResponder arp -ad # Flush arp cache
  • 17. Internet ● mail ● sendmail ● curl - transfer a URL ● wget – Need to install (Popular) ● ftp - Internet file transfer program $ curl -s http://www.angeltv.org $ curl http://edge.sin1.swiftserve.com/ange ltv/angeltvlfd/downloads/GOTK_Englis h_Ver4.pdf -O $ curl -u user:pass -O ftp://.../file.zip $ echo “Hi how are you?” | mail -s “From Mac” kumar@angeltv.org $ printf “Subject: Hi how are you?” | sendmail -f kumar@angeltv.org kumar@angeltv.org
  • 18. Misc... Stuff ● date – Date and Time ● time – time processes ● cal – calender ● dc – desktop calculator ● GetFileInfo - HFS+ ● history – command history ● pbcopy – clipboard copy ● pbpaste – clipboard paste ● zip – PKZip zip ● unzip – PKZip unzip ● shutdown ● who, whoami, hostname, finger ● wc – word/line count ● say – speak ● caffeinate – prevent sleep ● yes – stress test ● md5, shasum – file hash ● alias, unalias, ln
  • 19. Closing Thoughts... There are many more commands, too much to cover in one sitting. If needed we could do a 202 level course and cover more advanced stuff. Example : remote connection to another system, transferring files, mounting and partitioning raids, scheduling commands to run at a specific date and time and further automation. If needed, we could do a 303 level course and cover bash scripting and other such workflows. A 404 level course will be the highest, where we go into the developer commands, like make and git. But we should consider, moving on to python, ruby or other such scripting languages to better automate things and build better applications. Mac has python and ruby already inside it...
  • 20. Thank you, The end...By : Kumar (kumar@angeltv.org)