Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

Saturday, April 24, 2021

Where are the macOS commands located? What are /usr/bin /usr/local/bin directories used for?

We have all heard of /usr/bin /usr/local/bin and so on. Do we know how and why they are organized?Let's get started

/bin - user utilities - cd ls cat bash cp pwd - all these are here. Did you know? 

/sbin - s for system program and administration

ping mount reboot shutdown ifconfig - ring a bell?

/usr/bin - non-system programs - 

awk base64 curl emacs find grep ssh php vim perl php python rake rails sed

/usr/sbin - system daemons(background processes) & system utilities only

chown chmod cron httpd sendmail sshd apachectl - sytem utilities that are user specific

/usr/local/bin - The programs installed over the base operating systems due to a dmg file installation or using a package manager might land up here.

Example: Lets say you install mysql it would be installed in /usr/local/mysql/bin. Similarly php would be installed in /usr/local/php

Summary:
/bin and /sbin - commands provided by OS - /bin - consumers /sbin - system administrators
/usr/bin - utilities used by developers
/usr/sbin - utilities used by OS administrators
/usr/local/bin - compilers/executables softwares installed - php and mysql
/usr/local/sbin - administrative commands for softwares installed - Apache restart, mysql server start re-start

We all use cd, ls and many such commands in the macOS Terminal day in and day out. I am better than yesterday after I learnt this today. I know where to search my executables.

Credits & Thanks to :https://medium.com/@jalendport/what-exactly-is-your-shell-path-2f076f02deb4