TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Fulfilling a reader's request for my “dot files”

206 pointsby mdwaltersabout 2 years ago

25 comments

akira2501about 2 years ago
You can customize LS_COLORS if you want, but I&#x27;ve never been mad at the defaults. Also, I prefer c-style escapes, which allows you to copy and paste the filename and use it in other commands:<p><pre><code> alias ls=&#x27;ls --color=auto -F -b -T 0 -A&#x27; -F classify entries with (*&#x2F;=&gt;@|) -b use c-style escapes instead of quoting -T 0 do not use tabs for alignment -A show all dotfiles except . and .. </code></pre> Plus, I find colors to be insanely useful when my old eyes try to read &#x27;ip&#x27; output, so I really do prefer:<p><pre><code> alias ip=&#x27;ip --color=auto&#x27;</code></pre>
评论 #35839271 未加载
评论 #35839054 未加载
评论 #35839472 未加载
评论 #35840215 未加载
评论 #35839287 未加载
conaclosabout 2 years ago
My main aliases are: a more human-friendly ls and an alias of rm which attempts to detect mistakes:<p><pre><code> alias l=&#x27;command ls -Av1h --color=always --time-style=long-iso --group-directories-first&#x27; # -A: show all, including dotfiles, except . and .. # -v: natural sort of number # -1 (one): list (use -l for long version) # -h: human-readable sizes alias rm=&#x27;command rm -Iv&#x27; # -I: prompt once before removing more than three files or recursively # -v: verbose </code></pre> I redefine also $HISTFILE to ensure that every shell get its own temporary history:<p><pre><code> HISTFILE=&quot;${XDG_RUNTIME_DIR:-&#x2F;tmp}&#x2F;shell-history-$$&quot;</code></pre>
twpabout 2 years ago
<a href="https:&#x2F;&#x2F;chezmoi.io" rel="nofollow">https:&#x2F;&#x2F;chezmoi.io</a> is a dotfile manager that is runs on multiple OSes (including Windows) while handling differences from machine to machine, allows you to store your secrets in your password manager (so you don&#x27;t have to store secrets in your dotfile repo), and it even supports the NO_COLOR environment variable. Check it out! Disclaimer: I&#x27;m the author.<p>There&#x27;s a comprehensive list of the most popular dotfile managers at <a href="https:&#x2F;&#x2F;dotfiles.github.io&#x2F;utilities&#x2F;" rel="nofollow">https:&#x2F;&#x2F;dotfiles.github.io&#x2F;utilities&#x2F;</a>.
评论 #35841845 未加载
评论 #35840640 未加载
评论 #35840860 未加载
评论 #35841539 未加载
janvdbergabout 2 years ago
One tip for your .bashrc I only recently found out and can&#x27;t do without anymore is one I picked up here (log all shell commands directly to a file): <a href="https:&#x2F;&#x2F;www.jefftk.com&#x2F;p&#x2F;you-should-be-logging-shell-history" rel="nofollow">https:&#x2F;&#x2F;www.jefftk.com&#x2F;p&#x2F;you-should-be-logging-shell-history</a>
评论 #35838822 未加载
评论 #35839149 未加载
评论 #35838806 未加载
评论 #35839581 未加载
评论 #35838763 未加载
dhosekabout 2 years ago
The mention of .plan and .project brings back memories. You used to be able to do things like finger dhosek@ymir.claremont.edu and see if I was logged on and what I had to share with the world (which was a long series of quotes that ran several screens). I remember learning that the AMS had shorter hours on Fridays thanks to Barbara Beeton’s .plan file.
评论 #35839333 未加载
tomxorabout 2 years ago
&gt; Then I have a .xsessionrc which needs to exist because I now log in through xdm, and the window manager (fluxbox) ends up inheriting <i>that</i> environment. Yep, it doesn&#x27;t get a .bashrc type thing applied to it. (Not gonna lie - this took a while to figure out.<p>I&#x27;ve grown fond of just logging in via the tty and invoking startx... it&#x27;s always there, even when your graphics drivers fail. I tried messing with xdms a long time ago when transitioning to i3wm, but it was just extra configuration, noise and inconsistency to sort out, without really gain anything useful for what is a single person machine. Simple is good.
评论 #35839703 未加载
userbinatorabout 2 years ago
<i>The stock PS1 bugged me a bit, so I mangled it down to this</i><p>That&#x27;s not too far from this one which I use and have seen quite a few others use too --- really hate a lot of the newer defaults that hide the full path for some reason, and managed to convince a coworker who accidentally edited the file of the same name in the same directory with a different path to use it too:<p><pre><code> &#x27;\u@\h:\w$ &#x27; </code></pre> Also I should mention that in this era of constant telemetry^Wspyware and tracking, everything you say can and will be used to identify or correlate you, and that does include using non-default configuration. Of course, how much this matters depends on the context in which you say it.
评论 #35839548 未加载
评论 #35838890 未加载
yjftsjthsd-habout 2 years ago
&gt; Quick, which of .bashrc, .bash_profile, .profile et al get run for any given type of login you do to a box?<p>I appear to have just given up and symlinked them together. Anyone have a better idea?<p>Edit: Actually, my profile apparently has a conditional to detect what shell it&#x27;s loaded by (which I did remember), and for at least bash a conditional to detect interactive mode (which I did not). So I&#x27;m still dealing with this, just not at the file level.
评论 #35839441 未加载
评论 #35839045 未加载
评论 #35840754 未加载
评论 #35839066 未加载
mock-possumabout 2 years ago
Oh this person is living in a very different world than me.
评论 #35842968 未加载
评论 #35839210 未加载
Topgamer7about 2 years ago
Removing all syntax highlighting. You monster! How do you quickly determine logical chunks of things! Grep, coding, super useful to have colour!
评论 #35841111 未加载
评论 #35843851 未加载
评论 #35843540 未加载
Shorelabout 2 years ago
No colours? Any non-coloured terminal feels dead to me.<p>Half of the things I do in my dot files are related to adding colours.<p>Including some long colour parameter string to be used with midnight commander.
评论 #35839638 未加载
评论 #35843792 未加载
bloopernovaabout 2 years ago
I wrote a gist about a year ago that discusses installing various tools into MacOS -- powerlevel10k prompt, fzf, ripgrep, difftastic, some git aliases, asdf and more: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;aclarknexient&#x2F;0ffcb98aa262c585c49d4b3f3ae24019" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;aclarknexient&#x2F;0ffcb98aa262c585c49d4b...</a><p>Wow, it has 40 stars! I&#x27;m kind of shocked, I think it was way under 20 last time I looked. :) Feeling pretty good about that, if I&#x27;ve helped just that many people, then I feel like writing that was more than worth it!
2b3a51about 2 years ago
My slightly odd preference is...<p><pre><code> bash-5.2$ cat .nanorc set zero </code></pre> Together with<p><pre><code> UXTerm.vt100.translations: #override \n\ Ctrl Shift &lt;Key&gt;N: scroll-back(1, halfpage) \n\ Ctrl Shift &lt;Key&gt;T: scroll-forw(1, halfpage) \n\ Ctrl Shift &lt;Key&gt;C: copy-selection(CLIPBOARD) \n\ Ctrl Shift &lt;Key&gt;V: insert-selection(CLIPBOARD) \n\ Ctrl Shift &lt;Key&gt;H: set-altscreen(toggle) </code></pre> in .Xresources. See<p><a href="https:&#x2F;&#x2F;aduros.com&#x2F;blog&#x2F;xterm-its-better-than-you-thought&#x2F;" rel="nofollow">https:&#x2F;&#x2F;aduros.com&#x2F;blog&#x2F;xterm-its-better-than-you-thought&#x2F;</a>
Cockbrandabout 2 years ago
I learned a lot from Kali Linux&#x27;s zshrc [0]. But then I&#x27;m certainly no expert in customizing my shell environment, as I usually mostly stick with the distro&#x27;s defaults. Still, now mine is a bit nicer. It also includes the `ip --color=auto` thing, which is mentioned in other comments and which I hadn&#x27;t known about either.<p>[0] <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;Anon-Exploiter&#x2F;4e12193df0099183d18720c6471d571a" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;Anon-Exploiter&#x2F;4e12193df0099183d1872...</a>
g0xA52A2Aabout 2 years ago
I share the same annoyance with quoting but avoid it differently by setting<p><pre><code> export QUOTING_STYLE=literal </code></pre> This means I don&#x27;t have to be clever about thinking if I need to pass -N to ls depending which OS I&#x27;m on.
trallnagabout 2 years ago
Anyone else here managing his &quot;dot files&quot; with an Ansible playbook? In my environments files like .bashrc only contain a few statements that source other scripts where I inject &#x2F; template my actual configuration.
评论 #35839323 未加载
评论 #35841166 未加载
tschumacherabout 2 years ago
Put your PATH into .profile when you want it to apply to your whole session.<p><a href="https:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;183870&#x2F;difference-between-bashrc-and-bash-profile&#x2F;183980#183980" rel="nofollow">https:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;183870&#x2F;difference-between-ba...</a><p><a href="https:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;789448&#x2F;choosing-between-bashrc-profile-bash-profile-etc&#x2F;789705#789705" rel="nofollow">https:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;789448&#x2F;choosing-between-bash...</a>
renewiltordabout 2 years ago
Haha wow. I have a full color prompt with oh my zsh and starship. Overall, I like it though I don&#x27;t really need a lot of it.<p>The error code highlight and duration of last command are nice.
juujianabout 2 years ago
Got my hopes up, but no, not a graphviz post.
评论 #35845174 未加载
fisianabout 2 years ago
I&#x27;m on so many different machines (mostly some embedded stuff&#x2F;RasPis that need linux) that I ignore all these bad defaults.<p>The only thing I find unbearable is vimdiff colors, that have the SAME or very similar foreground and background so it&#x27;s impossible to read. (I don&#x27;t remember, but believe it&#x27;s just on some distros)
wheybagsabout 2 years ago
Why does she hate colours so much?
评论 #35839942 未加载
评论 #35839748 未加载
评论 #35839771 未加载
rmmabout 2 years ago
How do people manage their custom bash profile across machines.<p>Currently I just add a small if statement that checks if my custom file with all my little aliases I have put together over the years is there it sources it. Is there a better way?
评论 #35841154 未加载
评论 #35851818 未加载
评论 #35839892 未加载
评论 #35839829 未加载
stuaxoabout 2 years ago
The nocolor thing I enjoyed, I&#x27;m the opposite I want an envvar to make my terminal as colourful as a Jodorowski film.
liendolucasabout 2 years ago
I group different kind of settings under particular files. My .bashrc has `source ~&#x2F;.rc.d&#x2F;pyenvrc`, `source ~&#x2F;.rc.d&#x2F;gitrc` and so on which can help to organize yourself if you have too many custom settings.<p>I also have a very tiny set of useful functions that I might occasionally use from some scripts. For example:<p><pre><code> # Changes the current working directory to the running script. cd_running_script_dir() { cd &quot;$(dirname &quot;$(readlink -f &quot;$0&quot;)&quot;)&quot; } # Display an error message and abort the running script. # # Arguments: # $1: A string with error to be displayed before aborting. abort() { ERROR=$1 &gt;&amp;2 echo &quot;${ERROR}&quot; kill $$ } # Return a program&#x27;s full path if exists or display an error # message and abort script execution. # # Arguments: # $1: A string with the program&#x27;s name to be looked up. get_program() { PROGRAM_NAME=$1 PROGRAM_PATH=$(which &quot;${PROGRAM_NAME}&quot;) if [ -z &quot;${PROGRAM_PATH}&quot; ]; then abort &quot;Error - ${PROGRAM_NAME} is not installed.&quot; fi echo &quot;${PROGRAM_PATH}&quot; unset PROGRAM_PATH unset PROGRAM_NAME } </code></pre> Given the sort of subtle nature of sh that for example misplacing a whitespace or a character can render a whole script wrong, from time to time I add these snippets so I can entirely forget how to do some regular things by sourcing `~&#x2F;.scripts&#x2F;lib.sh`. It&#x27;s also a great way to extend your sh knowledge and learn about customizing your environment.<p>Yes these are silly functions, but their main purpose is to make sh snippets more readable.<p>Because I don&#x27;t like to always display the same wallpaper over and over again my .xinitrc contains:<p><pre><code> &quot;${HOME}&#x2F;.scripts&#x2F;set-random-background&quot; &amp; </code></pre> which is:<p><pre><code> #!&#x2F;usr&#x2F;bin&#x2F;env sh # Randomly sets a wallpaper from a directory containing images. # # Usage: # .&#x2F;set-random-background # Adjust global settings accordingly. WALLPAPERS_PATH=&quot;${HOME}&#x2F;.scripts&#x2F;assets&#x2F;wallpapers&quot; set_random_background() { FEH=$(get_program &quot;feh&quot;) if [ -d &quot;${WALLPAPERS_PATH}&quot; ]; then WALLPAPER=$(ls &quot;${WALLPAPERS_PATH}&quot;&#x2F;* | sort --random-sort | head -n1) if [ -n &quot;${WALLPAPER}&quot; ]; then ${FEH} --no-fehbg --bg-center --bg-scale &quot;${WALLPAPER}&quot; fi fi } main() { if [ -n &quot;${BASH_LIB}&quot; ]; then . &quot;${BASH_LIB}&quot; set_random_background fi } main</code></pre>
评论 #35840095 未加载
spudlyoabout 2 years ago
export PS1=&#x27;\h:\w\$ &#x27;<p>This is my prompt as well, it was the default Slackware prompt, which I’ve also used since the mid 90s.