Skip to content

debaraj-barua/.bashCustomizations

Repository files navigation

bashCustomizations

Custom bashrc files and aliases.

Table Of Content

Getting Started and Installation

  • Clone the repository.

    cd ~ && git clone https://github.com/debaraj-barua/.bashCustomizations.git
  • Add the lines below to your .bashrc file. If you do not need any functionality, comment or remove that particular line.

    # ---------------------------------------------------------------------------------------
    # bashCustomizations
    
    if [  -d "$HOME"/.bashCustomizations/ ]; then
      # npm functionalities
      . "$HOME"/.bashCustomizations/package_specific_functionalities/bashrc_npm.bash
    
      # git functionalities
      . "$HOME"/.bashCustomizations/package_specific_functionalities/bashrc_git.bash
    
      # conda with ros functionalities
      . "$HOME"/.bashCustomizations/package_specific_functionalities/conda_with_ros.bash
    
      # generic aliases
      . "$HOME"/.bashCustomizations/aliases/generic_aliases.bash
    
      # docker aliases
      . "$HOME"/.bashCustomizations/aliases/docker_aliases.bash
    
      # shorten prompt alias
      . "$HOME"/.bashCustomizations/aliases/shorterPrompt.bash
    fi
    # ---------------------------------------------------------------------------------------
    

[Note] Using Conda with ROS Functionality

This has been taken from StefanFabian's gist

  1. Remove the line that adds the anaconda bin folder to your PATH in the ~/.bashrc file (if you've let anaconda add itself to the PATH during installation)
  2. Change _ROS_CONDA_PATH in conda_with_ros file @line 23 to the path of your Anaconda bin folder (if you didn't install it to ~/anaconda3)
  3. Add the scripts mentioned above before any ROS setup bash files are sourced.

[Note] Random

In addition to useful bash scripts, the random directory has a list of known issues, workarounds and scripts not related to bash.

How To Use

Aliases Defined

                                                        Command                                                                 Alias             
Get rid of command not found:
cd.. cd ..
Quicker change directory:
cd .. ..
cd ../.. ...
cd ../../.. ....
cd ../../../.. .....
Resume wget by default:
wget -c wget
Restart network-manager:
sudo service network-manager restart net-restart
Quicker apt commands:
sudo apt update a-update
sudo apt upgrade a-upgrade
sudo apt install a-install
What does your gut say:
gut echo ACCORDING TO MY GUT: && echo && git
Using Anaconda with ROS:
activate anaconda environment release-the-snake
deactivate anaconda environment cage-the-snake
Docker Aliases:
Clean all docker containers clean-docker
Run docker container interactively dockerRunInteractive
Shorten Prompt:
shorten prompt <user>:<pwd basename> short-prompt
long prompt <user>@host:<pwd> long-prompt
Node Aliases:
Clean npm project clean-node

Package Specific Functionalities

Git

  • Update prompt when in a git repository.
  • Add branch details to prompt.
  • Prompts updated according to git status
    • '*' for un-staged changes
    • '+' for staged changes
    • '$' if something is stashed
    • '%' if there are any un-tracked files

Node Package Manager (npm)

  • Add functionality to enable auto complete features for npm cli.
  • Sets npm install path to home

Using Anaconda with ROS

  • As described before, this enables usage of anaconda for ROS users without running into conflicts.
  • Enable and disable conda environments via the aliases mentioned in the table above.
  • Updates the prompt to add conda identifier.