sandervanvugt

linfun jan22 day2

Jan 19th, 2022
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.51 KB | None | 0 0
  1. #### root commands
  2. [root@localhost devices]# history
  3. 1 usermod -aG wheel bob
  4. 2 id bob
  5. 3 exit
  6. 4 echo password | passwd --stdin linda
  7. 5 exit
  8. 6 dd if=/dev/zero of=/dev/null &
  9. 7 top
  10. 8 killall dd
  11. 9 ps fax
  12. 10 ps aux | grep defunct
  13. 11 top
  14. 12 ps -ef | less
  15. 13 ps aux --sort pmem | less
  16. 14 ps aux | grep crond
  17. 15 kill -9 1318
  18. 16 lscpu
  19. 17 cd /sys
  20. 18 ls
  21. 19 cd bus/
  22. 20 ls
  23. 21 cd cpu/
  24. 22 ls
  25. 23 cd devices/
  26. 24 pwd
  27. 25 ls
  28. 26 ls cpu0/
  29. 27 ls cpu0/online
  30. 28 cat cpu0/online
  31. 29 echo 0 > cpu1/online
  32. 30 lscpu
  33. 31 dd if=/dev/zero of=/dev/null &
  34. 32 top
  35. 33 killall dd
  36. 34 htop
  37. 35 systemctl status NetworkManager
  38. 36 ip a
  39. 37 ip route show
  40. 38 ifconfig
  41. 39 ip a
  42. 40 ifconfig
  43. 41 man ifconfig
  44. 42 which ifconfig
  45. 43 rpm -qf $(which ifconfig)
  46. 44 rpm -ql net-tools
  47. 45 rpm -ql net-tools | grep bin
  48. 46 dnf remove net-tools
  49. 47 journalctl
  50. 48 lsblk
  51. 49 umount /dev/sdb1
  52. 50 mount /dev/sdb1 /mnt
  53. 51 ls /mnt
  54. 52 history
  55.  
  56. ### user commands
  57. 3 ls
  58. 4 ls -a
  59. 5 ls .ssh/
  60. 6 cat .ssh/known_hosts
  61. 7 ssh 192.168.29.199
  62. 8 sudo useradd bob
  63. 9 sudo passwd bob
  64. 10 su - bob
  65. 11 history
  66. 12 w
  67. 13 exit
  68. 14 vi countdown
  69. 15 countdown
  70. 16 echo $PATH
  71. 17 ./countdown
  72. 18 ls -l countdown
  73. 19 chmod +x countdown
  74. 20 ./countdown 12
  75. 21 history
  76. 22 cat countdown
  77. 23 vi countdown
  78. 24 echo $(( 2 x 2 ))
  79. 25 echo $(( 2 * 2 ))
  80. 26 vi countdown
  81. 27 which true
  82. 28 vi countdown
  83. 29 countdown
  84. 30 echo $PATH
  85. 31 which true
  86. 32 pwd
  87. 33 ls -l countdown
  88. 34 ls
  89. 35 chmod +x countdown
  90. 36 ./countdown 12
  91. 37 history
  92. 38 echo $PATH
  93. 39 cp countdown /usr/local/bin
  94. 40 ls /usr/local/bin
  95. 41 ls -ld /usr/local/bin
  96. 42 whoami
  97. 43 sudo cp countdown /usr/local/bin
  98. 44 countdown 0
  99. 45 which countdown
  100. 46 history
  101. 47 ls -l /etc/shadow
  102. 48 cat /etc/shadow
  103. 49 sudo cat /etc/shadow
  104. 50 ls -l /etc/shadow
  105. 51 id
  106. 52 useradd linda
  107. 53 sudo useradd linda
  108. 54 tail /etc/passwd
  109. 55 sudo passwd linda
  110. 56 history
  111. 57 su - linda
  112. 58 sudo usermod -aG wheel linda
  113. 59 id linda
  114. 60 su - linda
  115. 61 history | tail -10
  116. 62 countdown 12
  117. 64 history
  118. 65 exit
  119. 66 history
  120. 67 ls -a
  121. 68 ls
  122. 69 LS
  123. 70 uname --help
  124. 71 uname -a
  125. 72 uname --all
  126. 73 uname -srv
  127. 74 uname --srv
  128. 75 df --help
  129. 76 df -h
  130. 77 df --help
  131. 78 whoami
  132. 79 whoami --help
  133. 80 hostname
  134. 81 hostname --help
  135. 82 who am i
  136. 83 whoami
  137. 84 who --help
  138. 85 who mom likes
  139. 87 date
  140. 88 date --help | less
  141. 89 date %N
  142. 90 date +%d-%m-%y
  143. 91 date +%d-%m-%y:%h:%m:%N
  144. 92 uname --help | less
  145. 93 uname -op
  146. 94 uname -p
  147. 95 uname -po
  148. 96 passwd --help | less
  149. 97 sudo dnf install tldr
  150. 99 sudo dnf repolist
  151. 100 sudo dnf install epel-release
  152. 101 sudo dnf repolist
  153. 102 sudo dnf install tldr
  154. 103 tldr lvcreate
  155. 104 tldr semanage
  156. 105 history
  157. 106 touch helloworld
  158. 107 ls -l
  159. 108 touch /usr/bin/helloworld
  160. 109 touch helloworld
  161. 110 ls -l
  162. 111 last
  163. 112 sudo dnf provides */semanage
  164. 113 countdown 12
  165. 114 tldr ls
  166. 115 man ls
  167. 116 info '(coreutils) ls invocation'
  168. 117 pinfo '(coreutils) ls invocation'
  169. 118 man lvcreate
  170. 119 man -k user
  171. 120 mandb
  172. 121 sudo mandb
  173. 122 man -k user
  174. 123 man -k user | wc
  175. 124 man -k user
  176. 125 man man
  177. 126 man -k user | grep 8
  178. 127 cd /etc
  179. 128 ls
  180. 129 sudo vi sudoers
  181. 130 ls -lrt
  182. 131 cd /var/log
  183. 132 ls -lrt
  184. 133 tail messages
  185. 134 sudo tail messages
  186. 135 cd /etc
  187. 136 ls l
  188. 137 ls l*
  189. 138 ls -d l*
  190. 139 ls -d l?.*
  191. 140 ls [klm]* -d
  192. 141 ls [k-m]* -d
  193. 142 mkdir blah
  194. 143 pwd
  195. 144 cd
  196. 145 pwd
  197. 146 mkdir myfiles
  198. 147 cd myfiles/
  199. 148 ls
  200. 149 pwd
  201. 150 cd ..
  202. 151 cd -
  203. 152 cd ../..
  204. 153 rmdir student/myfiles/
  205. 154 cd
  206. 155 mkdir myfiles
  207. 156 cp /etc/[a-d]* myfiles/
  208. 157 ls myfiles/
  209. 158 rmdir myfiles
  210. 159 rm -rf myfiles/
  211. 160 sudo dnf search epel
  212. 161 man fhs
  213. 162 man hier
  214. 163 cd /
  215. 164 ls
  216. 165 history
  217. 166 sudo poweroff
  218. 167 ls
  219. 168 pwd
  220. 169 ls -l /var/log/messages
  221. 170 cd /var
  222. 171 ls -l log/messages
  223. 172 ls
  224. 173 cd gopher/
  225. 174 ls
  226. 175 ls -l log/messages
  227. 176 pwd
  228. 177 ls
  229. 178 ls -l ../log/messages
  230. 179 mkdir blah
  231. 180 sudo mkdir blah
  232. 181 cd blah/
  233. 182 ls -l ../log/messages
  234. 183 ls -l ../../log/messages
  235. 184 ls -l /var/log/messages
  236. 185 touch afile.txt
  237. 186 sudo touch afile.txt
  238. 187 cp afile.txt ~/myfiles
  239. 188 ls -l ~/myfiles
  240. 189 rm ~/myfiles
  241. 190 cp afile.txt ~/myfiles/
  242. 191 mkdir ~/myfiles; cp afile.txt ~/myfiles/
  243. 192 cd
  244. 193 ls
  245. 194 ls -a
  246. 195 cp -a .* myfiles/
  247. 196 ls -a myfiles/
  248. 197 man cp
  249. 198 echo a ; echo b
  250. 199 touch /var/log/blah ; echo b
  251. 200 touch /var/log/blah && echo b
  252. 201 touch /var/log/blah || echo b
  253. 202 echo a || echo b
  254. 203 ls
  255. 204 cd myfiles/
  256. 205 cp -R /tmp/ .
  257. 206 ls
  258. 207 cd tmp/
  259. 208 ls
  260. 209 cd ..
  261. 210 rm -rf *
  262. 211 cp -R /tmp .
  263. 212 ls
  264. 213 cd tmp
  265. 214 ls
  266. 215 history
  267. 216 cd
  268. 217 ls
  269. 218 mv helloworld hellomoon
  270. 219 ls
  271. 220 mv hellomoon /tmp/
  272. 221 ls /tmp/
  273. 222 ls /tmp
  274. 223 mkdir /tmp/trash/files
  275. 224 mkdir -p /tmp/trash/files
  276. 225 cp -a . /tmp/trash/files/
  277. 226 ls /tmp/trash/files
  278. 227 tree /tmp/trash/files
  279. 228 cp -a /tmp/ .
  280. 229 ls
  281. 230 ln /etc/hosts myhosts
  282. 231* ls -l /etc/hosts
  283. 232 sudo ln /etc/hosts myhosts
  284. 233 ls -il /etc/hosts myhosts
  285. 234 sudo vim myhosts
  286. 235 ls -il /etc/hosts myhosts
  287. 236 cat /etc/hosts
  288. 237 sudo /etc/hosts
  289. 238 sudo rm /etc/hosts
  290. 239 cat myhosts
  291. 240 ls -il /etc/hosts myhosts
  292. 241 sudo ln myhosts /etc/hosts
  293. 242 ln -s myhosts symhosts
  294. 243 ls -il /etc/hosts myhosts symhosts
  295. 244 echo hello >> myhosts
  296. 245 rm myhosts
  297. 246 ls -il /etc/hosts myhosts symhosts
  298. 247 cat symhosts
  299. 248 ln /etc/hosts symhosts
  300. 249 ln /etc/hosts myhosts
  301. 250 sudo ln /etc/hosts myhosts
  302. 251 history
  303. 252 ls -il /etc/hosts myhosts symhosts
  304. 253 vim symhosts
  305. 254 ls -l
  306. 255 sudo touch rootfile
  307. 256 ls -l rootfile
  308. 257 cat rootfile
  309. 258 echo hello >> rootfile
  310. 259 rm rootfile
  311. 260 ls -ld .
  312. 261 ls -l /
  313. 262 df -h
  314. 263 sudo ls -l /boot
  315. 264 sudo ln /boot/vmlinuz-4.18.0-348.el8.0.2.x86_64 kernel
  316. 265 sudo ln -s /boot/vmlinuz-4.18.0-348.el8.0.2.x86_64 kernel
  317. 266 ls -l
  318. 267 sudo find / -name "hosts"
  319. 268 sudo find / -name "*hosts*"
  320. 269 find / -name "*hosts*"
  321. 270 find / -name "*hosts*" 2>/dev/null
  322. 271 sudo find / -name linda
  323. 272 sudo find / -size +500M
  324. 273 sudo find / -size +500M 2>/dev/null
  325. 274 mkdir linda; sudo find / -user linda -exec cp {} linda/ \;
  326. 275 mkdir linda; sudo find / -user linda -exec cp -r {} linda/ \;
  327. 276 ls linda/
  328. 277 history
  329. 278 man find
  330. 279 sudo tar -cvf myfiles.tar /etc/hosts /home
  331. 280 ls -l
  332. 281 tar -tvf myfiles.tar | less
  333. 282 tar -xvf myfiles.tar
  334. 283 ls
  335. 284 ls etc
  336. 285 ls home
  337. 286 rm -rf etc home
  338. 287 sudo tar -czvf myfiles.tar.gz /etc/hosts /home
  339. 288 man tar
  340. 289 ls
  341. 290 sudo tar -czvf myfiles.tar.gz /etc/hosts /home --exclude=myfiles*
  342. 291 ls
  343. 292 rm myfiles.tar.gz
  344. 293 sudo tar -czvf myfiles.tar.gz /etc/hosts /home --exclude=myfiles*
  345. 294 rm myfiles*; sudo tar -czvf /tmp/myfiles.tar.gz /etc/hosts /home
  346. 295 time sudo tar -cjvf /tmp/myfiles.tar.bz2 /etc/hosts /home
  347. 296 time sudo tar -cJvf /tmp/myfiles.tar.xz /etc/hosts /home
  348. 297 ls -l /tmp/myfiles.tar.*
  349. 298 history
  350. 299 nano whatever
  351. 300 vimtutor
  352. 301 vim whatever
  353. 302 vim countdown
  354. 303 sudo less /var/log/messages
  355. 304 sudo more /var/log/messages
  356. 305 head /etc/passwd
  357. 306 head -5 /etc/passwd
  358. 307 head -n 5 /etc/passwd
  359. 308 tail -5 /etc/passwd
  360. 309 tail -5 /etc/passwd | head -1
  361. 310 sudo tail -f /var/log/messages
  362. 311 cat countdown
  363. 312 tac countdown
  364. 313 cd /etc
  365. 314 sudo grep linda *
  366. 315 sudo grep linda * 2>/dev/null
  367. 316 sudo grep -l linda * 2>/dev/null
  368. 317 sudo grep -li linda * 2>/dev/null
  369. 318 sudo grep -li LINDA * 2>/dev/null
  370. 319 ps aux
  371. 320 ps aux | wc
  372. 321 ps aux | grep ssh
  373. 322 ps aux | grep ssh | grep -v grep
  374. 323 sudo grep wheel /etc/sudoers
  375. 324 sudo grep -A 5 -B 5 wheel /etc/sudoers
  376. 325 grep linda *
  377. 326 grep linda * 2>/dev/null
  378. 327 grep -R linda * 2>/dev/null
  379. 328 grep -R root * 2>/dev/null
  380. 329 sudo grep -C 5 wheel /etc/sudoers
  381. 330 man 7 regex
  382. 331 tldr regex
  383. 332 cd
  384. 333 vim users.txt
  385. 334 grep 'l' users.txt
  386. 335 grep '^l' users.txt
  387. 336 grep '^anna' users.txt
  388. 337 echo anna
  389. 338 echo anna >> users.txt
  390. 339 grep '^anna' users.txt
  391. 340 grep 'anna$' users.txt
  392. 341 grep '^anna\b' users.txt
  393. 342 grep '^anna ' users.txt
  394. 343 grep 'b.t' users.txt
  395. 344 grep 'b.*t' users.txt
  396. 345 grep 'bt' users.txt
  397. 346 echo bt >> users.txt
  398. 347 grep 'b.*t' users.txt
  399. 348 grep 'b.+t' users.txt
  400. 349 grep -E 'b.+t' users.txt
  401. 350 grep -E 'b.?t' users.txt
  402. 351 grep 'bo\{12\}t' users.txt
  403. 352 grep 'bo\{9\}t' users.txt
  404. 353 grep '^$' users.txt
  405. 354 grep '^.$' users.txt
  406. 355 echo x >> users.txt
  407. 356 grep '^.$' users.txt
  408. 357 man semanage-fcontext
  409. 358 sed -n 5p /etc/passwd
  410. 359 sed -i 's/anna/bananna/g' users.txt
  411. 360 cat users.txt
  412. 361 sed -i -e '2d' users.txt
  413. 362 cat users.txt
  414. 363 echo hello > myfile{1..100}.txt
  415. 364 touch myfile{1..100}.txt
  416. 365 ls
  417. 366 for i in myfile*; do echo $i; done
  418. 367 for i in myfile*; do echo hello > $i; done
  419. 368 rm -rf myfile
  420. 369 rm -rf myfiles
  421. 370 ls
  422. 371 for i in myfile*; do echo 'hello > $i'; done
  423. 372 for i in myfile*; do echo hello > $i; done
  424. 373 cat myfile1
  425. 374 cat myfile1.txt
  426. 375 cat myfile18.txt
  427. 376 history
  428. 377 for i in myfile*; do sed -i 's/hello/goedemiddag/g' $i; done
  429. 378 cat myfile66.txt
  430. 379 cat /etc/passwd
  431. 380 awk -F : '{ print $4 }' /etc/passwd
  432. 381 awk -F : '/student/ { print $4 }' /etc/passwd
  433. 382 awk -F : '$3 > 999 { print $1 }' /etc/passwd
  434. 383 history
  435. 384 cut -d : -f 1 /etc/passwd
  436. 385 cut -d : -f 1 /etc/passwd | sort
  437. 386 cut -d : -f 3 /etc/passwd | sort
  438. 387 cut -d : -f 3 /etc/passwd | sort -n
  439. 388 cut -d : -f 1 /etc/passwd | sort -n | tr [a-z] [A-Z]
  440. 389 cut -d : -f 1 /etc/passwd | sort -n | tr [:lower:] [:upper:]
  441. 390 echo $SHELL
  442. 391 chsh --help
  443. 392 chsh -l
  444. 393 #chsh /bin/bash
  445. 394 sort < /etc/services
  446. 395 sort /etc/services
  447. 396 ls
  448. 397 ls > outfile.txt
  449. 398 cat outfile.txt
  450. 399 who > outfile.txt
  451. 400 cat outfile.txt
  452. 401 who >> outfile.txt
  453. 402 grep -R root /proc
  454. 403 grep -R root /etc
  455. 404 grep -R root /etc 2> /dev/null
  456. 405 grep -R root /etc 2> errors.txt
  457. 406 ls -l errors.txt
  458. 407 less errors.txt
  459. 408 grep -R root /etc &> all.txt
  460. 409 ls -l *txt
  461. 410 ls -l [ae]*txt
  462. 411 ps aux | less
  463. 412 ps aux | grep ssh
  464. 413 sudo kill 1120
  465. 414 ps aux | grep ssh
  466. 415 ps aux | tee psfile | grep ssh
  467. 416 cat psfile
  468. 417 ps aux | grep ssh
  469. 418 sudo systemctl status sshd
  470. 419 sudo systemctl start sshd
  471. 420 ps aux | grep ssh
  472. 421 sudo -i
  473. 422 sudo 'echo password | passwd --stdin linda'
  474. 423 sudo bash -c 'echo password | passwd --stdin linda'
  475. 424 history
  476. 425 history -d 424
  477. 426 history
  478. 427 history -d 422
  479. 428 sudo dnf install bash-completion
  480. 429 sudo nmcli connection modify ens160 ipv4.address 10.0.0.10/24
  481. 430 sudo nmtui
  482. 431 ip a
  483. 432 env
  484. 433 echo $USER
  485. 434 echo $SHELL
  486. 435 echo $PATH
  487. 436 alias
  488. 437 alias help='echo what do you want'
  489. 438 help
  490. 439 unalias help
  491. 440 help
  492. 441 sleep 3600
  493. 442 sudo vim /etc/profile
  494. 443 sudo vim /etc/bashrc
  495. 444 sudo ls /etc/profile.d/
  496. 445 ls -a
  497. 446 vim .bash_profile
  498. 447 vim .bashrc
  499. 448 history
  500. 449 sleep 3600
  501. 450 bg
  502. 451 jobs
  503. 452 sleep 1800 &
  504. 453 jobs
  505. 454 fg 2
  506. 455 fg
  507. 456 sudo dd if=/dev/zero of=/dev/null &
  508. 457 jobs
  509. 458 sudo -i
  510. 459 history
  511.  
Advertisement
Add Comment
Please, Sign In to add comment