|
1 | | -# Linux commands |
| 1 | +# Linux terminal |
2 | 2 |
|
3 | | -## Usual commands |
| 3 | +## Additional packages |
| 4 | + |
| 5 | +Name | Details |
| 6 | +---------|--------------------------------------------------------------------------------------------------------------------------------- |
| 7 | +**wget** | GNU Wget is a free software package for retrieving files using HTTP, HTTPS, FTP and FTPS the most widely-used Internet protocols |
| 8 | + |
| 9 | +<!-- TODO: difference between cat/less/more --> |
| 10 | + |
| 11 | +## Shortcuts |
| 12 | + |
| 13 | +Shortcut | Action |
| 14 | +-----------|-------------------------------- |
| 15 | +`Ctrl`+`R` | Search a command in the history |
| 16 | + |
| 17 | +## Commands |
| 18 | + |
| 19 | +### Machine and OS |
| 20 | + |
| 21 | +Display system information (e.g., kernel version, OS type): |
4 | 22 |
|
5 | 23 | ```bash |
6 | | -# switches between keyboard layouts |
7 | | -loadkeys fr |
8 | | -# looks at drive disk space |
9 | | -df -h |
10 | | -# interacts with services (like firewalld) |
11 | | -systemctl <stop|disable|start|status> <service_name> |
12 | | -# review sudo config |
13 | | -cat /etc/sudoers |
14 | | -# manages services, boot processes, and system states |
15 | | -systemd |
16 | | -# displays logging system events |
17 | | -journald |
18 | | -# interacts with the dynamic firewall management tool (when installed) |
19 | | -firewalld |
20 | | -# configures and displays network interfaces |
21 | | -ip |
22 | | -# displays system information (e.g., kernel version, OS type) |
23 | 24 | uname |
24 | | -# displays memory usage |
25 | | -free |
26 | | -# views memory information |
27 | | -less /proc/meminfo |
28 | | -# views CPU information |
29 | | -more /proc/cpuinfo |
30 | | -# displays kernel and distribution version information |
| 25 | +``` |
| 26 | + |
| 27 | +View memory information: |
| 28 | + |
| 29 | +```bash |
| 30 | +cat /proc/meminfo |
| 31 | +``` |
| 32 | + |
| 33 | +View CPU information: |
| 34 | + |
| 35 | +```bash |
| 36 | +cat /proc/cpuinfo |
| 37 | +``` |
| 38 | + |
| 39 | +Display kernel and distribution version information |
| 40 | + |
| 41 | +```bash |
31 | 42 | cat /proc/version |
32 | | -# displays kernel name and release |
| 43 | +``` |
| 44 | + |
| 45 | +Display kernel name and release: |
| 46 | + |
| 47 | +```bash |
33 | 48 | uname -or |
34 | | -# displays the network node hostname |
| 49 | +``` |
| 50 | + |
| 51 | +### System check |
| 52 | + |
| 53 | +Monitor live system processes: |
| 54 | + |
| 55 | +```bash |
| 56 | +top |
| 57 | +``` |
| 58 | + |
| 59 | +Look at drive disk space: |
| 60 | + |
| 61 | +```bash |
| 62 | +df -h |
| 63 | +``` |
| 64 | + |
| 65 | +Display memory usage: |
| 66 | + |
| 67 | +```bash |
| 68 | +free |
| 69 | +``` |
| 70 | + |
| 71 | +### Network |
| 72 | + |
| 73 | +Configure and displays network interfaces: |
| 74 | + |
| 75 | +```bash |
| 76 | +ip |
| 77 | +``` |
| 78 | + |
| 79 | +Display the network node hostname: |
| 80 | + |
| 81 | +```bash |
35 | 82 | hostname |
36 | 83 | uname -n |
37 | | -# displays user and group information for the current or specified user |
| 84 | +``` |
| 85 | + |
| 86 | +Interact with the dynamic firewall management tool (when installed): |
| 87 | + |
| 88 | +```bash |
| 89 | +firewalld |
| 90 | +``` |
| 91 | + |
| 92 | +### Services |
| 93 | + |
| 94 | +Interact with services (like firewalld): |
| 95 | + |
| 96 | +```bash |
| 97 | +systemctl <stop|disable|start|status> <service_name> |
| 98 | +``` |
| 99 | + |
| 100 | +Manage services, boot processes, and system states: |
| 101 | + |
| 102 | +```bash |
| 103 | +systemd |
| 104 | +``` |
| 105 | + |
| 106 | +Display logging system events: |
| 107 | + |
| 108 | +```bash |
| 109 | +journald |
| 110 | +``` |
| 111 | + |
| 112 | +### User managament |
| 113 | + |
| 114 | +Review sudo config: |
| 115 | + |
| 116 | +```bash |
| 117 | +cat /etc/sudoers |
| 118 | +``` |
| 119 | + |
| 120 | +Display user and group information for the current or specified user: |
| 121 | + |
| 122 | +```bash |
38 | 123 | id |
39 | | -# updates a user’s password |
40 | | -passwd |
41 | | -# adds a new user (account is locked until a password is set) |
| 124 | +``` |
| 125 | + |
| 126 | +Add a new user (account is locked until a password is set): |
| 127 | + |
| 128 | +```bash |
42 | 129 | useradd xxx |
43 | | -# extends or validates the sudo credentials timestamp (typically for 5 minutes) |
| 130 | +``` |
| 131 | + |
| 132 | +Updates a user's password: |
| 133 | + |
| 134 | +```bash |
| 135 | +passwd |
| 136 | +``` |
| 137 | + |
| 138 | +### User settings |
| 139 | + |
| 140 | +Extend or validate the sudo credentials timestamp (typically for 5 minutes): |
| 141 | + |
| 142 | +```bash |
44 | 143 | sudo -v |
45 | | -# monitors live system processes |
46 | | -top |
47 | 144 | ``` |
48 | 145 |
|
49 | | -## Common packages |
| 146 | +Switch between keyboard layouts: |
50 | 147 |
|
51 | | -Name | Details |
52 | | ----------|--------------------------------------------------------------------------------------------------------------------------------- |
53 | | -**wget** | GNU Wget is a free software package for retrieving files using HTTP, HTTPS, FTP and FTPS the most widely-used Internet protocols |
| 148 | +```bash |
| 149 | +loadkeys fr |
| 150 | +``` |
54 | 151 |
|
55 | | -## Shell shortcuts |
| 152 | +### Processes |
56 | 153 |
|
57 | | -Shortcut | Action |
58 | | --------------|-------------------------------- |
59 | | -`Ctrl` + `R` | Search a command in the history |
| 154 | +Look for specific processes: |
| 155 | + |
| 156 | +```bash |
| 157 | +ps -ef | grep <process_name> |
| 158 | +``` |
| 159 | + |
| 160 | +Kill a process and its children: |
| 161 | + |
| 162 | +```bash |
| 163 | +kill -TERM -- -<process_id> |
| 164 | +``` |
0 commit comments