Advertisement
sandervanvugt

RHCSA all days nov 23

Nov 9th, 2023
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.34 KB | None | 0 0
  1. [root@localhost ~]# history
  2. 1 cd /etc
  3. 2 cd -
  4. 3 tar -czvf /root/archive.tgz /etc/
  5. 4 tar tvf archive.tgz | less
  6. 5 tar -czvf /root/archive.tgz -C /etc/ .
  7. 6 tar tvf archive.tgz | less
  8. 7 history
  9. 8 sort /etc/dnsmasq.conf | sed '/^[\s]*$/d'
  10. 9 cat /etc/dnsmasq.conf | grep -v '^$' | sort
  11. 10 cat /etc/dnsmasq.conf | grep -v '^$' | sort > /var/tmp/dnslines.txt
  12. 11 history
  13. 12 useradd bob
  14. 13 su - bob
  15. 14 mkdir /root/userfiles
  16. 15 find / -type f -user bob
  17. 16 find / -type f -user bob -exec cp -p {} /root/userfiles/ \;
  18. 17 ls -al /root/userfiles/
  19. 18 history
  20. 19 vim /home/student/countdown
  21. 20 /home/student/countdown
  22. 21 find / -type f -user bob
  23. 22 find / -type f -user bob > /root/newfile
  24. 23 cat newfile
  25. 24 cp --help | less
  26. 25 echo $PATH
  27. 26 ln /home/student/countdown /usr/bin/countdown
  28. 27 man -k user
  29. 28 man man
  30. 29 man apropos
  31. 30 man mandb
  32. 31 mandb
  33. 32 man man
  34. 33 man -K SYNOPSIS
  35. 34 history
  36. 35 man -K autorelabel
  37. 36 man -k selinux
  38. 37 man selinux
  39. 38 visudo
  40. 39 useradd linda
  41. 40 echo password | passwd --stdin linda
  42. 41 su - linda
  43. 42 visudo
  44. 43 su - linda
  45. 44 history
  46. 45 which passwd
  47. 46 find / -name "passwd"
  48. 47 less /etc/passwd
  49. 48 vim /etc/login.defs
  50. 49 cd /etc/skel/
  51. 50 ls -a
  52. 51 touch hellofile
  53. 52 useradd lisa
  54. 53 useradd bob
  55. 54 useradd bill
  56. 55 ls -l /home/bill
  57. 56 usermod --help | less
  58. 57 tail -1 /etc/passwd
  59. 58 tail -1 /etc/group
  60. 59 cd
  61. 60 id lisa
  62. 61 usermod -aG wheel lisa
  63. 62 vim /etc/group
  64. 63 id lisa
  65. 64 usermod -L lisa
  66. 65 passwd lisa
  67. 66 usermod -L lisa
  68. 67 vim /etc/shadow
  69. 68 history
  70. 69 vim /etc/login.defs
  71. 70 touch /etc/skel/newfile
  72. 71 for i in anna anouk linda lisa; do useradd $i; done
  73. 72 for i in anna anouk linda lisa; do echo password | passwd --stdin $i; done
  74. 73 passwd lisa
  75. 74 groupadd profs
  76. 75 groupadd students
  77. 76 usermod -aG profs anna
  78. 77 usermod -aG profs anouk
  79. 78 usermod -aG students lisa
  80. 79 usermod -aG students linda
  81. 80 exit
  82. 81 id anna
  83. 82 exit
  84. 83 chage --help | less
  85. 84 chage -l anna
  86. 85 chage anna
  87. 86 vim /etc/shadow
  88. 87 vipw --help
  89. 88 vipw -s
  90. 89 ls -l /etc/shadow
  91. 90 chmod u+rw /etc/shadow
  92. 91 vipw -s
  93. 92 ls -ld /home/linda
  94. 93 ls -l /etc/hosts
  95. 94 touch /tmp/testfiles
  96. 95 chown linda:student /tmp/testfile
  97. 96 chown linda:student /tmp/testfiles
  98. 97 ls -l /tmp/testfiles
  99. 98 chmod 060 /tmp/tesfiles
  100. 99 chmod 060 /tmp/testfiles
  101. 100 id linda
  102. 101 ls -l /tmp/testfiles
  103. 102 chgrp students /tmp/testfiles
  104. 103 ls -l /tmp/testfiles
  105. 104 su - linda
  106. 105 touch /home/linda/rootfile
  107. 106 su - linda
  108. 107 mkdir -p /data/students
  109. 108 touch /data/students/{1..9}.txt
  110. 109 ls -l /data/students/
  111. 110 mkdir /data/students/202{0..4}
  112. 111 ls -l /data/students/
  113. 112 cd /data/students
  114. 113 chmod 660 202*
  115. 114 ls -l
  116. 115 chmod -R +x .
  117. 116 ls
  118. 117 ls -l
  119. 118 chmod -R -x .
  120. 119 chmod -R +X .
  121. 120 ls -l
  122. 121 pwd
  123. 122 cd ..
  124. 123 mkdir profs
  125. 124 chgrp profs profs
  126. 125 ls -l
  127. 126 chmod 770 *
  128. 127 ls -l
  129. 128 su - anna
  130. 129 chmod g+s /data/profs
  131. 130 ls -ld /data/profs
  132. 131 su - anna
  133. 132 su - anouk
  134. 133 chmod +t /data/profs
  135. 134 su - anouk
  136. 135 history
  137. 136 mkdir -p /data/students /data/profs
  138. 137 chgrp students /data/students
  139. 138 chgrp profs /data/profs
  140. 139 ls -l /data/profs
  141. 140 ls -l /data/
  142. 141 chmod 770 *
  143. 142 ls -l
  144. 143 lsblk
  145. 144 poweroff
  146. 145 lsblk
  147. 146 touch bb
  148. 147 cat /etc/fstab
  149. 148 blkid
  150. 149 blkid | awk '/n1p5 { print $2 }'
  151. 150 blkid | awk '/n1p5/ { print $2 }'
  152. 151 blkid | awk '/n1p5/ { print $2 }' >> /etc/fstab
  153. 152 vim /etc/fstab
  154. 153 reboot
  155. 154 lsblk
  156. 155 mount
  157. 156 mkfs.xfs --help
  158. 157 mkfs.xfs /dev/sdb1 -L mylabel
  159. 158 xfs_admin --help
  160. 159 xfs_admin -L myxfs /dev/nvme0n1p5
  161. 160 umount /dev/nvme0n1p5
  162. 161 xfs_admin -L myxfs /dev/nvme0n1p5
  163. 162 tune2fs -L myext4 /dev/nvme0n1p5
  164. 163 vim /etc/fstab
  165. 164 blkid
  166. 165 cd /dev/disk
  167. 166 ls
  168. 167 ls -l by-uuid
  169. 168 pwd
  170. 169 free -m
  171. 170 swapon -s
  172. 171 fdisk /dev/nvme0n1
  173. 172 lsbk
  174. 173 lsblk
  175. 174 mkswap /dev/nvme0n1p6
  176. 175 vim /etc/fstab
  177. 176 free -m
  178. 177 swapon -a
  179. 178 free -m
  180. 179 swapon -s
  181. 180 history
  182. 181 grep swap /etc/fstab
  183. 182 cd
  184. 183 lsblk
  185. 184 fdisk /dev/nvme0n2
  186. 185 mkdir -p /mounts/files /mounts/xfs
  187. 186 mkfs.ext4 /dev/nmve0n2p1
  188. 187 lsblk
  189. 188 mkfs.ext4 /dev/nvme0n2p1
  190. 189 mkfs.xfs /dev/nvme0n2p5 -L myxfs
  191. 190 mkswap /dev/nvme0n2p6
  192. 191 blkid
  193. 192 blkid | tail -3 | awk '{ print $2 }'
  194. 193 blkid | tail -3 | awk '{ print $2 }' >> /etc/fstab
  195. 194 vim /etc/fstab
  196. 195 mount -a
  197. 196 vim /etc/fstab
  198. 197 mount -a
  199. 198 swapon -a
  200. 199 reboot
  201. 200 history
  202. 201 df -h
  203. 202 lsblk
  204. 203 dd if=/dev/sr0 of=/rhel9.iso bs=1M
  205. 204 ls -l /
  206. 205 mkdir /repo
  207. 206 vim /etc/fstab
  208. 207 mount -a
  209. 208 ls /repo
  210. 209 history
  211. 210 ls /repo
  212. 211 ls
  213. 212 cd /repo
  214. 213 ls BaseOS/Packages/
  215. 214 cd AppStream/Packages/
  216. 215 ls
  217. 216 cd /
  218. 217 dnf config-manager --add-repo="file:///repo/BaseOS"
  219. 218 dnf config-manager --add-repo="file:///repo/AppStream"
  220. 219 dnf repolist
  221. 220 cd /etc/yum.repos.d/
  222. 221 ls
  223. 222 cat repo_BaseOS.repo
  224. 223 dnf install -y nmap
  225. 224 vim repo_BaseOS.repo
  226. 225 vim repo_AppStream.repo
  227. 226 dnf install nmap
  228. 227 dnf list "selinux*"
  229. 228 dnf provides */seinfo
  230. 229 seinfo
  231. 230 dnf provides */Dockerfile
  232. 231 history
  233. 232 dnf groups list
  234. 233 dnf groups install "Virtualization Host"
  235. 234 dnf groups list
  236. 235 history
  237. 236 cd
  238. 237 man dnf
  239. 238 dnf download httpd
  240. 239 ls
  241. 240 rpm -qp --scripts httpd-2.4.53-11.el9_2.4.x86_64.rpm
  242. 241 history
  243. 242 ip addr show
  244. 243 ip a
  245. 244 ifconfig
  246. 245 man ifconfig
  247. 246 ip a
  248. 247 nmtui
  249. 248 ip a
  250. 249 systemctl status NetworkManager
  251. 250 systemctl list-units
  252. 251 systemctl -t help
  253. 252 systemctl list-unit-files
  254. 253 dnf install -y httpd
  255. 254 systemctl status httpd
  256. 255 systemctl start httpd
  257. 256 systemctl status httpd
  258. 257 systemctl enable httpd
  259. 258 systemctl cat sshd.service
  260. 259 systemctl edit sshd.service
  261. 260 systemctl cat sshd.service
  262. 261 systemctl status sshd
  263. 262 kill -9 1108
  264. 263 systemctl status sshd
  265. 264 systemctl status httpd
  266. 265 systemctl disable httpd
  267. 266 systemctl status httpd
  268. 267 systemctl stop httpd
  269. 268 systemctl enable --now httpd
  270. 269 systemctl cat sshd.service
  271. 270 dnf install -y nginx
  272. 271 systemctl status nginx
  273. 272 systemctl mask nginx
  274. 273 systemctl start nginx
  275. 274 cd /var/log
  276. 275 ls -l
  277. 276 cd
  278. 277 journalctl
  279. 278 grep 'Storage' /etc/systemd/journald.conf
  280. 279 mkdir /var/log/journal
  281. 280 ls -l /var/log/journal
  282. 281 systemctl restart systemd-journal-flush.service
  283. 282 ls -l /var/log/journal
  284. 283 history
  285. 284 systemctl show httpd.service
  286. 285 man systemd.directives
  287. 286 man systemd.service
  288. 287 systemctl edit httpd.service
  289. 288 ls /etc/systemd/system/httpd.service.d/
  290. 289 cat /etc/systemd/system/httpd.service.d/override.conf
  291. 290 systemctl cat httpd
  292. 291 fdisk /dev/nvme0n2
  293. 292 pvcreate /dev/nvme0n2p7
  294. 293 pvcreate /dev/nvme0n2p8
  295. 294 pvs
  296. 295 vgcreate --help | less
  297. 296 vgcreate -s 8M vgdata /dev/nvme0n2p7
  298. 297 vgs
  299. 298 vgdisplay vgdata
  300. 299 echo $(( 255 * 8 ))
  301. 300 lvcreate -n lvdata -L 2G vgdata
  302. 301 lvcreate -n lvdata -l 255 vgdata
  303. 302 lvs
  304. 303 mkfs.ext4 /dev/vgdata/lvdata
  305. 304 mkdir /lvdata
  306. 305 vim /etc/fstab
  307. 306 mount -a
  308. 307 mount
  309. 308 ls -l /dev/mapper/vgdata-lvdata /dev/vgdata/lvdata
  310. 309 history
  311. 310 cat /etc/fstab
  312. 311 df -h
  313. 312 dd if=/dev/zero of=/lvdata/bifiles bs=1M
  314. 313 df -h
  315. 314 mount | grep lvdata
  316. 315 vgs
  317. 316 vgextend --help
  318. 317 fdisk -l
  319. 318 pvs
  320. 319 vgextend vgdata /dev/nvme0n2p8
  321. 320 vgs
  322. 321 lvextend --help | less
  323. 322 lvresize -r -l +50%FREE /dev/vgdata/lvdata
  324. 323 df -h
  325. 324 history
  326. 325 poweroff
  327. 326 lsblk
  328. 327 fdisk /dev/nvme0n3
  329. 328 fdisk /dev/nvme0n1
  330. 329 dd if=/dev/zero of=/dev/null &
  331. 330 top
  332. 331 renice --help
  333. 332 renice 10 6848
  334. 333 killall dd
  335. 334 systemctl status tuned
  336. 335 tuned-adm --help
  337. 336 tuned-adm list
  338. 337 tuned-adm recommend
  339. 338 tuned-adm profile balanced
  340. 339 tuned-adm list
  341. 340 ls /usr/lib/tuned/
  342. 341 ls /usr/lib/tuned/desktop/
  343. 342 cat /usr/lib/tuned/desktop/tuned.conf
  344. 343 ls /etc/tuned/
  345. 344 mkdir /etc/tuned/sander
  346. 345 cp /usr/lib/tuned/desktop/tuned.conf /etc/tuned/sander/
  347. 346 systemctl restart tuned
  348. 347 tuned-adm profiles
  349. 348 tuned-adm list
  350. 349 reboot
  351. 350 systemctl set-default graphical.target
  352. 351 systemctl isolate graphical.target
  353. 352 history
  354. 353 dnf install -y nfs-utils
  355. 354 showmount -e 192.168.29.142
  356. 355 mount 192.168.29.142:/nfsdata /mnt
  357. 356 mount
  358. 357 umount /mnt
  359. 358 vim /etc/hosts
  360. 359 ping nfsserver
  361. 360 dnf install -y autofs
  362. 361 vim /etc/auto.master
  363. 362 cat /etc/auto.misc
  364. 363 vim /etc/auto.master
  365. 364 vim /etc/auto.nfsdata
  366. 365 systemctl restart autofs
  367. 366 ls -l /
  368. 367 mount
  369. 368 cd /nfsfiles
  370. 369 ls -a
  371. 370 cd files
  372. 371 ls
  373. 372 mount
  374. 373 vim /etc/auto.master
  375. 374 vim /etc/auto.ldap
  376. 375 systemctl restart autofs
  377. 376 cd /home/ldap/
  378. 377 cd ldapuser1
  379. 378 history
  380. 379 cat /etc/auto.master
  381. 380 cd
  382. 381 ls /home
  383. 382 userdel bob
  384. 383 cd /home
  385. 384 ls -l
  386. 385 timedatectl show
  387. 386 timedatectl status
  388. 387 timedatectl set-time -h
  389. 388 vim /etc/chrony.conf
  390. 389 chronyc sources
  391. 390 date
  392. 391 at 8 pm
  393. 392 systemctl list-unit-files | grep fstrim
  394. 393 systemctl cat fstrim.timer
  395. 394 systemctl status fstrim.timer
  396. 395 systemctl enable --now fstrim.timer
  397. 396 systemctl status fstrim.service
  398. 397 systemctl list-units -t timer
  399. 398 systemctl list-unit-files logrotate*
  400. 399 systemctl status logrotate.service
  401. 400 systemctl status logrotate.timer
  402. 401 dnf install -y sysstat
  403. 402 sar -A
  404. 403 systemctl list-unit-files sysstat*
  405. 404 systemctl cat sysstat-collect.timer
  406. 405 systemctl cat sysstat.service
  407. 406 systemctl start sysstat.service
  408. 407 sar -A
  409. 408 man 7 systemd.path
  410. 409 man systemd-path
  411. 410 man systemd.directives
  412. 411 systemctl daemon-reload
  413. 412 vim /etc/crontab
  414. 413 ls /etc/cron*/
  415. 414 crontab --help
  416. 415 crontab -e -u linda
  417. 416 journalctl
  418. 417 crontab -e -u linda
  419. 418 history
  420. 419 exit
  421. 420 history | grep git
  422. 421 ls
  423. 422 exit
  424. 423 history
  425.  
  426.  
  427. #### student commands[student@localhost rhcsa]$ history
  428. 1 countdown 12
  429. 2 countdown 15
  430. 3 vim countdown
  431. 4 chmod +x countdown
  432. 5 ./countdown 14
  433. 6 ./countdown 14 lab time
  434. 7 ./countdown 14 "lab time"
  435. 8 ./countdown 13 "lab time"
  436. 9 sudo -i
  437. 10 sudo echo passwd | passwd --stdin lisa
  438. 11 sudo sh -c "echo passwd | passwd --stdin lisa"
  439. 12 sudo -i
  440. 13 su - anna
  441. 14 sudo -i
  442. 15 countdown 16
  443. 16 countdown 13
  444. 17 sudo -i
  445. 18 countdown 13
  446. 19 countdown 12
  447. 20 countdown 8
  448. 21 countdown 13
  449. 22 podman ps
  450. 23 podman stop sleepy
  451. 24 podman ps
  452. 25 podman stop 2ba
  453. 26 countdown 12
  454. 27 ssh student@192.168.29.142
  455. 28 sudo -i
  456. 29 podman run nginx
  457. 30 podman run docker.io/library/nginx
  458. 31 podman run -d docker.io/library/nginx
  459. 32 podman ps
  460. 33 history
  461. 34 cat /etc/containers/registries.conf
  462. 35 less /etc/containers/registries.conf
  463. 36 podman login registry.redhat.io
  464. 37 podman info
  465. 38 sudo dnf install git -y
  466. 39 git clone https://github.com/sandervanvugt/rhcsa
  467. 40 cd rhcsa/
  468. 41 ls
  469. 42 cat resources.txt
  470. 43 podman images
  471. 44 ls
  472. 45 cat Containerfile
  473. 46 podman build -t mymap .
  474. 47 podman images
  475. 48 podman run localhost/mymap
  476. 49 cat Containerfile
  477. 50 podman ps
  478. 51 podman stop jovial_haibt
  479. 52 podman ps
  480. 53 podman ps -a
  481. 54 podman start jovial_haibt
  482. 55 podman ps
  483. 56 podman rm jovial_haibt
  484. 57 podman rm --force jovial_haibt
  485. 58 podman ps -a
  486. 59 podman images
  487. 60 podman inspect localhost/mymap | less
  488. 61 podman ps
  489. 62 podman ps a-
  490. 63 podman ps -a
  491. 64 podman inspect 742 | less
  492. 65 podman run -it docker.io/library/nginx sh
  493. 66 podman ps
  494. 67 podman run -d nginx
  495. 68 podman exec -it 6f1 sh
  496. 69 podman ps
  497. 70 podman run docker.io/library/nginx -it sh
  498. 71 podman search ubi
  499. 72 podman run --name sleepy docker.io/redhat/ubi9 sleep 3600
  500. 73 podman images
  501. 74 podman run -d --name sleepy docker.io/redhat/ubi9 sleep 3600
  502. 75 podman rm sleepy
  503. 76 podman ps -a
  504. 77 podman run busybox
  505. 78 podman ps
  506. 79 podman ps -a
  507. 80 podman run docker.io/library/mariadb
  508. 81 podman ps
  509. 82 podman ps -a
  510. 83 podman logs vigorous_dijkstra
  511. 84 podman run docker.io/library/mariadb --env MARIADB_ROOT_PASSWORD=password
  512. 85 podman run docker.io/library/mariadb -e MARIADB_ROOT_PASSWORD=password
  513. 86 podman run --env MARIADB_ROOT_PASSWORD=password docker.io/library/mariadb
  514. 87 podman run -d -p 80:80 docker.io/library/nginx
  515. 88 podman run -d -p 8080:80 docker.io/library/nginx
  516. 89 podman port -a
  517. 90 podman ps
  518. 91 curl localhost:8080
  519. 92 sudo firewall-cmd --add-port=8080/tcp --permanent
  520. 93 sudo firewall-cmd --reload
  521. 94 firewall-cmd --help
  522. 95 firewall-cmd --help | grep port
  523. 96 firewall-ctl --panic-on
  524. 97 firewallctl --panic-on
  525. 98 firewall-cmd --panic-on
  526. 99 firewall-cmd --reload
  527. 100 history
  528. 101 sudo firewall-cmd --list-all
  529. 102 history
  530. 103 cd
  531. 104 mkdir data
  532. 105 podman unshare chown 27:27 data
  533. 106 ls -l data
  534. 107 ls -ld data
  535. 108 podman unshare ls -ld data
  536. 109 podman images
  537. 110 podman inspect f35
  538. 111 podman inspect f35 | less
  539. 112 podman ps
  540. 113 podman ps -a
  541. 114 podman inspect e8f | less
  542. 115 podman search mariadb | grep quay
  543. 116 podman run -d --name mydb -e MYSQL_ROOT_PASSWORD=password quay.io/centos7/mariadb-103-centos7
  544. 117 ping quay.io
  545. 118 sudo nmtui
  546. 119 sudo reboot
  547. 120 ping quay.io
  548. 121 podman run -d --name mydb -e MYSQL_ROOT_PASSWORD=password quay.io/centos7/mariadb-103-centos7
  549. 122 podman ps
  550. 123 podman inspect mydb
  551. 124 podman inspect mydb | less
  552. 125 podman exec mydb grep mysql /etc/passwd
  553. 126 mkdir mydb
  554. 127 podman unshare chown 27:27 mydb
  555. 128 ls -ld mydb/
  556. 129 podman unshare cat /proc/self/uid_map
  557. 130 podman unshare ls -ld mydb
  558. 131 podman stop mydb
  559. 132 podman rm mydb
  560. 133 podman run -d --name mydb -e MYSQL_ROOT_PASSWORD=password -v /home/student/mydb:/var/lib/mysql:Z quay.io/centos7/mariadb-103-centos7
  561. 134 ls -Z mydb
  562. 135 grep linda /etc/passwd
  563. 136 sudo loginctl enable-linger linda
  564. 137 ssh linda@localhost
  565. 138 sudo vim /etc/ssh/sshd_config
  566. 139 sudo systemctl restart sshd
  567. 140 ssh linda@localhost
  568. 141 sudo reboot
  569. 142 ps faux | less
  570. 143 exit
  571. 144 sudo -i
  572. 145 ls
  573. 146 cd rhcsa/
  574. 147 ls
  575. 148 less mini-exam-30min.txt
  576. 149 history
  577. 150 cat mini-exam-30min.txt
  578. 151 git pull
  579. 152 less resources.txt
  580. 153 vim resources.txt
  581. 154 sudo -i
  582. 155 history
  583.  
  584.  
  585. ##### linda commands 1 useradd lisa
  586. 2 sudo useradd lisa
  587. 3 sudo passwd lisa
  588. 4 sudo userdel lisa
  589. 5 sudo passwd root
  590. 6 exit
  591. 7 sudo passwd root
  592. 8 sudo passwd lisa
  593. 9 exit
  594. 10 cat /tmp/testfiles
  595. 11 chmod 660 /tmp/testfiles
  596. 12 cat /tmp/testfiles
  597. 13 exit
  598. 14 ls -l
  599. 15 rm -f rootfile
  600. 16 ls -ld .
  601. 17 exit
  602. 18 mkdir -p .config/systemd/user
  603. 19 cd .config/systemd/user/
  604. 20 podman run -d --name mynginx -p 8081:80 nginx
  605. 21 podman ps
  606. 22 pwd
  607. 23 podman generate systemd --name mynginx --files --new
  608. 24 cat container-mynginx.service
  609. 25 systemctl --user daemon-reload
  610. 26 systemctl --user enable container-mynginx.service
  611. 27 sudo reboot
  612. 28 exit
  613. 29 history
  614.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement