Mac OS directory structure
A directory on a Mac (or any other Unix-based system) is a type of file that is used to organize and store other files and directories. A directory is also commonly referred to as a folder on macOS.
In the Unix file system, directories are represented as special files that contain a list of file names and their associated metadata, such as file type, size, owner, and permissions. Directories can contain both files and other directories, and they can be nested within each other to form a hierarchical structure.
Here is a brief overview of the main directories and their purposes:
/ : This is the root directory of the file system.
/Applications : This directory contains all the applications installed on your Mac.
/Library : This directory contains system-wide files, such as preferences and frameworks that are shared by multiple applications.
/System : This directory contains all the files that are essential for the system to function properly.
/Users : This directory contains subdirectories for each user account on your Mac.
/Volumes : This directory contains mount points for removable disks and network volumes.
/Network : This directory contains network-related files, such as mounted network volumes and settings for network interfaces.
/private : This directory contains files that are private to the system, such as system configuration files.
/usr : This directory contains user-level programs and utilities, on windows like program files.
/usr directory
/usr/sbin contains system-level programs and utilities that are required for the operation of the system, but which are generally not used by regular users. These programs are often used for system maintenance or administration tasks and typically require elevated privileges to run. Examples of programs that can be found in /usr/sbin include fsck, diskutil, and systemctl.
/usr/bin contains user-level programs and utilities that are provided by the system and are available to all users. These programs are typically part of the system software and are required for the basic operation of the system. Examples of programs that can be found in /usr/bin include ls, cp, and grep.
/usr/local is a directory where locally installed software is placed. This means that the software installed in this directory is not part of the system software and is not provided by the operating system itself. Instead, it is installed by the user or by a third-party package manager, such as Homebrew or MacPorts. This directory is often used to install open source software or custom-built applications.
.zshrc file
The .zshrc file is a shell script that is run every time you open a new Terminal window in the Z shell (zsh) on a Mac. It is used to configure your shell environment and customize your terminal session.
The .zshrc file is located in your home directory (~/). If the file doesn’t exist, you can create it using any text editor. Here are some common things you can include in your .zshrc file:
Environment variable settings: You can set environment variables that are used by your shell and other programs. For example, you can set the PATH variable to add directories to your search path.
Aliases: You can create aliases for commonly used commands. For example, you can create an alias for ls to include the -h flag for human-readable file sizes.
Custom functions: You can define your own shell functions to perform specific tasks. For example, you can create a function that changes your current directory to a specific location and lists the contents.
Custom prompt: You can customize your shell prompt to include information such as the current directory, git branch, and more.
Theme settings: You can install and configure a custom Zsh theme to change the appearance of your terminal.
Here's an example of how to add an alias to your .zshrc file:
Open Terminal.app and navigate to your home directory using the cd command: cd ~
Open the .zshrc file using any text editor: nano .zshrc
Add the alias to the file: alias ll='ls -alh'
Save and exit the file: Ctrl+X, then Y, then Enter
Reload the .zshrc file to apply the changes: source .zshrc
After completing these steps, you can use the ll command in your terminal to list the contents of the current directory with details and human-readable file sizes.
.zshrc file vs /etc/launchd.conf
The /etc/launchd.conf file is used to set environment variables for all users on the system. This file is read by the launchd daemon during system startup and the variables are set before any other processes are launched. The launchd daemon is responsible for managing system processes and services on a Mac.
On the other hand, the .zshrc file is used to set environment variables for your user account in the current shell session. This file is read by the Z shell (zsh) every time a new shell session is started. Any changes made to environment variables in this file will only affect your user account and will only be active for the duration of the current shell session.
Source :
https://www.iphonelife.com/content/how-to-switch-between-windows-same-app-your-mac