When the number of machines I constantly logged on ssh reached 3x, I realized that it was not enough for me to
quickly authorize , and it was time to drag bash aliases, configs to the editor and other elements of the environment to remote systems. On the other hand, I needed a way not to be confused in numerous tabs with terminals. As a result, I came to a bunch of scp, screen and color differentiation of hosts :)
Screenshots of the results:
Home system:

One of the remote machines:

Command to sync profile:
$ profsync
Details under the cut.
The first thing I did was to divide the profile into general and local (see screenshots), and in the general profile, save the local:
$ cat .bashrc
# Check for an interactive session
[ -z "$PS1" ] && return
source ~/.bashrc_local
alias ls='ls --color=auto'
PS1='[\u@\[\e[0;'$PS1_hostcolor'm\]\h\[\e[0m\] \w]\$ '
complete -cf sudo
source ~/.bash_functions
And in the local I wrote down the necessary variables:
')
$ cat .bashrc_local
PS1_hostcolor=32
export SCREEN_hostcolor=g
After these simple manipulations, the PS1 turned green, indicating my host system.
And after these:
$ cat .screenrc
eval "hardstatus string '%{= .w}%-w%{= .$SCREEN_hostcolor}%50>%n %t%{= .w}%+w%<'"
hardstatus alwayslastline
turned green and screen. It remains the case for small things - copy to all other machines and change there. * _ Local files to the ones you need. I like to read
commandlinefu , and my .bash_functions is updated from time to time, so the scripter was kicking me, kicking scp for me :)
$ cat `which profsync`
#!/bin/bash
source ~/.config/profsyncrc
cd $basepath
for host in ${hosts_scp[@]} ; do
echo "Syncronizing ${host}..."
for target in ${targets[@]} ; do
scp -r $target $host:$target
done;
done;
The script is controlled by a simple config:
$ cat ~/.config/profsyncrc
hosts_scp=(campus amignode) #
basepath="$HOME" # ( , )
targets=('.bashrc' '.bash_functions' '.screenrc' '.nanorc') #
scp understands directories too, so you can sync though .config :)
Once tuned, this bundle has come in handy for me more than once, and I hope it will be useful for you too.
Have a nice day!