add a shortcut
open -e ~/.zshrcopen in text editor instead or nano or other vim based editors
open -e filename.txtZip Files
Common Commands
Zip a single file:
zip archive.zip filename.txtThis creates a zip file named archive.zip containing filename.txt.
Zip a folder (including all subdirectories and files):
zip -r archive.zip foldernameThe -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 foldernameJust 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
| Option | Description |
|---|---|
-r | Recursively include all files and folders in subdirectories. |
-e | Encrypt the archive with a password. |
-x | Exclude specified files or patterns. |
-q | Quiet mode (prevents console clutter by not listing files as they are added). |
-j | Junk paths (store only the file name, not the directory structure). |
Deleting / Managing files
List all files in current folder:
ls *.dmgDetailed Preview (Show sizes, permissions, and dates):
ls -lh *.dmgSorted Preview List files with the largest at the top:
ls -lSvh *.dmgSimple Size Check Show only the size and filename:
du -sh *.dmgTotal Space Calculation Show individual sizes plus a grand total:
du -ch *.dmgStandard Deletion Remove all files with the extension:
rm *.dmgInteractive Deletion Ask for confirmation before each file:
rm -i *.dmgForce Deletion Remove files immediately, ignoring locks:
rm -f *.dmgDeep Clean (Recursive) Delete files in current folder and all subfolders:
rm -r *.dmgGlobal Search and Destroy Find and delete files from a specific directory downward:
find . -name "*.dmg" -deleteOpenClaw
Denchclaw
lsof -ti :3100kill -9 877 1167
