📖 Guide

Chmod — Complete Reference

Linux file permission commands and patterns for chmod.

47 commands across 7 categories

Numeric Mode

CommandDescription
chmod 755 file
Owner rwx, group rx, others rx
chmod 644 file
Owner rw, group r, others r
chmod 700 file
Owner rwx, no access for others
chmod 600 file
Owner rw only, no access for others
chmod 777 file
Full permissions for everyone (use with caution)
chmod 000 file
Remove all permissions
chmod 750 file
Owner rwx, group rx, others none

Symbolic Mode

CommandDescription
chmod u+x file
Add execute permission for owner
chmod g+w file
Add write permission for group
chmod o-r file
Remove read permission for others
chmod a+r file
Add read permission for all (user, group, others)
chmod u=rwx,g=rx,o=r file
Set exact permissions for each class
chmod ug+x file
Add execute for owner and group
chmod u+x,g-w,o-rwx file
Multiple changes in one command

Common Permissions

CommandDescription
chmod 644 file.txt
Standard file: owner rw, others read-only
chmod 755 script.sh
Executable script: owner rwx, others rx
chmod 600 ~/.ssh/id_rsa
SSH private key: owner rw only
chmod 644 ~/.ssh/id_rsa.pub
SSH public key: owner rw, others read
chmod 400 secret.pem
Read-only for owner, no access for others
chmod 664 shared.txt
Owner and group rw, others read-only

Directory Permissions

CommandDescription
chmod 755 dir/
Standard directory: owner full, others can list and enter
chmod 700 dir/
Private directory: only owner can access
chmod 750 dir/
Group-accessible directory: owner full, group can list/enter
chmod 1777 /tmp
World-writable with sticky bit (like /tmp)
chmod 2775 dir/
Setgid directory: new files inherit group ownership
chmod o+x dir/
Allow others to enter directory (requires r to list)

Special Permissions

CommandDescription
chmod u+s file
e.g. chmod u+s /usr/bin/passwd
Set SUID — file executes as the file owner
chmod g+s file
Set SGID — file executes with group privileges
chmod g+s dir/
Set SGID on directory — new files inherit group
chmod +t dir/
Set sticky bit — only owner can delete their files
chmod 4755 file
e.g. ls -l shows -rwsr-xr-x
Numeric SUID: 4xxx prefix
chmod 2755 file
e.g. ls -l shows -rwxr-sr-x
Numeric SGID: 2xxx prefix
chmod 1755 dir/
e.g. ls -l shows drwxr-xr-t
Numeric sticky bit: 1xxx prefix

Recursive

CommandDescription
chmod -R 755 dir/
Apply permissions recursively to directory and contents
chmod -R u+w dir/
Add write permission recursively for owner
find dir/ -type f -exec chmod 644 {} +
Set 644 on files only (not directories)
find dir/ -type d -exec chmod 755 {} +
Set 755 on directories only (not files)
chmod -R a-x,a+X dir/
Remove execute from files, keep on directories
chmod -R g=u dir/
Make group permissions match owner recursively

Common Patterns

CommandDescription
chmod +x script.sh
Make a script executable
chmod -R 755 /var/www/html
Web server document root permissions
chmod 600 .env
Protect environment/config files
chmod 700 ~/.ssh
Secure SSH directory
chmod 644 ~/.ssh/authorized_keys
SSH authorized keys file
stat -c '%a %n' file
View current numeric permissions of a file
ls -la
List files with permissions in symbolic format
umask 022
Set default permissions for new files (results in 644/755)

More Guides

