This is a bundle of scripts that I usually install in every linux machine I need to work. It makes a few personal tweaks in environment configuration, described below. Useful also when using third servers (as website hostings), where I use to have control only over my home folder.
cd ~
git clone https://github.com/paulera/files
cp ~/.bashrc ~/.bashrc.old
echo "if [ -f ~/files/bash.d/run_bash ]; then . ~/files/bash.d/run_bash; fi" >> ~/.bashrc
cd /opt
sudo git clone https://github.com/paulera/files
# This command adds the run_bash call in each EXISTING user's .bashrc file. Change "USER" for the username
cp /home/USER/.bashrc /home/user/.bashrc.old # backup
echo "if [ -f /opt/files/bash.d/run_bash ]; then . /opt/files/bash.d/run_bash; fi" >> /home/USER/.bashrc
# This command adds the run_bash call to root's .bashrc file
sudo cp /root/.bashrc /root/.bashrc.old # backup
echo "if [ -f /opt/files/bash.d/run_bash ]; then . /opt/files/bash.d/run_bash; fi" >> /root/.bashrc
# This command makes the run_bash call available for NEW users
sudo cp /etc/skel/.bashrc /etc/skel/.bashrc.old # backup
echo "if [ -f /opt/files/bash.d/run_bash ]; then . /opt/files/bash.d/run_bash; fi" >> /etc/skel/.bashrc
Note that these commands will:
- create a folder files
- make a backup of your bashrc file with .old extension
- append to your bashrc file a command that runs files/bash.d/run_bash
The $FILESROOT/soft_installers folder, there are 2 kind of files:
- installer_base.sh: Every installer use this file, calling it with dot (so its contents will be 'injected' on the installer) and then calling the installer_bootstrap function. After that, the installer can use the $APPFOLDER variable to do the installation. See examples.
- other installers: the others files inside the soft_installers folder are intented to install those application inside $FILESROOT/soft. The reason for that is to shrink the bundle size, make it fexible and also easy to upgrade.
If a user create these directories inside home, they will have the described behavior:
- ~/bash.d: all .sh files inside this directory will be executed everytime you open a terminal or do an ssh.
- ~/bin: folder to store custom scripts, referenced in PATH environment variable. The scriptme command use this folder.
- ~/soft: just a folder intented to centralize standalone software. It's recommended to have their executables linked at bin folder
Note that the $FILESROOT folder also have these subfolders, and the mentioned behaviors will be applied to both.
- Create a $FILESROOT environment var, pointing to the files location
- Apply more specific colors to dirs using the file $FILESROOT/dircolors
- Change the PS1 format
- see $FILESROOT/bash.d/02_alias.sh for more
- Turns bash autocompletion case INsensitive
- extract <file>: identify the file type by extension and try to extract
- ff "Text to find": search for the text inside all files (using grep). -R to do it recursively.
All shell shortcuts are defined in files/bash.d/04_shell_sortcuts.sh
- files: go to '$FILESROOT' folder
- down: go to ~/downloads
- desk: go to ~/desktop
- img: go to ~/images
- doc: go to ~/documents
- mp3: go to ~/mp3
- soft: go to the soft folder
- bashd: go to bash.d folder
- bin: go to bin folder
A smart shortcut first looks for the folder inside home folder. If the user have not created such directory, you will be redirected to the directories inside $FILESROOT location. To force smart shortcuts to take you to the respective $FILESROOT subdirectory, use 2 as parameter: bin 2, for example
- dirsize: list the size of everything, in the current dir
- doloop : Execute the command, repeatedly, with 1 second pause, clearing screen. Some bugs when using piped commands.
- externalip: return the IP address seen by the web
- localip: return the local network IP address
- now: current time in HH:MM:SS (24h format)
- psaux : do the ps aux, grepping the parameter - ex: psaux java
- remove_cr: Fix all lines in a file (or all files in current folder) to make them end with just LF, removing all CR characters.
- scriptme: one of my favourites. Create a script inside ~/bin and edits it in vim. It will start with the $FILESROOT/script_template contents, and will have *chmod +x if you leave vim saving it.
- today: current date as YYYY-MM-DD
- trash: send files to ~/.trash
- unmd5: Uses Insomnia247.nl Hashdb API to lookup a MD5 hash
- unsha1: Uses Insomnia247.nl Hashdb API to lookup a SHA1 hash
- Document set_defaults folder
- Document the soft installers