If you are more of a minimalist, perhaps terminals are your thing. To allow you to use your terminal to its full potential, let's learn a bit about...
For further actions, you may consider blocking this person and/or reporting abuse
Very nice! I'm not much of a shell-scripter and have always found it quite annoying to write them because I do it so rarely. I wrote one to bootstrap a new machine and that was fun (sarcasm). I do, however, love old Unix utilities like
awkandsedand would love to use them more for scripting and they're more portable and have less drift than writing Python or Ruby scripts.The functions are nice! I never quite found a good way to move up multiple directories and do it quite often, but I do it far less now as I rely more on
fzfglobbing. I think functions have far more utility than aliases as I only keep a handful around and heavily rely on my history -- shameless plug: my post about efficiency in the terminal/shellDo you have a link to your dotfiles or a repo with the functions that you use? Would love to check 'em out!
Hahaha, indeed, using the shell can sometimes be annoying. Moving up directories continuously is an example :P
I took a look at your post, and it's a great read!
reverse-i-searchis something I discovered quite late, and wished to have known about it sooner haha.Sure, I have my dotFiles hosted on GitHub. Though I'd suggest that you look at the
.zshrcinstead of.bashrc, since I haven't updated the latter in quite a long time.Thanks for reading!
Yeap! It's such a rare occurrence for me nowadays, because I literally just keep all the projects that I operate in open with tmux with their sessions auto-saved. They're restored on restarts. Tmux was something that took me a super long time to adopt (start of this year).
Yeah, I feel like
reverse-i-searchis not mentioned enough. It's spectacular withfzfintegration: github.com/junegunn/fzf.Neat neat! I like that function you've got for git branch, current working directory, and more. You've even got some perl in there. LOL! Wow! Out of curiosity, how did you go about learning all that you know about shell-scripting?
Your
.zshrcis so much cleaner LOL. You've even got functions to generate what appears to be checksums. You're probably the first person that I've seen with Dart-lang repos. I always like to ask C++ programmers about Rust -- have you tried it? Thoughts?Ahh, I've never used
tmux, but heard a lot of praise! I've been usingi3wmfor quite a while, and so I just open multiple terminal windows and pretend it'stmuxhaha. Anyway, I would surely give it a try, as the session-restoring sounds great (and time-saving)!Looking at
fzf, do you also usevim/emacs? I've never gotten around to using them, as I think that it'd take a lot of time to migrate from VSCode to a total keyboard experience, and so I keep postponing trying to learn the shortcuts :PHaha thanks, I use perl majorly for applying regex into bash strings (like extracting the directory name, CPU Temp, etc.)
I learned all that majorly from other awesome people's articles online, and sometimes through books (e.g. O'Reilly's Learning the bash Shell).
Ahh yes, the checksums function is quite useful. It generates the checksum, checks it against the one you provided as an argument, and returns if the two match. So, for md5 checking, I can simply do
So yes, I use it a lot :P
I majorly use Dart for mobile development i.e. Flutter. And Rust has been on my list for quite a while now, but never really got around to learning it. From what I've heard, people just call it a better C++ (if that's possible :P). I think I might start soon. Are you planning on learning it, too?
Yeah, I guess tmux is certainly more for a terminal-based workflow. I can't live without it. Switching windows is all keyboard shortcuts. I figure that i3wm is, too? I'm on macOS, and spent the last two hours looking at Yabai, a super popular tiling window manager for macOS
Yeap! You nailed it. I'm a total Vim-nut, but it's partially because I don't do any sort of dev in ecosystems that have amazing IDEs, like Java, iOS, etc. I try to keep a mouse-less workflow which comes in handy when having only a laptop (before the pandemic began). With regard to fzf, just navigating a filesystem is so much nicer. I use the globbing a lot!
My reverse-i-search becomes this w/ fzf (instead of the standard one-liner):
Yeah, your checksum functions are friggen neat! I've saved them :)
Haha -- so I've never really done too much systems programming and reading C++ is pretty straight-forward to me (at least in relation to Leetcode problems). Well, the problem with C++ is the footguns with memory. Right? I think it was only last year or the year before that Google reported two zero-days in Chrome. A large organization with as many resources as they have, has made a valiant effort, but it is still a problem. And it seems like the bulk of CVEs are memory-related. I currently do a little bit of Go which is useful but I really don't like its lack of elegance, though simple, and maintainable. I like modern language facilities and constructs and tooling, vibrant community, but without the memory footguns of C++, which Rust seems to provide (which is also being used on my team at my current company). I plan on learning it, because I'd like to have a performant systems language in my toolbox
Yep,
i3wmis also all-keyboard workflow. Honestly, I didn't even know how much time I spent alt+tabbing and moving between windows using my mouse until I started usingi3wm. I guess I'd have a similar experience once I switch from VSCode to vim :PI've heard about Yabai. Probably somewhere in unixporn (SFW), people have some amazing rices there.
Ahh yess, not using a mouse certainly helps with a laptop. Out of curiosity, which laptop do you use? I particularly love MacBook's touchpads (sometimes preferable over a mouse for me).
Wow, your
reverse-i-searchlooks beautiful. Comparing to the one-liner I get hahaha, I'd perhaps try outfzfsoon.I literally just Googled "zero-days" right now :P
Yes, the main problems lie in memory management and garbage collection of C++ (which I believe Rust improves upon?)
The lack of generics in Go really annoyed me, although (finally) they're coming in the next version, so it might be a really interesting time to improve our GoLang skills.
Again, out of curiosity, how long have you been working with C++?
Your
cdfunction could be greatly simplified:cdwith no arguments already goes to the home folder."$@"passes all arguments passed to the function exactly as they were passed. If there were none passed, it passes nothing.Ahh, this looks great. It was a simple solution, really (should've been obvious to me). Perhaps, I spent a little too time thinking :P
Made the changes. Thanks!
Nice post!
A few small improvements ;)
Thanks for the suggestions!
Yes, I believe putting the aliases and functions in a separate file would immensely clean up the rc files, so I'd be careful to do that from now.
As for the gcc, this never occurred to me as I never really used gcc apart from compiling cpp files with g++. Perhaps, I should add a little note in my post telling others to make sure that the aliases/functions do not try to override any other command :)
Ahh, I'll definitely read up about it; thanks for pointing this out :D
Using
gccfor a function name is not a wise idea. Especially when you cope with C language. ;)Thanks for the insight!
I realised this quite late 😅
I'll perhaps add a note in my post telling users to make sure not to name functions/aliases such that they override other commands :)
Nice writeup 🔥
Although a small suggestion
If you meant
git addall the changes, than you should update it togit add -Agit add .will only stage changes in current directory, might get confusing if you run this in sub-directories.Ahh yes, quite rightly pointed out. I'll update it in the post as well.
Thanks for reading!
Don't use
git add ., usegit add --allinsteadTry
basename.I often use ctrl+r for history fuzzy search. alt+f to go forward a word, alt+b to go backward a word, etc. I recommend looking into readline's default bindings.
I'd surely do so. Thanks :)
Git commit multiple files:
git commit -am "Commit message"