🌿
Git Commands
Complete Git command reference — from basics to advanced workflows. Searchable, with examples.
📝
Vim Commands
Complete Vim/Vi command reference — modes, motions, editing, search, and advanced features.
🐳
Docker Commands
Complete Docker & Docker Compose command reference — containers, images, volumes, networks, and orchestration.
🔤
Regex Reference
Complete regular expression reference — syntax, patterns, quantifiers, groups, lookaheads, and common recipes.
🐧
Linux Commands
Complete Linux/Bash command reference — file management, text processing, networking, system admin, and shell scripting.
☸️
Kubernetes Commands
Complete Kubernetes & kubectl command reference — pods, deployments, services, configmaps, and cluster management.
🐍
Python Reference
Complete Python reference — syntax, data structures, string methods, file I/O, comprehensions, and common patterns.
🗃️
SQL Reference
Complete SQL reference — queries, joins, aggregation, subqueries, indexes, and database management.
🌐
Nginx Reference
Complete Nginx configuration reference — server blocks, locations, proxying, SSL, load balancing, and caching.
🔐
SSH Commands
Complete SSH reference — connections, key management, tunneling, config, SCP/SFTP, and security hardening.
👷
Jenkins Reference
Complete Jenkins reference — pipeline syntax, Jenkinsfile, plugins, CLI, agents, and CI/CD patterns.
📨
HTTP Headers Reference
Complete HTTP headers reference — request headers, response headers, caching, security, CORS, and content negotiation. Searchable, with examples.
🐘
PostgreSQL Reference
Comprehensive PostgreSQL reference — from connection basics to advanced features like JSONB, full-text search, window functions, and performance tuning.
Async Patterns Reference
Multi-language async/concurrency patterns — JavaScript, Python, Go, Rust, Java, and universal concurrency patterns.
📡
Protobuf & gRPC Reference
Comprehensive reference for Protocol Buffers (proto3) and gRPC — message definitions, services, streaming, and common patterns.
📚
JS Array Methods
Complete JavaScript Array methods reference — creating, searching, transforming, sorting, iterating, and common patterns. Searchable, with examples.
🌊
Tailwind CSS Reference
Complete Tailwind CSS reference — layout, spacing, typography, colors, responsive design, states, and common patterns. Searchable, with examples.
GraphQL Reference
Complete GraphQL reference — schema definition, types, queries, mutations, directives, fragments, and common patterns. Searchable, with examples.
💻
VS Code Shortcuts
Complete VS Code keyboard shortcuts — editing, navigation, search, multi-cursor, terminal, debug, and more. Searchable, with Cmd/Ctrl notation.
🔲
CSS Grid Reference
Complete CSS Grid reference — container properties, item placement, grid functions, and common layout patterns. Searchable, with examples.
📦
CSS Flexbox Reference
Complete CSS Flexbox reference — container properties, item properties, and common layout patterns. Searchable, with examples.
⚛️
React Hooks Reference
Complete React Hooks reference — useState, useEffect, useContext, custom hooks, and common patterns. Searchable, with examples.
🔷
TypeScript Reference
Complete TypeScript reference — types, interfaces, generics, utility types, and advanced patterns. Searchable, with examples.
☁️
AWS CLI Reference
Complete AWS CLI reference — EC2, S3, IAM, Lambda, ECS, RDS, CloudFormation, and common operations.
🐹
Go Reference
Complete Go (Golang) reference — syntax, types, functions, concurrency, error handling, and common patterns.
💠
PowerShell Reference
Complete PowerShell reference — cmdlets, pipelines, scripting, file operations, remote management, and Active Directory.
💾
Redis Commands
Complete Redis command reference — strings, hashes, lists, sets, sorted sets, pub/sub, transactions, and server management.
🏗️
Terraform Commands
Complete Terraform reference — init, plan, apply, state management, modules, workspaces, and HCL syntax.
⚙️
Ansible Commands
Complete Ansible reference — playbooks, modules, inventory, roles, vault, and ad-hoc commands.
🟨
JavaScript
Complete JavaScript reference — variables, types, operators, strings, arrays, objects, functions, async, DOM, ES6+, and more.
🎨
CSS
Complete CSS reference — selectors, box model, positioning, typography, animations, media queries, custom properties, and more.
📄
HTML
Complete HTML reference — document structure, text content, forms, media, semantic elements, accessibility, and more.
Java
Complete Java reference — data types, strings, collections, OOP, interfaces, exceptions, file I/O, streams, lambdas, and more.
💻
Bash
Complete Bash reference — variables, strings, arrays, conditionals, loops, functions, file tests, I/O redirection, process management, and more.
🦀
Rust
Comprehensive Rust language cheat sheet covering ownership, traits, pattern matching, concurrency, and more.
📝
Markdown
Complete Markdown syntax reference for headings, formatting, links, tables, code blocks, and extensions.
📋
YAML
YAML syntax reference covering scalars, collections, anchors, multi-line strings, and common patterns.
🌐
Curl
Curl command-line reference for HTTP requests, authentication, file transfers, debugging, and common API patterns.
Cron
Cron scheduling reference covering syntax, field values, crontab management, and common schedule patterns.
🖥️
Tmux
Terminal multiplexer for managing multiple sessions, windows, and panes from a single terminal.
🔧
Awk
Powerful text processing language for pattern scanning, data extraction, and report generation.
✂️
Sed
Stream editor for filtering and transforming text, line by line.
🔍
Find
Search for files and directories in a directory hierarchy with powerful filtering options.
🔎
Grep
Search text using patterns. Filter lines from files, command output, or streams with regular expressions.
🐘
PHP
Complete PHP cheat sheet covering syntax, OOP, arrays, PDO, and modern PHP 8.x features.
⚙️
C
Complete C programming cheat sheet covering syntax, pointers, memory management, and standard library.
🔷
C++
Complete C++ cheat sheet covering STL containers, OOP, templates, smart pointers, and modern C++ features.
🐬
MySQL
Complete MySQL cheat sheet covering queries, joins, indexes, transactions, and administration.
💅
Sass
Complete Sass/SCSS cheat sheet covering variables, mixins, functions, nesting, and modern module system.

📖 Free, searchable command reference. Bookmark this page for quick access.