User Tools

Site Tools


linux:bash

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:bash [2023/07/11 07:02] – [Set VIM as visudo] bstaffordlinux:bash [2023/07/25 15:20] (current) – [Read File] bstafford
Line 1: Line 1:
 ======BASH====== ======BASH======
 ===== Set VIM as visudo ===== ===== Set VIM as visudo =====
 +Run as root
 <code>echo "export EDITOR=vim;" >> ~/.bashrc</code> <code>echo "export EDITOR=vim;" >> ~/.bashrc</code>
 +
 +From
 +<code>VISUAL="vim" ; export VISUAL
 +EDITOR="$VISUAL" ; export EDITOR</code>
 +
 +===== Read File =====
 +Read a list of words from a file [[https://blog.apnic.net/2023/07/19/the-joy-of-txt/|source]]
 +
 +<code>#!/bin/bash
 +domainsfile="domains.txt"
 +
 +while read domain
 +do
 +    echo "--"
 +    echo "[$(date)] CHECKING DOMAIN $domain"
 +    echo "--"
 +
 +    host -W 5 -t txt "$domain". # -W 5 for a 5 second timeout
 +done < "$domainsfile"</code>
 +<code>./get-txt-records.sh > host.out 2>&1</code>
 +===== Sudo =====
 +Add user to sudo list in ''visudo''
 +<code>username ALL=(ALL:ALL) ALL</code>
 +The add user where they don't need password, use the following.
 +
 +REMEMBER: put this at the bottom of the file or other lines may get applied after this and change the user permission.
 +<code>username ALL=(ALL) NOPASSWD: ALL</code>
 =====Toggle Bash History===== =====Toggle Bash History=====
 Turn Off<code>set +o history</code> Turn Off<code>set +o history</code>
linux/bash.1689058961.txt.gz · Last modified: by bstafford