Here’s how to restore or set the Bash prompt on RHEL systems.
echo "PS1='\u@\h \w]\$'" >> ~/.bashrc source ~/.bashrc |
cloud engineer
Here’s how to restore or set the Bash prompt on RHEL systems.
echo "PS1='\u@\h \w]\$'" >> ~/.bashrc source ~/.bashrc |
echo "PS1='\u@\h \w]\$'" >> ~/.bashrc source ~/.bashrc
Here’s the command to display only the current directory.
export PROMPT_DIRTRIM=1 |
export PROMPT_DIRTRIM=1
Place the command in your ~/.bashrc to make it permanent.
Removing sudo password is typically not a good practice. If you’re a seasoned system administrator, or you’re the only one using your own desktop, being prompted for a sudo password can get really annoying. Here’s how to stop getting prompted every time you run sudo.
Run visudo.
sudo visudo |
sudo visudo
Edit the sudo line and set to below.
%sudo ALL=(ALL) NOPASSWD: ALL |
%sudo ALL=(ALL) NOPASSWD: ALL
Save file.
Here’s how to find your GitBash .bashrc.
# cd takes you to gitbash home cd # edit .bashrc vim ~/.bashrc |
# cd takes you to gitbash home cd # edit .bashrc vim ~/.bashrc
You can add aliases, change prompt styles, etc.
export PS1="\w: $ " alias gcloud="gcloud.cmd" alias gsutil="gsutil.cmd" alias code="cd ~/Code" cd Code |
export PS1="\w: $ " alias gcloud="gcloud.cmd" alias gsutil="gsutil.cmd" alias code="cd ~/Code" cd Code
How to suppress typing “yes” when prompted by ssh.
#!/bin/bash ssh-keygen -f "/home/user/.ssh/known_hosts" -R "yourdomain.com" ssh -o "StrictHostKeyChecking=no" -i "keys/key.pem" ubuntu@domain.com |
#!/bin/bash ssh-keygen -f "/home/user/.ssh/known_hosts" -R "yourdomain.com" ssh -o "StrictHostKeyChecking=no" -i "keys/key.pem" ubuntu@domain.com