A personal cheat sheet for Bash commands.
| Action | Command | Note |
|---|---|---|
| Create file | touch <file_name> |
|
| View file | cat <file_name> |
|
| Open file | nano <file_name> |
|
| View permissions | ls -l <file_name> |
|
| View permissions (octal) | stat -c "%a %n" <file_name> |
|
| Set permission | sudo chmod 774 <file_name> |
1 |
| Find location of file | sudo find / -name <file_name> |
|
| Delete file | rm <file_name> |
|
| Processes running | ps aux \| grep <process> |
|
| Folder & content size | du -hsc * \| sort -hr |
| Rights | Owner | Group | Others |
|---|---|---|---|
| Read (r) | 4 | 4 | 4 |
| Write (w) | 2 | 2 | 0 |
| Execute (x) | 1 | 1 | 0 |
| TOTAL | 7 | 7 | 4 |
which is equivalent to rwxrwxr--