LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-20-2023, 06:50 AM   #121
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
Lightbulb An interesting hack to maintain your preferred settings across multiple remote systems


Quote:
Originally Posted by allend View Post
heh. Maybe not.
Personally, I just accept the default and do not futz. Maintaining personal preferences across multiple systems is too much of a chore.

The best tip I've come across for maintaining personal preferences across multiple systems is below.

https://news.ycombinator.com/item?id=32468605


hoechst 1 hour ago | next [–]


Not really a script, but a `.ssh/config` to automatically deploy parts of my local cli environment to every server i connect to (if username and ip/hostname matches my rules). On first connect to a server, this sync all the dotfiles i want to a remote host and on subsequent connects, it updates the dotfiles. Idk if this is "special", but I haven't seen anyone else do this really and it beats for example ansible playbooks by being dead simple.




Code:
Match Host 192.168.123.*,another-example.org,*.example.com 
User myusername,myotherusername
       ForwardAgent yes       
       PermitLocalCommand yes       
       LocalCommand rsync -L --exclude .netrwhist \
--exclude .git \
--exclude .config/iterm2/AppSupport/ \
--exclude .vim/bundle/youcompleteme/ \
-vRrlptze "ssh -o PermitLocalCommand=no" %d/./.screenrc %d/./.gitignore %d/./.bash_profile %d/./.ssh/git_ed25519.pub %d/./.ssh/authorized_keys %d/./.vimrc %d/./.zshrc %d/./.config/iterm2/ %d/./.vim/ %d/./bin/ %d/./.bash/ %r@%n:/home/%r
What this does, is to copy across the specified files and directories containing your personal preferences to the remote host(s) matching the given IP address(es), hostnames and user(s) on first login and updates them on subsequent logins.

It just really runs an rsync command as specified on successful login.
 
Old 12-20-2023, 08:35 AM   #122
jmccue
Member
 
Registered: Nov 2008
Location: US
Distribution: slackware
Posts: 703
Blog Entries: 1

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
Here is my simple prompt:

Code:
set prompt="$host % "
 
Old 12-20-2023, 10:42 AM   #123
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
I spent a little time trying to make this more understandable (to me)

Code:
# set command prompt
# re:https://linux.101hacks.com/ps1-examples/prompt-color-using-tput/

RED=`tput setaf 1`
GREEN=$(tput setaf 2)
REVERSE=$(tput rev)
OFF=$(tput sgr0)

PS1=$REVERSE$GREEN"\@:"$OFF    # time in AM/PM format
if [[ ${EUID} == 0 ]] ; then   # if we are "root"
    PS1+=$RED                  # set USER to display in RED
else
    PS1+=$GREEN                # set USER to display in GREEN
fi
PS1+=" \u@"$REVERSE"\h:\W"$OFF  # display USER@HOSTNAME plus CWD
PS1+=" \!: \$ "              # display current history number + prompt 

export PS1                     # export the prompt string
I used the bash syntax += to build the PS1 variable in sections so I could understand what each section is trying to do and comment it so I could understand what I did later.
 
Old 12-20-2023, 10:56 AM   #124
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,246

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
Quote:
Originally Posted by allend View Post
heh. Maybe not.
Personally, I just accept the default and do not futz. Maintaining personal preferences across multiple systems is too much of a chore.
You need a dotfile manager. I use GNU Stow. Other projects are listed here:

https://dotfiles.github.io/utilities/

Last edited by dugan; 12-20-2023 at 10:57 AM.
 
Old 12-27-2023, 11:24 AM   #125
rclark
Member
 
Registered: Jul 2008
Location: Montana USA
Distribution: KUbuntu, Fedora (KDE), PI OS
Posts: 493

Rep: Reputation: 182Reputation: 182
Never thought about it. Always used the default prompt with no need to change. Host and directory info is important to me. The Host in the prompt tells me what machine I am ssh'd into. Otherwise it would be very confusing with several terminals open looking at different machines (say a bunch of RPIs, server, desktops, laptops) with some having split views...

Last edited by rclark; 12-27-2023 at 02:31 PM.
 
Old 01-02-2024, 02:30 PM   #126
niceflipper8827
Member
 
Registered: Sep 2023
Location: Washington State,USA
Distribution: ChromeOS,SlackWare,Android and Lubuntu
Posts: 68

Rep: Reputation: 2
My favorite Linux prompt is the good old # or hash mark coupled with bash.

Code:
[neofetch
        #####           porter@localhost.localdomain 
       #######          ---------------------------- 
       ##O#O##          OS: AlmaLinux 8.9 (Midnight Oncilla) x86_64 
       #######          Host: HP Z420 Workstation 
     ###########        Kernel: 5.4.265-1.el8.elrepo.x86_64 
    #############       Uptime: 1 hour, 54 mins 
   ###############      Packages: 1727 (rpm) 
   ################     Shell: bash 4.4.20 
  #################     Resolution: 1920x1080 
#####################   DE: GNOME 3.32.2 
#####################   WM: Mutter 
  #################     WM Theme: Adwaita 
                        Theme: Adwaita [GTK2/3] 
                        Icons: Adwaita [GTK2/3] 
                        Terminal: gnome-terminal 
                        CPU: Intel Xeon E5-1603 0 (4) @ 2.800GHz 
                        GPU: AMD ATI Radeon HD 5000/6000/7350/8350 Series 
                        Memory: 5417MiB / 15924MiB
Yeah I know what you guys and gals are thinking: why do you have an Xeon-based Workstation as a Daily driver? To that query, I'd answer that I take full advantage of the "overbuilt" machine as a general-purpose daily and multipurpose virtualization platform.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Poll: (Without the poll) - How is Linux used in your workplace? SlowCoder General 13 09-11-2007 11:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration