Farben in der ssh-Verbindung
Ich habe ein farbenfrohes Bash-Terminal (z. B. zeigen ls und vim Farben an, wenn dies konfiguriert ist).
Wie kann ich diese Farben haben, wenn ich über ssh eine Verbindung zu einem Remote-Server herstelle?
2 answers
Lesen Sie die dircolors.sh Unterabschnitt aus dem Buch" Beyond Linux From Scratch":
Dieses Skript verwendet die Dateien
~/.dircolors
und/etc/dircolors
zur Steuerung die Farben der Dateinamen in einer Verzeichnisliste. Sie kontrollieren kolorierte Ausgabe von Dingen wie ls --color. Die Erklärung, wie man initialisieren Sie diese Dateien befindet sich am Ende dieses Abschnitts.cat > /etc/profile.d/dircolors.sh << "EOF" # Setup for /bin/ls and /bin/grep to support color, the alias is in /etc/bashrc. if [ -f "/etc/dircolors" ] ; then eval $(dircolors -b /etc/dircolors) if [ -f "$HOME/.dircolors" ] ; then eval $(dircolors -b $HOME/.dircolors) fi fi alias ls='ls --color=auto' alias grep='grep --color=auto' EOF
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2014-05-30 04:41:17
Mit einer Kombination von https://unix.stackexchange.com/questions/9883/how-can-i-run-a-script-immediately-after-connecting-via-ssh und niks Antwort können Sie tun:
ssh host.example.com -t '. /etc/profile; . ~/.profile; /bin/bash'
Dadurch werden Ihre Profilskripte beim Anmelden ausgeführt und dann eine Bash-Shell geöffnet. In Ihren Profilskripten werden die Farben definiert.
Oder fügen Sie Ihrer ~/.ssh/config
- Datei Folgendes hinzu:
Host *
LocalCommand . /etc/profile; . ~/.profile; /bin/bash
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2017-04-13 12:37:10