• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

prompt

Linux prompt display current directory only

February 11, 2022

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.

Filed Under: Linux Tagged With: current, directory, display, only, prompt

Remove Sudo Password

July 28, 2020

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.

Filed Under: Linux Tagged With: nopasswd, password, prompt, remove, sudo, vim

GitBash .bashrc

April 1, 2020

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

Filed Under: Cloud Tagged With: .bashrc, alias, gcp, gitbash, prompt

Disable Host Key Checking

February 9, 2020

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

  1. First remove old keys in the know_hosts file.
  2. Use “StrictHostKeyChecking” to suppress prompt.

Filed Under: Linux Tagged With: key-gen, prompt, ssh, strickhostkeychecking, supress

Linux Prompt

January 20, 2020

Here’s my favorite Linux prompt.

PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

Add to end of your .bashrc to make it permanent.

Filed Under: Linux Tagged With: colors, directory, hostname, linux, prompt, username

Styling The Bash Prompt

February 26, 2019

Great article how to style your Bash prompt. Make sure you are using Bash shell, because you could be using another shell. Use this to display your current shell. Just type “bash” to start using Bash shell.

echo $0
bash

echo $0 bash

I use the prompt style below. See the result underneath PS1. You may have to exit and re-enter your Terminal to see results.

PS1="\u@\h:\w: "
ulysses@localhost:/var/www:

PS1="\u@\h:\w: " ulysses@localhost:/var/www:

Filed Under: Linux Tagged With: bash, prompt, style

  • Home
  • About
  • Archives

Copyright © 2023