Skip to content

A repository designed for developing & tracking configuration files i.e. "dotfiles" for "bash"

License

Notifications You must be signed in to change notification settings

ameyng/config-bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Bash Configuration

Features

Quality Assurance

General Improvements

  • The interactive shell configuration file ~/.bashrc will also source the global cofiguration at /etc/bashrc.

  • The login shell configuration file ~/.bash_profile will also source the interactive shell configuration file ~/.bashrc.

  • If installed, automatic PATH management & initialization for -

  • Automatic PATH management for user compiled binaries & scripts located at ~/bin & ~/.local/bin.

  • Enabled changing directories when entering just a path i.e. executing $ /path/to/some/directory is equivalent to $ cd /path/to/some/directory.

  • Dynamic resizing of content within the window when the terminal emulator is resized.

History Improvements

  • Unlimited history.

  • Immediately save commands to history upon execution. This ensures that when running multiple Bash sessions (eg: using tmux, etc.), all commands from all sessions are written to the history.

  • Write history to a custom file ~/.my_bash_history for better retention.

  • Improve readability by combining multi-line commands into a single command when writing to history.

  • Entries in history will be timestamped in this format - 894 [Wed-20-Dec-2023-04-12-21-AM-+0530] ==> ls -Alh.

Requirements

The following requirements must be met in order to use this configuration.

Supported Operating Systems

The supported operating systems and the location of the respective configurations are shown below.

OS Configuration Path(s) Remarks
GNU/Linux ~/.bashrc.d, ~/.bashrc, ~/.bash_profile None
MacOS ~/.bashrc.d, ~/.bashrc, ~/.bash_profile None
BSDs ~/.bashrc.d, ~/.bashrc, ~/.bash_profile Untested

Required Programs/Packages

The following packages are required in order to use this configuration.

Dependency Type Version
GNU Bash Mandatory 4.x & Above
Git Mandatory Any
GNU Stow Optional
(Recommended)
Any

Other Requirements

The following additional requirements must be met in otder to use this configuration.

  • None.

Installation (GNU/Linux, MacOS & BSD Operating Systems)

  1. Create a new backup directory.

     $ mkdir "${HOME}"/.bash_backup
    
  2. Backup existing configuration files (see supported operating systems) to the backup directory.

     $ mv "${HOME}/.bash_profile" "${HOME}"/.bash_backup/.bash_profile-"$(date +%a-%d-%b-%Y-%I-%M-%S-%p-%z)".backup
    
     $ mv "${HOME}/.bashrc" "${HOME}"/.bash_backup/.bashrc-"$(date +%a-%d-%b-%Y-%I-%M-%S-%p-%z)".backup
    
     $ mv "${HOME}/.bashrc.d" "${HOME}"/.bash_backup/.bashrc.d-"$(date +%a-%d-%b-%Y-%I-%M-%S-%p-%z)".backup
    
  3. Clone this repository into your home directory.

     $ cd "${HOME}"
    
     $ git clone https://github.com/ameyng/config-bash
    
  4. Navigate to the cloned repository.

     $ cd config-bash
    
  5. Installation can be done using GNU Stow or ln.

    • Using GNU Stow

      $ stow bash -t "${HOME}"
      
    • Using ln

      $ cd bash
      
      $ ln -sf "$(pwd)"/.bashrc "${HOME}"/.bashrc
      
      $ ln -sf "$(pwd)"/.bash_profile "${HOME}"/.bash_profile
      
      $ ln -sf "$(pwd)"/.bashrc.d "${HOME}"/.bashrc.d
      
  6. Verify the operation by executing $ ls -Alh ~/. You will see entries for .bashrc, .bash_profile & .bashrc.d with arrows pointing to the actual files i.e. to the files within this cloned repository.

  7. Close and reopen your terminal emulator program or open a new session of Bash.

Update (GNU/Linux, MacOS & BSD Operating Systems)

  1. Backup existing configuration files (see supported operating systems) to the backup directory.

     $ mv "${HOME}/.bash_profile" "${HOME}"/.bash_backup/.bash_profile-"$(date +%a-%d-%b-%Y-%I-%M-%S-%p-%z)".backup
    
     $ mv "${HOME}/.bashrc" "${HOME}"/.bash_backup/.bashrc-"$(date +%a-%d-%b-%Y-%I-%M-%S-%p-%z)".backup
    
     $ mv "${HOME}/.bashrc.d" "${HOME}"/.bash_backup/.bashrc.d-"$(date +%a-%d-%b-%Y-%I-%M-%S-%p-%z)".backup
    
  2. Update the cloned repository.

     $ cd "${HOME}"
    
     $ cd config-bash
    
     $ git pull --all
    
  3. The configuration can be updated using GNU Stow or ln.

    • Using GNU Stow

      $ stow bash -t "${HOME}"
      
    • Using ln

      $ cd bash
      
      $ ln -sf "$(pwd)"/.bashrc "${HOME}"/.bashrc
      
      $ ln -sf "$(pwd)"/.bash_profile "${HOME}"/.bash_profile
      
      $ ln -sf "$(pwd)"/.bashrc.d "${HOME}"/.bashrc.d
      
  4. Verify the operation by executing $ ls -Alh ~/. You will see entries for .bashrc, .bash_profile & .bashrc.d with arrows pointing to the actual files i.e. to the files within this cloned repository.

  5. Close and reopen your terminal emulator program or open a new session of Bash.

About

A repository designed for developing & tracking configuration files i.e. "dotfiles" for "bash"

Topics

Resources

License

Stars

Watchers

Forks

Languages