|
| 1 | +## Table of Contents |
| 2 | +--- |
| 3 | + |
| 4 | +- [Linux CheatSheet for Developers](#linux-cheatsheet-for-developers) |
| 5 | + - [File Commands](#file-commands) |
| 6 | + - [File Permissions](#file-permissions) |
| 7 | + - [Privilege Escalation](#privilege-escalation) |
| 8 | + - [SSH](#ssh) |
| 9 | + - [System Info](#system-info) |
| 10 | + - [Shortcuts](#shortcuts) |
| 11 | + - [Text Editors](#text-editors) |
| 12 | + |
| 13 | +# Linux CheatSheet for Developers |
| 14 | + |
| 15 | +## File Commands |
| 16 | + |
| 17 | +| Command | Description | |
| 18 | +| ------- | ----------- | |
| 19 | +| `pwd` | Show current directory | |
| 20 | +| `mkdir dir` | Make directory called *dir* | |
| 21 | +| `cd dir` | Change directory to *dir* | |
| 22 | +| `cd ..` | Go up a directory | |
| 23 | +| `cd` | Change to home directory | |
| 24 | +| `ls` | List contents of directory| |
| 25 | +| `ls -al` | Formatted list of contents for the directory including hidden files | |
| 26 | +| `rm file` | Delete file | |
| 27 | +| `rm -r dir` | Delete directory *dir* | |
| 28 | +| `rm -f file` |Force delete file | |
| 29 | +| `rm -rf dir` | Force delete directory *dir* | |
| 30 | +| `cp file1 dir` | Copy *file1* to inside of *dir*| |
| 31 | +| `mv file1 dir` | Move/Cut *file1* to inside of *dir*| |
| 32 | +| `touch file` | Create *file*| |
| 33 | + |
| 34 | + |
| 35 | +**[🔼Back to Top](#table-of-contents)** |
| 36 | + |
| 37 | +## File Permissions |
| 38 | + |
| 39 | +| Command | Description | |
| 40 | +| ------- | ----------- | |
| 41 | +| `chmod octal file` | Change the permissions of file to octal for user, group and world by adding: **4 - read( r ), 2 - write( w ), 1- execute ( x )**| |
| 42 | +| `chmod 777 file` | Read, write, execute for all| |
| 43 | +| `chmod 755 file` | rwx for owner, rx for group and world.| |
| 44 | + |
| 45 | +**[🔼Back to Top](#table-of-contents)** |
| 46 | + |
| 47 | + ## Privilege Escalation |
| 48 | + |
| 49 | +| Command | Description | |
| 50 | +| ------- | ----------- | |
| 51 | +| `sudo command` | Runs *command* as root. (If a command requires a higher permission you might have to run it with sudo)| |
| 52 | +| `su` | Runs an interactive shell as root | |
| 53 | + |
| 54 | +**[🔼Back to Top](#table-of-contents)** |
| 55 | + |
| 56 | +## SSH |
| 57 | + |
| 58 | +| Command | Description | |
| 59 | +| ------- | ----------- | |
| 60 | +| `ssh user@host` | Connect to host as user | |
| 61 | +| `ssh -p port user@host` | Connect to host on port *port* as user| |
| 62 | + |
| 63 | + |
| 64 | +**[🔼Back to Top](#table-of-contents)** |
| 65 | + |
| 66 | +## System Info |
| 67 | + |
| 68 | +| Command | Description | |
| 69 | +| ------- | ----------- | |
| 70 | +| `date` | Show the system date and time | |
| 71 | +| `cal` | Show this month's calendar | |
| 72 | +| `uptime` | Show system's uptime | |
| 73 | +| `w` | See who is online | |
| 74 | +| `whoami` | See who you are logged in as| |
| 75 | +| `uname -a` | Show kernel information | |
| 76 | +| `man command` | Show the manual for any command (exit with **q**) |
| 77 | + |
| 78 | +**[🔼Back to Top](#table-of-contents)** |
| 79 | + |
| 80 | +## Shortcuts |
| 81 | + |
| 82 | +| Command | Description | |
| 83 | +| ------- | ----------- | |
| 84 | +| `Ctrl + C` | Halts the current command | |
| 85 | +| `Ctrl + D` | Log out of current session | |
| 86 | +| `Ctrl + W` | Erases one word in current line | |
| 87 | +| `Ctrl + U` | Erases entire line | |
| 88 | + |
| 89 | +**[🔼Back to Top](#table-of-contents)** |
| 90 | + |
| 91 | +## Text Editors |
| 92 | +| Command | Description | |
| 93 | +| ------- | ----------- | |
| 94 | +| `nano file` | nano is a small and friendly editor | |
| 95 | +| `vi file` | vi is a powerful text editor where every action is done though the keyboard. [How to exit vim/vi](https://www.cyberciti.biz/faq/linux-unix-exit-vim-editor/) (Trust me you'll need to know it) | |
| 96 | +| `vim file` | vim - Vi IMproved is an improved version of the vi editor. Like vi, every action is done through the keyboard.| |
| 97 | + |
| 98 | +**[🔼Back to Top](#table-of-contents)** |
0 commit comments