For all Windows Terminal lovers, this repository contains a custom .bashrc
script tailored for Windows Terminal users. Which runs when the terminal gets initiated It includes helpful functions, aliases, and configurations to streamline development workflows, especially for Docker, AWS, and general command-line usage.
Easily retrieve the current AWS account ID using the aws sts get-caller-identity
command.
- Alias:
awsuser
Checks if Docker is running; if not, it attempts to start Docker Desktop. Provides real-time feedback until Docker is ready.
- Aliases:
sdocker
,start_docker
,startDocker
,startdocker
Quickly navigate to the D://projects
directory with cdd
.
run
orrun.sh
: Run yourrun.sh
script.reload
: Reload the.bashrc
file.ll
: List directory contents in detailed format.c
,cls
: Clear the terminal...
,...
: Navigate up one or two directory levels.
-
Clone the Repository
git clone https://github.com/<your-username>/windows-terminal-bash-config.git cd windows-terminal-bash-config
-
Copy the
.bashrc
Scriptcp .bashrc ~/
-
Reload
.bashrc
Open your terminal and reload the configuration:source ~/.bashrc
Below is the content of the .bashrc
file for your reference:
# Get current AWS account
aws_current_account() {
aws sts get-caller-identity --query 'Account' --output text
}
# Function to say docker is running
check_docker() {
if docker info > /dev/null 2>&1; then
echo "Docker is ALIVE baby :)"
else
echo "Sorry Docker is DEAD :("
fi
}
# Function to check if Docker is running
check_and_start_docker() {
if ! docker info > /dev/null 2>&1; then
echo "Docker is not running. Starting Docker Desktop..."
# Start Docker Desktop (default location for 64-bit systems)
"/c/Program Files/Docker/Docker/Docker Desktop.exe" &
# Wait until Docker is ready
while ! docker info > /dev/null 2>&1; do
echo "Waiting for Docker to start..."
sleep 5
done
echo "Docker is now running!"
else
echo "Docker is already running."
fi
}
# Docker aliases
alias hidocker='check_docker'
alias hellodocker='check_docker'
alias isdocker='check_docker'
alias yodocker='check_docker'
alias sdocker='check_and_start_docker'
alias dockerStart='check_and_start_docker'
alias docker_start='check_and_start_docker'
alias dockerstart='check_and_start_docker'
alias start_docker='check_and_start_docker'
alias startDocker='check_and_start_docker'
alias startdocker='check_and_start_docker'
# Stop Docker aliases
alias stopdocker='wsl --shutdown'
alias stopDocker='wsl --shutdown'
alias stop_docker='wsl --shutdown'
# Navigation aliases
alias cdd='cd D://projects'
# Script runner aliases
alias run='./run.sh'
alias run.sh='./run.sh'
# Reload .bashrc
alias reload='source ~/.bashrc'
# Utility aliases
alias ll='ls -lah'
alias c='clear'
alias cls='clear'
alias ..='cd ..'
alias ...='cd ../..'
# AWS alias
alias awsuser='aws_current_account'
# Startup hacker drawing
hacker_ascii_art() {
echo -e "\e[32m
_ _ _ _ _
| | | | | | | | (_)
| |__| | __ _| |_ ___| |__ _ _ __ __ _
| __ |/ _\` | __/ _ \\ '_ \\| | '_ \\ / _\` |
| | | | (_| | || __/ | | | | | | | (_| |
|_| |_|\\__,_|\\__\\___|_| |_|_|_| |_|\\__, |
__/ |
|___/
Welcome to your terminal, Dr. Swaraj Sir!
\e[0m"
}
# Bye command with ASCII art
# Bye command with ASCII art
bye_ascii_art() {
echo -e "\e[36m
██████╗ ██╗ ██╗███████╗
██╔══██╗██║ ██║██╔════╝
██████╔╝██║ ██║███████╗
██╔═══╝ ██║ ██║╚════██║
██║ ╚██████╔╝███████║
╚═╝ ╚═════╝ ╚══════╝
Goodbye, hacker!
\e[0m"
sleep 2 # Wait for 2 seconds
exit
}
# Call hacker ASCII art on terminal startup
hacker_ascii_art # Corrected function name
# Alias for bye command
alias bye='bye_ascii_art'
. "$HOME/.local/bin/env"
awsuser
# Output: 123456789012
sdocker
# Output: Docker is not running. Starting Docker Desktop...
# Waiting for Docker to start...
# Docker is now running!
cdd
# Navigates to D://projects
ll
# Lists all files in detailed format
reload
# Reloads the .bashrc file
Contributions are welcome! If you have suggestions for improving the script or adding new features:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to customize further or suggest enhancements!