add a shortcut

open -e ~/.zshrc

open in text editor instead or nano or other vim based editors

open -e filename.txt

Zip Files

Common Commands

Zip a single file:

zip archive.zip filename.txt

This creates a zip file named archive.zip containing filename.txt.

Zip a folder (including all subdirectories and files):

zip -r archive.zip foldername

The -r flag tells zip to act recursively.

Zip multiple files or a combination of files and folders:

zip -r archive.zip file1.txt file2.jpg foldername

Just list all the items you want to include. Exclude hidden macOS files (.DS_Store, __MACOSX):

zip -rX archive.zip foldername -x "*/.*" -x "__*"

This is useful for creating clean archives for use on non-Mac systems. The -X option specifically excludes extra Mac OS hidden files. Create a password-protected zip file:

bash

zip -er archive.zip foldername

The -e flag prompts you to enter a password for encryption.

Key Options

OptionDescription
-rRecursively include all files and folders in subdirectories.
-eEncrypt the archive with a password.
-xExclude specified files or patterns.
-qQuiet mode (prevents console clutter by not listing files as they are added).
-jJunk paths (store only the file name, not the directory structure).

Deleting / Managing files

List all files in current folder:

ls *.dmg

Detailed Preview (Show sizes, permissions, and dates):

ls -lh *.dmg

Sorted Preview List files with the largest at the top:

ls -lSvh *.dmg

Simple Size Check Show only the size and filename:

du -sh *.dmg

Total Space Calculation Show individual sizes plus a grand total:

du -ch *.dmg

Standard Deletion Remove all files with the extension:

rm *.dmg

Interactive Deletion Ask for confirmation before each file:

rm -i *.dmg

Force Deletion Remove files immediately, ignoring locks:

rm -f *.dmg

Deep Clean (Recursive) Delete files in current folder and all subfolders:

rm -r *.dmg

Global Search and Destroy Find and delete files from a specific directory downward:

find . -name "*.dmg" -delete

OpenClaw

Denchclaw

lsof -ti :3100
kill -9 877 1167