Post

Linux Tips & Nuggets

Command List

Command Description
visudo Run CMD as sudo without PW
realpath Provides Absolute Path

Usage

1. visudo

1
2
3
4
sudo visudo

#At EOL, add:
userName ALL=(targetUser) NOPASSWD: /home/userName/sh/myScript.sh

Parameters

  • userName: user who will run the command
  • targetUser: user as whom the command should run (e.g., root)

For security:

1
2
sudo chown root:root /home/userName/sh/myScript.sh
sudo chmod 700 /home/userName/sh/myScript.sh

2. realpath

1
realpath ~/Documents/ # gives absolute path

3. fzf

1
2
3
4
5
6
# Add function as alias to ~/.zshrc or ~/.bashrc avoid loop
fz(){
  vi "$(fzf)"
}

source ~/.zshrc
This post is licensed under CC BY 4.0 by the author.