sandervanvugt

linfun day2 nov21

Dec 1st, 2021
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.31 KB | None | 0 0
  1. VIM MINI TUTORIAL
  2.  
  3. (see also slides)
  4.  
  5. kherkghiughi
  6.  
  7. HELLO world
  8. HELLO moon
  9. HELLO planet venus
  10.  
  11. gg - go to top of document
  12. G - go to bottom of document
  13. /text - search for text
  14. dw - delete current word
  15.  
  16. read vimtutor
  17.  
  18. DO NOT USE vi CHEATSHEETS!!!!
  19.  
  20. [student@rocky ~]$ history
  21. 1 ls
  22. 2 vi countdown
  23. 3 chmod +x countdown
  24. 4 cat countdown
  25. 5 echo $PATH
  26. 6 pwd
  27. 7 cp countdown /usr/local/bin/
  28. 8 whoami
  29. 9 sudo cp countdown /usr/local/bin/
  30. 10 countdown 1
  31. 11 history
  32. 12 countdown 0
  33. 13 history
  34. 14 echo $PATH
  35. 15 sudo reboot
  36. 16 history
  37. 17 ##### ON GRUB PROMPT: add "systemd.unit=multi-user.target"
  38. 18 history
  39. 19 clear
  40. 20 sudo systemctl start graphical.target
  41. 21 history
  42. 22 history
  43. 23 sudo -i
  44. 24 id
  45. 25 id linda
  46. 26 sudo usermod -aG wheel linda
  47. 27 id linda
  48. 28 su - linda
  49. 29 history
  50. 30 id
  51. 31 cat /etc/groups
  52. 32 cat /etc/group
  53. 33 exit
  54. 34 ls
  55. 35 exit
  56. 36 sudo apt install openssh-server
  57. 37 sudo systemctl status sshd
  58. 38 history
  59. 39 sudo systemctl status sshd
  60. 40 ip a
  61. 41 countdown 12
  62. 42 uname --help
  63. 43 uname --all
  64. 44 uname -a
  65. 45 ls -h
  66. 46 ls --help
  67. 47 ls --help | less
  68. 48 ls -lrt
  69. 49 netstat -tulpen
  70. 50 ps aux
  71. 51 ps -aux
  72. 52 whoami
  73. 53 WHOAMI
  74. 54 whoami --help
  75. 55 hostname
  76. 56 hostname --help
  77. 57 hostname -i
  78. 58 hostname -a
  79. 59 date
  80. 60 date --help | less
  81. 61 date +%m-%d-%y
  82. 62 date +%d-%m-%y
  83. 63 date +%d-%m-%Y
  84. 64 date +%d-%M-%Y
  85. 65 uanem
  86. 66 uname
  87. 67 uname -a
  88. 68 uname -r
  89. 69 passwd --help | less
  90. 70 passwd -S linda
  91. 71 sudo passwd -S linda
  92. 72 touch hello
  93. 73 ls -l
  94. 74 cd /
  95. 75 touch hello
  96. 76 cd tmp
  97. 77 touch hello
  98. 78 cd
  99. 79 pwd
  100. 80 date
  101. 81 ls -l hello
  102. 82 touch hello
  103. 83 ls -l hello
  104. 84 last
  105. 85 w
  106. 86 who
  107. 87 w
  108. 88 history
  109. 89 passwd --help | less
  110. 90 last
  111. 91 which last
  112. 92 sudo rm /usr/bin/last
  113. 93 sudo dnf provides */finger
  114. 94 which last
  115. 95 sudo rm -f /usr/bin/last
  116. 96 last
  117. 97 man man
  118. 98 man last
  119. 99 man find
  120. 100 man man
  121. 101 ls -l /etc/passwd
  122. 102 which passwd
  123. 103 man passwd
  124. 104 man 5 passwd
  125. 105 man -a passwd
  126. 106 man -k user
  127. 107 man man
  128. 108 man apropos
  129. 109 man mandb
  130. 110 sudo mandb
  131. 111 man -k user
  132. 112 man -k user | wc
  133. 113 man -k user | grep 8
  134. 114 man -k user | grep 8 | wc
  135. 115 man ls
  136. 116 info ls
  137. 117 pinfo ls
  138. 118 cd /usr/share/doc
  139. 119 ls
  140. 120 cd grep
  141. 121 ls
  142. 122 ls -l
  143. 123 less NEWS
  144. 124 cd ..
  145. 125 cd pam
  146. 126 ls
  147. 127 less Linux-PAM_SAG.txt
  148. 128 cd
  149. 129 countdown 12
  150. 130 ls
  151. 131 ls -a
  152. 132 ls -l
  153. 133 ls -lrt
  154. 134 pwd
  155. 135 cd /etc
  156. 136 ls a*
  157. 137 ls -d a*
  158. 138 ls -d a?.*
  159. 139 ls -d a[uv]*
  160. 140 ls -d a[u-z]*
  161. 141 cd
  162. 142 pwd
  163. 143 cd /etc
  164. 144 cd
  165. 145 mkdir hellodir
  166. 146 ls
  167. 147 ls -l
  168. 148 rmdir hellodir/
  169. 149 cd /usr
  170. 150 ls
  171. 151 du -sh
  172. 152 cd /etc
  173. 153 ls
  174. 154 less DIR_COLORS
  175. 155 cd /var
  176. 156 ls
  177. 157 cd log
  178. 158 ls -l
  179. 159 ls -lrt
  180. 160 cd
  181. 161 journalctl
  182. 162 history
  183. 163 du -hs
  184. 164 cd /var
  185. 165 di -hs
  186. 166 du -hs
  187. 167 sudo du -hs 2>/dev/null
  188. 168 #sudo rm -rf / --no-preserve-root
  189. 169 cd
  190. 170 man hier
  191. 171 ssh [email protected] man hier
  192. 172 ssh [email protected] "man hier"
  193. 173 ssh [email protected] man hier | less
  194. 174 ssh [email protected] "man hier | less"
  195. 175 ssh [email protected] man hier | less
  196. 176 sudo ifconfig
  197. 177 man ifconfig
  198. 178 ip a
  199. 179 sudo ip a
  200. 180 sudo ip addr add dev ens160 10.0.0.10/24
  201. 181 ip a
  202. 182 ping 10.0.0.10
  203. 183 sudo ifconfig
  204. 184 sudo ifconfig -a
  205. 185 sudo ldd /usr/sbin/ifconfig
  206. 186 sudo ldd /usr/sbin/ip
  207. 187 which ifconfig
  208. 188 sudo rm -f $(which ifconfig)
  209. 189 sudo tail /var/log/messages
  210. 190 cd /var
  211. 191 sudo tail log/messages
  212. 192 cd cache/
  213. 193 pwd
  214. 194 cd /usr/share/doc/
  215. 195 tail ../../../var/log/messages
  216. 196 tail /var/log/messages
  217. 197 cd
  218. 198 sudo cp -R /tmp/ .
  219. 199 ls
  220. 200 sudo cp -R /tmp .
  221. 201 ls
  222. 202 mv hello bye
  223. 203 ls -l
  224. 204 history
  225. 205 sudo touch mydonut
  226. 206 echo with sprinkles please > mydonut
  227. 207 cat mydonut
  228. 208 ls -il mydonut
  229. 209 ln mydonut yourdonut
  230. 210 ls -il *donut
  231. 211 ln mydonut herdonut
  232. 212 ls -il *donut
  233. 213 rm yourdonut
  234. 214 ls -il *donut
  235. 215 ln -s mydonut whatever
  236. 216 ln -s mydonut hisdonut
  237. 217 mv whatever whateverdonut
  238. 218 ls -il *donut
  239. 219 cat hisdonut
  240. 220 echo im not interested >> whateverdonut
  241. 221 ls -il *donut
  242. 222 rm mydonut
  243. 223 ls -il *donut
  244. 224 cat hisdonut
  245. 225 ln herdonut mydonut
  246. 226 ls -il *donut
  247. 227 history
  248. 228 ls -l /
  249. 229 sudo lsblk
  250. 230 sudo /boot
  251. 231 sudo ls /boot
  252. 232 sudo ln /etc/hosts /boot/hosts
  253. 233 find / -name "hosts"
  254. 234 sudo find / -name "hosts"
  255. 235 sudo find / -name "hosts*"
  256. 236 sudo find / -user "linda"
  257. 237 sudo find / -user "linda" 2> /dev/null
  258. 238 sudo find / -size +2G
  259. 239 ls -l /proc/kcore
  260. 240 sudo mkdir /root/linda; sudo find / -user linda -exec cp {} /root/linda/ \;
  261. 241 ps aux
  262. 242 ps aux | less
  263. 243 history
  264. 244 man locate
  265. 245 locate hosts
  266. 246 sudo updatedb
  267. 247 locate hosts
  268. 248 sudo tar -cvf backup.tar /etc /home
  269. 249 ls -l
  270. 250 ls -lh
  271. 251 sudo tar -czvf backup.tar.gz /etc /home
  272. 252 man tar
  273. 253 sudo tar -czvf backup.tar.gz /etc /home --exclude=/home/backup*
  274. 254 sudo tar -czvf backup.tar.gz --exclude=/home/student/backup* /etc /home
  275. 255 sudo tar -cjvf backup.tar.bz2 --exclude=/home/student/backup* /etc /home
  276. 256 sudo tar -cJvf backup.tar.xz --exclude=/home/student/backup* /etc /home
  277. 257 ls -l
  278. 258 ls -lh
  279. 259 tar tvf backup.tar.gz
  280. 260 tar xvf backup.tar.xz
  281. 261 ls
  282. 262 tar xvf backup.tar.xz -C /tmp
  283. 263 ls /tmp
  284. 264 countdown 20
  285. 265 mkdir -p /tmp/files/pictures /tmp/files/photos /tmp/files/videos
  286. 266 cd /tmp/files
  287. 267 ls
  288. 268 cp /etc/[a-c]* .
  289. 269 ls
  290. 270 mv [ab]* photos/
  291. 271 ls
  292. 272 ls photos/
  293. 273 mv c* videos/
  294. 274 #sudo find /etc -size
  295. 275 man find
  296. 276 sudo find /etc -size -1000c
  297. 277 sudo find /etc -size -1000c -exec cp {} pictures/
  298. 278 sudo find /etc -size -1000c -exec cp {} pictures/ \;
  299. 279 sudo find /etc -type f -size -1000c -exec cp {} pictures/ \;
  300. 280 ls pictures/
  301. 281 pwd
  302. 282 ln -s /var var
  303. 283 ls
  304. 284 sudo tar czvf homes.tar /home
  305. 285 ls -l
  306. 286 mkdir /tmp/archive
  307. 287 tar xvf homes.tar -C /tmp/archive
  308. 288 ls /tmp/archive/
  309. 289 tree /tmp/archive/
  310. 290 sudo nano /etc/hosts
  311. 291 cat /etc/hosts
  312. 292 vimtutor
  313. 293 pwd
  314. 294 cd
  315. 295 vim vimschool.txt
  316. 296 history
  317. 297 sudo less /var/log/messages
  318. 298 sudo more /var/log/messages
  319. 299 sudo head /etc/passwd
  320. 300 sudo head -5 /etc/passwd
  321. 301 sudo tail -5 /etc/passwd
  322. 302 sudo head -5 /etc/passwd | tail -1
  323. 303 cat /etc/hosts
  324. 304 tac /etc/hosts
  325. 305 sudo dnf provides */cowsay
  326. 306 sudo grep lisa /etc/*
  327. 307 sudo grep lisa /etc/* 2>/dev/null
  328. 308 ps aux | grep ssh
  329. 309 ps aux | grep -i ssh
  330. 310 ps aux | grep -i sshd
  331. 311 ps aux | grep -i sshd | grep -v grep
  332. 312 sudo dnf install httpd -y
  333. 313 sudo grep DocumentRoot /etc/httpd/conf/httpd.conf
  334. 314 sudo grep -A 10 DocumentRoot /etc/httpd/conf/httpd.conf
  335. 315 sudo grep -l root /etc/*
  336. 316 sudo grep -lR root /etc/* 2>/dev/null
  337. 317 sudo grep -lR linda /etc/* 2>/dev/null
  338. 318 sudo grep lisa /etc/* 2>/dev/null
  339. 319 vim regexfun
  340. 320 grep 'anna' regexfun
  341. 321 grep '^anna' regexfun
  342. 322 grep 'anna$' regexfun
  343. 323 grep '^anna$' regexfun
  344. 324 grep '^anna\b' regexfun
  345. 325 grep '^anna' regexfun
  346. 326 grep 'b.t' regexfun
  347. 327 grep 'b.*t' regexfun
  348. 328 grep 'b.+t' regexfun
  349. 329 grep -E 'b.+t' regexfun
  350. 330 grep -E 'b.?t' regexfun
  351. 331 grep 'bo\{2}\t'
  352. 332 grep 'bo\{2}\t' regexfun
  353. 333 grep 'bo\{2\}t' regexfun
  354. 334 cat regexfun
  355. 335 history
  356. 336 cat regexfun
  357. 337 grep '^anna ' regexfun
  358. 338 vim regexfun
  359. 339 grep '^anna ' regexfun
  360. 340 grep '^anna\b' regexfun
  361. 341 grep 'anna\b' regexfun
  362. 342 cat /etc/passwd
  363. 343 cut -f 1 /etc/passwd
  364. 344 cut -f 1 -d : /etc/passwd
  365. 345 cut -f 4 -d : /etc/passwd
  366. 346 cut -f 5 -d : /etc/passwd
  367. 347 cut -f 1 -d : /etc/passwd | sort
  368. 348 cut -f 3 -d : /etc/passwd | sort
  369. 349 cut -f 3 -d : /etc/passwd | sort -n
  370. 350 echo hello
  371. 351 echo hello | tr
  372. 352 echo hello | tr :lower: :upper:
  373. 353 echo hello | tr [:lower:] [:upper:]
  374. 354 echo hello | tr [a-z] [A-Z]
  375. 355 echo hello | tr [a-k] [l-z]
  376. 356 sed -n 5p /etc/passwd
  377. 357 for i in one two three; do mkdir $i; done
  378. 358 ls
  379. 359 for i in one two three; do echo hello > $i/hellofile; done
  380. 360 cat one/hellofile
  381. 361 sed -i 's/anna/linda/g' regexfun
  382. 362 cat regexfun
  383. 363 for i in one two three; do sed -i -e 's/hello/bye/' $i/hellofile; done
  384. 364 cat one/hellofile
  385. 365 #for i in "*scenario*"; do sed -i -e 's/feyenoord/noway/' $i/intro.md; done
  386. 366 awk -F : '{ print $4 }' /etc/passwd
  387. 367 awk -F : '/linda/ { print $4 }' /etc/passwd
  388. 368 awk -F : '$3 > 999 { print $1 }' /etc/passwd
  389. 369 history
  390. 370 pinfo sed
  391. 371 ls > myfile
  392. 372 cat myfile
  393. 373 who > myfile
  394. 374 cat myfile
  395. 375 ls >> myfile
  396. 376 cat myfile
  397. 377 ls > /dev/null
  398. 378 lsblk
  399. 379 ls > /dev/sda
  400. 380 grep -R root /proc
  401. 381 grep -R root /proc 2>/dev/null
  402. 382 grep -R root /etc &> myfile
  403. 383 less myfile
  404. 384 ps aux | tee psfile | grep ssh
  405. 385 cat psfile
  406. 386 history
  407. 387 vim .bash_history
  408. 388 countdown 14
  409. 389 exit
  410. 390 wc .bash_history
  411. 391 history
  412. 392 history -d 388
  413. 393 history
  414. 394 echo $HISTFILE
  415. 395 echo $HISTFILESIZE
  416. 396 echo $HISTSIZE
  417. 397 export HISTSIZE=10000
  418. 398 export HISTFILESIZE=10000
  419. 399 countdown 12
  420. 400 sudo -i
  421. 401 env
  422. 402 env | grep HIST
  423. 403 alias sander="help"
  424. 404 sander
  425. 405 alias
  426. 406 sudo vim /etc/profile
  427. 407 ls /etc/profile.d/
  428. 408 sudo vim /etc/profile.d/bighist.sh
  429. 409 vim .bash_profile
  430. 410 vim .bashrc
  431. 411 vim .bash_logout
  432. 412 ls -al
  433. 413 ls
  434. 414 tar -czvf student.tgz --exclude=backup* .
  435. 415 tar -cz --exclude=backup* .
  436. 416 sleep 10
  437. 417 sleep 3600
  438. 418 bg
  439. 419 ps aux | grep 3600
  440. 420 sleep 1800 &
  441. 421 jobs
  442. 422 fg 1
  443. 423 sudo dd if=/dev/zero of=/dev/null &
  444. 424 sudo jobs
  445. 425 dd if=/dev/zero of=/dev/null &
  446. 426 sudo jobs
  447. 427 dd if=/dev/zero of=/dev/null &
  448. 428 sudo top
  449. 429 killall dd
  450. 430 ls -l
  451. 431 pwd
  452. 432 ls -ld .
  453. 433 rm -f back*
  454. 434 systemctl status crond
  455. 435 sudo crontab -e
  456. 436 sudo journalctl
  457. 437 sudo lsblk
  458. 438 sudo umount /dev/sdb1
  459. 439 sudo mount /dev/sdb1 /mnt
  460. 440 cd /mnt
  461. 441 ls
  462. 442 ls -l
  463. 443 touch dummyfile
  464. 444 sudo touch dummyfile
  465. 445 ls
  466. 446 sudo umount /dev/sdb1
  467. 447 lsof /mnt
  468. 448 cd
  469. 449 sudo umount /dev/sdb1
  470. 450 ls /mnt
  471. 451 history
  472.  
Advertisement
Add Comment
Please, Sign In to add comment