lwc:programming:bash

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lwc:programming:bash [2024/09/09 10:15] – [PDF] John Harrisonlwc:programming:bash [2025/11/09 20:00] (current) John Harrison
Line 181: Line 181:
  
 <code>sudo lsof -i:8078</code> <code>sudo lsof -i:8078</code>
 +==== Superuser ==== 
 +=== Execute sudo cmd without needing to type password === 
 +== Staying Safe == 
 +  - backup ''/etc/sudoers'' file i.e. copy to somewhere safe 
 +  - leave at least one terminal window open as root 
 +  - edit ''/etc/sudoers'' with ''visudo'' not ''sudo''. It's a wrapper for your already configured editor (not necessarily vi) 
 +== The Magic == 
 +  * create a wrapper script that does all your magic for you. Don't add sudo to the cmds in the wrapper script 
 +  * using ''visudo'' add to the end of your ''/etc/sudoers'' file ''USERNAME ALL=(ALL:ALL) NOPASSWD: FULL_PATH_TO_SCRIPT'' substituting in USERNAME and FULL_PATH_TO_SCRIPT as necessary 
 +  * to execute the cmd without password type ''sudo FULL_PATH_TO_THE_SCRIPT''
 ===== Misc ===== ===== Misc =====
    * write to dmesg: ''echo Some message > /dev/kmsg''    * write to dmesg: ''echo Some message > /dev/kmsg''
Line 190: Line 199:
    * traverse through to see what is using disk space: ''du -cha --max-depth=1 /var | grep -E "M|G"''    * traverse through to see what is using disk space: ''du -cha --max-depth=1 /var | grep -E "M|G"''
    * find out what app is on a particular port: ''netstat -anpe | grep "1234" | grep "LISTEN"''    * find out what app is on a particular port: ''netstat -anpe | grep "1234" | grep "LISTEN"''
 +   * if ''mount -o loop ./live-cd.iso /mnt'' returns ''mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.'' then
 +     * ''sudo kpartx -av live-cd.iso'' and (example) ''sudo mount -o loop /dev/mapper/loop0p1 /mnt''
  
  • lwc/programming/bash.1725894911.txt.gz
  • Last modified: 2024/09/09 10:15
  • by John Harrison