-
Notifications
You must be signed in to change notification settings - Fork 2
/
ubuntu-survival-guide.html
307 lines (303 loc) · 10.3 KB
/
ubuntu-survival-guide.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Ubuntu Survival Cheat Sheet</title>
<link href="https://fonts.googleapis.com/css?family=Ubuntu|Ubuntu+Condensed|Ubuntu+Mono:700" rel="stylesheet">
<style type="text/css">
*{
font-family: 'Ubuntu Condensed', sans-serif;
box-sizing: border-box;
}
body {
width: 297mm;
height: 208mm;
margin: 0;
padding: 0;
background: white;
}
h1,h2,h3,h4,h5,h6{
font-family: 'Ubuntu', sans-serif;
margin: 0;
}
code{
font-family: 'Ubuntu Mono', monospace;
}
p, #bottom {
font-size: 0.8em;
}
section {
vertical-align: top;
padding-top: 5mm;
display: inline-block;
}
#main {
width: 277mm;
min-height: 189mm;
overflow: none;
}
@page {
size: A4;
margin: 0;
}
@media print{@page {size: landscape}}
@media print {
html, body {
width: 290mm;
height: 201mm;
}
#main {
margin: 0 auto;
border: initial;
border-radius: initial;
width: initial;
min-height: initial;
box-shadow: initial;
background: initial;
page-break-after: always;
}
}
#top{
width: 100%;
height: 2.5cm;
padding-top: 2.5mm;
padding-bottom: 0;
background: black;
color: white;
}
#left{
width: 33%;
}
#middle{
width: 33%;
}
#right{
width: 33%;
}
#bottom{
padding: 2mm !important;
width: 100%;
background: lavender;
padding: 0;
text-align: center;
vertical-align: center;
}
div:not(.page):not(.subpage):not(#main) {
display: inline-block;
vertical-align: top;
}
#logo {
width: 2cm;
height: 2cm;
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNi4wLjQsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9ImNpcmNsZV9vZl9mcmllbmRzX194NUZfX29yYW5nZSINCgkgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI0MjUuMTk3cHgiDQoJIGhlaWdodD0iNDI1LjE5N3B4IiB2aWV3Qm94PSIwIDAgNDI1LjE5NyA0MjUuMTk3IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA0M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0yLjcyOWMxLjE1NC03LjQwOSw1LjUyMS0xNC4yNDMsMTIuNTE0LTE4LjI3Mw0KCQljNi45ODctNC4wMzcsMTUuMDg2LTQuNDA0LDIyLjA2Ni0xLjcxMWMxMy4xODctMTMuMDg4LDIxLjc0My0zMC44MywyMi45OTUtNTAuNTU3bC0yNi4zNzItMC40MDkNCgkJQzI2Mi4wMzUsMjQzLjc0OSwyMzkuNzU1LDI2NC41NjgsMjEyLjYwMiwyNjQuNTY4eiIvPg0KPC9nPg0KPC9zdmc+DQo=');
background-position: center center;
background-size: 3cm;
background-repeat: no-repeat;
overflow: visible;
margin-left: 0.5cm;
margin-right: 0.5cm;
}
</style>
</head>
<body>
<div id="main">
<section id="top">
<div style="width: 50%; overflow: visible;">
<div id="logo"> </div>
<div>
<h1>Ubuntu</h1>
<h3 style="color: gold;">A Survival Guide</h3>
<span style="color: silver" >squeezed into a cheat sheet</span>
</div>
</div><div style="width: 50%;">
<h4 style="color: crimson;">💪 Super Powers</h4>
<div style="width: 100%;">
<div style="width: 35%;">
<p>
Run a command as Super User<br>
<code>sudo COMMAND</code>
</p>
</div><div style="width: 25%;" >
<p>
Elevate to <em>root</em><br>
<code>sudo -i</code>
</p>
</div><div style="width: 40%;">
<p>
Turn a user into a Super User<br>
<code>sudo usermod -aG sudo USER</code>
</p>
</div>
</div>
</div>
</section><section id="left">
<h4 style="color: dodgerBlue;">🔧 System Maintenance</h4>
<p>
Show Kernel version (<code>-a</code> for all)<br>
<code>uname -r</code>
</p>
<p>
Show Ubuntu version (<code>-a</code> for all)<br>
<code>lsb_release -r</code>
</p>
<p>
Keep the system up-to-date<br>
<code>sudo apt update && sudo apt dist-upgrade</code>
</p>
<p>
Keep the system clean (by deleting useless files)<br>
<code>sudo apt autoremove && sudo apt autoclean</code>
</p>
<p>
Upgrade to a newer release (system must be up-to-date first)<br>
<code>sudo do-release-upgrade -d</code>
</p>
<p>
List all running processes<br>
<code>ps aux</code>
</p>
<p>
Kill a process<br>
<code>kill -9 PROCESS_ID</code>
</p>
<p>
See which programs are listening on which ports<br>
<code>netstat -peanut</code>
</p>
<p>
See who is listening on a specific port<br>
<code>lsof -i :PORT</code>
</p>
<p>
Run a command as a service (console won't hang)<br>
<code>COMMAND &</code>
</p>
<p>
Find a previous command in the <em>History</em><br>
<code>history | grep COMMAND</code>
</p>
<p>
Run a previous command found in the <em>History</em><br>
<code>!COMMAND_ID</code>
</p>
<p>
Check out System Logs (other logs are in the same folder)<br>
<code>cat /var/log/syslog</code> (or <code>less</code> or <code>tail</code> or <code>nano</code> or...)
</p>
</section><section id="middle">
<h4 style="color: forestGreen;">📁 Files and Folders</h4>
<p>
List files with details<br>
<code>ls -l</code>
</p>
<p>
List all files including hidden files<br>
<code>ls -la</code>
</p>
<p>
List files ordered by last modified<br>
<code>ls -lt</code>
</p>
<p>
Clone a directory (recursive, same timestamps and permissions)<br>
<code>cp -a FOLDER TARGET</code>
</p>
<p>
Find a file from current directory<br>
<code>sudo find . -name 'FILE'</code>
</p>
<p>
Read the last 1000 rows of a file and listen for modifications<br>
<code>tail -1000f FILE</code>
</p>
<p>
Read a file interactively (h for help)<br>
<code>less FILE</code>
</p>
<p>
Get the size of a directory<br>
<code>du -sh FOLDER</code>
</p>
<p>
Check partitions status (is your disk full?)<br>
<code>df -h</code>
</p>
<p>
Relax permissions on a file or a folder:<br>
<code>chmod 777 TARGET</code>
</p>
<p>
Set ownership (user/group) of a file or a folder<br>
<code>chown USER:GROUP TARGET</code>
</p>
<p>
Open a file in a privileged terminal editor<br>
<code>sudo nano FILE</code>
</p>
<p>
Find occurrences of a text in a file or in many files<br>
<code>grep TEXT TARGET</code>
</p>
</section><section id="right">
<h4 style="color: orange;">👥 Users and Groups</h4>
<p>
List all groups<br>
<code>groups</code>
</p>
<p>
List groups a user is a member of<br>
<code>groups USER</code>
</p>
<p>
List users which are members of a group<br>
<code>getent group GROUP</code>
</p>
<p>
Create a new user<br>
<code>sudo adduser USER</code>
</p>
<p>
Add an existing user to a group<br>
<code>sudo usermod -aG GROUP USER</code>
</p>
<p>
Change a user's password<br>
<code>passwd USER</code>
</p>
<p>
Impersonate a user (or return to your user from root)<br>
<code>su USER</code>
</p>
<p>
Move to user home (AKA <code>~</code>, AKA <code>/home/USER</code>)<br>
<code>cd</code>
</p>
<p>
Delete a user<br>
<code>sudo userdel USER</code>
</p>
<h4 style="color: coral;">🎨
 Graphical User Interface</h4>
<p>
Open a Terminal<br>
<code>CTRL + ALT + T</code>
</p>
<p>
Open a privileged file explorer (for current folder use <code>.</code>)<br>
<code>sudo nautilus PATH</code>
</p>
<p>
Open a file in a privileged GUI text editor<br>
<code>sudo gedit FILE</code>
</p>
</section><section id="bottom">
<div style="width:33%; text-align: left;">
Made with ❤ by Andrea Ligios
</div><div style="width:33%;">
🗽 MIT License
</div><div style="width:33%; text-align: right;">
⭐ https://andrea-ligios.github.io/ubuntu-survival-guide/
</div>
</section>
</div>
</body>
</html>