SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
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)

Más contenido relacionado

La actualidad más candente

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 EfficiencyOlivier Bourgeois
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsTop 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsYusuf Felly
 
Common linux ubuntu commands overview
Common linux  ubuntu commands overviewCommon linux  ubuntu commands overview
Common linux ubuntu commands overviewAmeer Sameer
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisRizky 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-2014Peter Martin
 
Anandha ganesh linux1.ppt
Anandha ganesh linux1.pptAnandha ganesh linux1.ppt
Anandha ganesh linux1.pptanandha ganesh
 
Linux commd
Linux commdLinux commd
Linux commdragav03
 
Linux commd
Linux commdLinux commd
Linux commdragav03
 
Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash scriptSimon Su
 

La actualidad más candente (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 a Mac OSX Terminal 101

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 linersKirk Kimmel
 
Bullwinkle introduction
Bullwinkle introductionBullwinkle introduction
Bullwinkle introductionTurner England
 
Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Linux Commands - Cheat Sheet
Linux Commands - Cheat Sheet Isham Rashik
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic CommandsHanan 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 managementLubomir Rintel
 
Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Linuxtraining 130710022121-phpapp01
Linuxtraining 130710022121-phpapp01Chander Pandey
 
Linux tech talk
Linux tech talkLinux tech talk
Linux tech talkPrince 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.pdfsanjeevkuraganti
 
Unit 10 investigating and managing
Unit 10 investigating and managingUnit 10 investigating and managing
Unit 10 investigating and managingroot_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, compactAlessandro 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 WorksTim Callaghan
 
008-Basic-Linux-Commands.pdf
008-Basic-Linux-Commands.pdf008-Basic-Linux-Commands.pdf
008-Basic-Linux-Commands.pdfssuser584832
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unixsouthees
 
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 2013dotCloud
 

Similar a 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
 

Último

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 

Último (20)

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 

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)