General Linux tips for sudo access, text cleanup, shared folders and file transfers.
A grab-bag of general Linux tips that don’t belong to any one tool, but come up often enough during engagements to be worth keeping in one place.
Check sudo access
cat /etc/group | grep sudo # List members of the sudo groupsudo cat /etc/sudoers # Review sudo rules (requires sudo access)usermod -a -G sudo username # Add a user to the sudo groupTo let a user run a specific command without a password prompt, add a line like this to /etc/sudoers (via visudo):
username ALL=NOPASSWD: /etc/init.d/sshRun a shell as another user (as root)
su -c bash usernameShow all completions on TAB instead of cycling through them
sudo nano /etc/inputrcset completion-query-items 1000 # 0 = no limitMount a VMware shared folder in a Linux guest
cd /mnt/hgfs/lsIf /mnt/hgfs/ doesn’t exist yet:
sudo mkdir -p /mnt/hgfssudo vmhgfs-fuse .host:/SharedFolder /mnt/hgfs -o allow_other # Change "SharedFolder" to the name set in VMwareClean up extracted text
sudo sed -i -E 's|https?://||g' *.txt # Strip http:// and https:// from every line in every .txt file# Count total characters across a text fileawk 'BEGIN{FS=""}{for(i=1;i<=NF;i++)c++}END{print "total chars:"c}' wordlist.txt# Total line count across every .txt file in a folderwc -l *.txt | awk '{total += $1} END {print total}'Convert a colon-delimited combo list to CSV
{ echo '"URL","Username","Password"' awk -F: ' NF==3 { gsub(/\r/, "", $1); gsub(/\r/, "", $2); gsub(/\r/, "", $3); gsub(/"/, "\"\"", $1); gsub(/"/, "\"\"", $2); gsub(/"/, "\"\"", $3); printf "\"%s\",\"%s\",\"%s\"\n", $1, $2, $3 } ' combolist.txt} > output.csvSecure copy over SSH
scp *.txt user@remote_host:/path/to/destination/



