SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
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)

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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
 

Similaire à 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
 

Dernier

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
 
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
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 

Dernier (20)

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
 
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 ...
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 

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)