Skip to content

0PEIN0/bash-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bash Helpers

Bash helper scripts for system package installation and python/nodejs developers. MIT license, hell yeah!

Intended to help software engineers working on python/django and nodejs environment. The scripts that were used below are only on Ubuntu 16.04 LTS, Ubuntu 18.04 LTS, Ubuntu Core 16.04 LTS. There will be no OS version specific package changes on installation script until Ubuntu 20.04 LTS release.

Legends:

  1. bash-helpers is the name of the repository and the folder name where this repository is cloned.
  2. helper-scripts is that place where you place your personal.sh bash files as well as your other scripts that are meant to customize your local machine environment.

New OS installations

For usage instruction with new OS installations, follow these instructions.


Usage Instruction

Open terminal.

IN NON SUDO USER MODE

  1. Create Gitrepos folder in the user directory. Path will look like this: /home/$SYSTEM_USER_NAME/Gitrepos/. Here $SYSTEM_USER_NAME denotes the user name of the operating system(Ubuntu in this case) user, which is not the default root user. Create the folder using this command: mkdir -p ~/Gitrepos. If you are not sure about OS username, its the name that appears when login. To be sure, you can open up Terminal and see the username there. It'll be in username@machine-name format.
  2. Run sudo su command(enter into the sudo user mode). Enter sudo user password when prompted.

NOW SWITCHED TO SUDO USER MODE

  1. Run sudo apt-get update command.
  2. Run sudo apt-get install git command to install git package.
  3. Run exit command to exit from sudo mode user.

NOW SWITCHED TO NON SUDO USER MODE

  1. Clone Bash Helper's Repository in Gitrepos folder by running following commands:
cd /home/$SYSTEM_USER_NAME/Gitrepos/
git clone https://github.com/0PEIN0/bash-helpers.git

Here $SYSTEM_USER_NAME denotes the user name of the operating system(Ubuntu in this case) user, which is not the default root user.

  1. After cloning, create a new directory again inside of user directory. Path will look like this: /home/$SYSTEM_USER_NAME/helper-scripts/. Here $SYSTEM_USER_NAME denotes the user name of the operating system(Ubuntu in this case) user, which is not the default root user. Create this directory by running the following command:
mkdir -p ~/helper-scripts

After you have created this folder, create a new file there(inside the newly created folder) called personal.sh and copy the file contents from sample-personal.sh file from the current repository to /home/$SYSTEM_USER_NAME/helper-scripts/personal.sh file. Run the following command to do so:

cp -f ~/Gitrepos/bash-helpers/src/bash/sample-personal.sh ~/helper-scripts/personal.sh

Then just open up personal.sh file by running gedit ~/helper-scripts/personal.sh command and configure your info in personal.sh file like this:

SYSTEM_USER_FULL_NAME="John Doe"

SYSTEM_USER_EMAIL="john@example.com"

SYSTEM_USER_NAME="john"

DEFAULT_PERMISSION_VALUE=775

  1. Add the import of the /home/$SYSTEM_USER_NAME/helper-scripts/personal.sh file in ~/.bash_aliases file. Then source it.
cat <<EOF > ~/.bash_aliases
if [ -f /home/$USER/helper-scripts/personal.sh ]; then
    . /home/$USER/helper-scripts/personal.sh
fi;
EOF
source ~/.bash_aliases
  1. Run admin command(enter into the sudo user mode). Enter sudo user password when prompted.

NOW SWITCHED BACK TO SUDO USER MODE

  1. Open ~/.bash_aliases file and add the import of the /home/$SYSTEM_USER_NAME/helper-scripts/personal.sh file there. Then source it. Run gedit ~/.bash_aliases from command line to open up the file. Below is a sample example for import of personal bash file in ~/.bash_aliases file. Remember to replace the $SYSTEM_USER_NAME string here with actual operating system username.
if [ -f /home/$SYSTEM_USER_NAME/helper-scripts/personal.sh ]; then
    . /home/$SYSTEM_USER_NAME/helper-scripts/personal.sh
fi;
  1. Run source ~/.bashrc command.
  2. Assuming you have ZSH shell setup, run gedit ~/.zshrc (change the zsh theme to "agnoster", or any of your preferred theme, and add the reference to personal bash file as well located in bash-dump folder). Same operation as gedit ~/.bash_aliases step. Place the following script at the end of ~/.zshrc file. Remember to replace the $SYSTEM_USER_NAME string here with actual operating system username.
if [ -f /home/$SYSTEM_USER_NAME/helper-scripts/personal.sh ]; then
    . /home/$SYSTEM_USER_NAME/helper-scripts/personal.sh
fi;
  1. Optional Step Assuming you have ZSH shell setup, do this only if zsh shell does not appear in terminal after rebooting or opening a new terminal. And add a line with just only zsh string on a new line at the end of ~/.bash_aliases file. Then run source ~/.zshrc.
  2. Run exit command.
  3. Restart machine.
  4. Cheers! You're all set.
  5. To update this bash-helpers repository continually, run bash_helpers_fetch command time to time.

NOW SWITCHED BACK TO NON SUDO USER MODE, THAT IS YOUR PERSONAL SYSTEM USER (only for ZSH users)

  1. Assuming you have ZSH shell setup, run gedit ~/.zshrc (change the zsh theme to "agnoster", or any of your preferred theme, and add the reference to personal bash file as well located in bash-dump folder). Same operation as gedit ~/.bash_aliases step. Place the following script at the end of ~/.zshrc file. Remember to replace the $SYSTEM_USER_NAME string here with actual operating system username.
if [ -f /home/$SYSTEM_USER_NAME/helper-scripts/personal.sh ]; then
    . /home/$SYSTEM_USER_NAME/helper-scripts/personal.sh
fi;
  1. Optional Step Assuming you have ZSH shell setup, do this only if zsh shell does not appear in terminal after rebooting or opening a new terminal. And add a line with just only zsh string on a new line at the end of ~/.bash_aliases file. Then run source ~/.zshrc.
  2. Assuming you have ZSH shell setup, run source ~/.zshrc. If you see some weird bash error when sourcing, just ignore it. It should be fixed after restarting the machine.

Additional usage notes

  1. Estimated total installation time is 2-5 hours for fresh new OS installation, although it will vary based on machine and network connection performance.
  2. Use command uap to update systems daily for non sudo user(s). And uar command for sudo user(s), for example: root user. The uap command will ensure the daily pull for latest changes on repositories that resides in ~/Gitrepos folder, sync youtube music videos and replace files from sources to destinations. To use uap command, first create a new file in src/python/ directory of current repository. Then add a file called local_settings.py. Yes, exactly this file name. After creating the file copy contents from sample_local_settings.py file to local_settings.py file. Override property values in local_settings.py according to your necessity.
  3. For further OS customization, you can take a look into this file. This is a personalized OS environment file for myself, but you might get some idea as to what some of the customizations may look like.

Other alternative projects that inspired this repository

  1. Brilliant Bash by Ben Roytenberg.
  2. shell-scripts by Trevor D. Miller.
  3. Bash Startup Scripts by wd5gnr.
  4. aliasme by Jintin.
  5. dotfiles by Andrey Petrov.
  6. bash-common-helpers by Martin Burger.
  7. git-bash-helpers by Jonathan Neal.
  8. Bash helpers gist by M. Peter.
  9. bash-it by Bash-it.

About

Bash helper scripts for python/javascript developers.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •