The Changelog: Software Development, Open Source - Modern Unix tools (Interview)
Episode Date: July 31, 2021This week we're talking with Nick Janetakis about modern unix tools, and the various commands, tooling, and ways we use the commmand line. Do you Bash or Zsh? Do you use `cat` or `bat`? What about `ma...n` vs `tldr`? Today's show is a deep dive into unix tools you know and love, or should know and _maybe_ love.
Transcript
Discussion (0)
This week on The Changelog, we're talking to Nick Genatakis, our good friend, about modern Unix tools and the various commands, tooling, and ways we use the command line.
Do you bash or ZSH? Do you cat or bat? What about man versus TLDR?
Today's show is a deep dive into Unix tools you know and love, or should know and maybe love.
Big thanks to our partners Linode, Fastly, and LaunchDarkly.
We love Linode, they keep it fast and simple. Get a hundred thousand credit at
linode.com slash changelog.
Our bandwidth is provided by Fastly.
Learn more at fastly.com
and get your feature flags powered by
LaunchDarkly. Get a demo at launchdarkly.com
This episode is brought to you by
Influx Data, the makers of InfluxDB, a time series platform for building and operating time series applications.
In this segment, Marian Bija from NodeSource shares how InfluxDB plays a critical role in delivering the core value of the APM tool they have called Nsolid.
It's built specifically for Node.js apps to collect data from the application and stack in real time.
At NodeSource, we want to lean into a time series database and InfluxDB quickly
rose to the top of the list.
One of the unique value propositions of EnSolid is real-time data and there is a lot of APM
tools out there, but there is a variance in terms of how available the data is.
It's not really real-time, there is actually a staging period to the data,
and InfluxDB is magical
and allows us to deliver on our unique quality proposition
of real-time data with Ensoly.
To get started, head to influxdata.com slash changelog.
Again, that's influxdata.com slash changelog.
All right.
Well, we have Nick Jantakis here.
Nick, thanks for coming on The Change Log.
Yeah, no problem.
Happy to be on.
Happy to have you.
I feel like we've talked a lot, been around each other a lot.
I had you on backstage, but this is your first time on The Change Log.
You've been doing freelance development work, creating courses.
You have the excellent Running in Production podcast.
Tell the folks a little bit more about yourself, the kind of courses you do, and what you're into.
Yeah, so I am a freelance developer, also a course creator. So the Running in Production podcast is basically where I just talk to folks about how they're building and
running web apps in production in terms of like courses and blogs and videos, all that fun stuff.
Yeah, it's just basically everything I've learned along the way, just being, I guess,
a standard developer. I'm mostly focused on developing web apps and deploying them, command line stuff.
So you're here because you're like me,
you're kind of a command line junkie, right?
You do lots of command line stuff.
A little bit, yeah.
A little bit.
And you're also modest, more modest than I am,
which is a nice thing.
Today's show, we thought we would talk about modern Unix.
So there's this cool repo on GitHub.
It's called modern Unix.
It's maintained by a fellow named Ibrahim Ahmed,
who's an open source enthusiast and a freelancer in Toronto.
And what he's put together,
it's one of these kind of awesome list style repos
where it's really just a curation of a group of things
that he thinks are high quality.
And this is specifically a collection of modern
slash faster slash saner alternatives to common Unix commands.
And as I scrolled through this list, I saw a bunch of tools that we've kind of covered over the years on Changelog News.
But I hadn't seen everything all together in one place.
Like if you like Unix-y things and maybe the initial tools leave you wanting or you just like to have something new and shiny,
this was a really cool place to go.
So looking at this repo, I had a few thoughts.
First of all, what are the commands that developers actually use
on a regular basis? I have a sample size of one,
but I thought I'd get you on here to ask you that question as well, Nick.
What are the common commands? What job do these commands perform for us?
What are we trying to do with them?
How are they serving us?
And then are the age-old versions sufficient?
Or are they long in the tooth?
Do they have things that just don't keep up with what we do in modern times?
And then we have all these modern replacements,
and it's like, are the modern versions better?
How are they better?
Is it worth the installation?
And so on and so forth.
So that's the idea for today.
I thought we would take up these topics.
What do you think?
Yeah, I think that's a great idea because, yeah, I've looked at that repo before at a
glance and there's what, maybe 10, 15, 20 different tools there.
But in terms of like, what do I use in my day to day?
So, you know, besides the super basic ones like CD or LS or whatever.
Yeah, I'm using Grappaton.
I use Auxed, Cut.
Do you know Cut, like the Cut utility?
I've used it in like a pipeline before, but I can't remember what it does.
Can you tell us?
Yeah.
So like, let's just say for argument's sake, you have something like a CSV file that has comma-separated file,
and you just want to get the third column there.
So you can use cut there to be like,
okay, I want to delimit on a comma and get the third one.
But you can do it on other things than a comma,
basically any character of your choosing.
But it comes in handy just to parse out tabular data.
Yeah, so those are probably my go-tos in my day-to-day.
I mean, there's so many specific little things, right?
I guess it's depending on what you're developing.
But yeah, I would say grep and set are like my go-tos for a lot of things.
My go-to is ll.
Double L.
Double L, which is an alias, right?
Double L.
It's an alias, yeah.
And it's actually an alias via omyzsh.
Nice.
I don't use anything but. And that's an alias that oh my zsh nice uh i don't use anything but and that's an alias that comes
with that which basically is ls dash l for long list right and i just hate typing ls dash anything
really so i'm just like ll so much shorter this is so much easier i mean i guess you could auto LL on CD, but whatever.
That's my most common one.
Yeah, so I have tons of LS aliases.
Similar, I have LL as well.
Ooh, I rhymed.
I also have combinations like LLD,
which will long list the directory,
I think sorted by file size.
And then there's like LLS, which is like sorted by age like last
modified time i can't remember i do them like with my fingertips i can't think of them out loud but
i have probably like 8ll and then some sort of modifier just to save me from typing ls dash
l ht or whatever it is to uh to have to remember those incantations.
It's nice to just remember those.
Yeah, I think there's another one too,
like dash capital R.
So it does like a recursive LS
and you can see all the files
in different directories that you have.
Yeah, and I just made the mistake
of typing that in as you talked
on a band directory
with a bunch of stuff in it.
And it's still scrolling to this point.
So is that similar to tree?
Yeah.
I was going to say it's a little bit similar,
but it gives a little bit more information.
So like if you were to do your LL,
like imagine running LL,
but it like goes through every directory and gives you the output of that
recursively where tree is kind of cool.
Like that's a good one that you brought up.
Tree is kind of like what's in here to the deepest level or to a certain
level.
Tree will,
we'll explain, we'll actually lay out the hierarchy as well. Correct? Yeah. is kind of like what's in here to the deepest level or to a certain level tree will will explain
will actually lay out the hierarchy as well correct yeah yeah it's more about like yeah
exactly the hierarchy of all the different directories beneath it and tree is a page
page i believe like it's always and i mean let's see if that's true no it just spits it out i think
you can pipe it into less or something to add pagination,
but I don't think
Tree is actually a built-in.
I think Tree is something
that's like...
It's definitely not
on a Mac,
I'm sure.
Common, but...
I don't think it's built-in
on Unix, personally.
I could be wrong.
I use it,
I do install it
via Homebrew, thank you.
And I do use it
somewhat often,
often enough
to actually install it.
Yeah.
So, yeah, I'm the same way if i'm
running debbie and orbuntu you just have to install tree and you're good to go yeah so one
thing that's interesting we talk about modern unix tools and i think there's confusion sometimes
and maybe i'm just projecting about exactly what unix is versus linux There's like the all caps Unix.
You'll see like just capital U Unix.
You'll also see people using it as a non-proper noun like Unix-like and it's lowercase Unix.
Then there's Linux.
Adam just mentioned Mac OS is using tools
that are on Linux.
They're also on, you call them Unix.
And so I thought, what if we went ahead and gathered some of the information, just for
people who don't know some of the history, some of the inner workings and the relationship
between these terms and what they are, and provided a little bit of that context before
we dive further into the individual tools that we're going to cover.
Sound good?
Sounds good.
Sounds good.
Although it's funny, you mentioned like the lowercase unix versus capital U
versus like fully uppercase unix.
Yeah.
It reminds me of that like English grammar trick,
like the Buffalo, Buffalo, Buffalo, Buffalo thing.
Do you know that one?
I don't, please tell us.
No, what is that?
Like if you literally say the word Buffalo
seven times in a row with certain capitalizations,
like an end sentence being like
a grammatically correct English sentence
based on like what a Buffalo is and like Buffalo the town in New York. Like I don't know it well
enough to explain it, but it reminded me of that. Now that you say that, it does kind of ring a bell.
I think I've tried to figure it out and it doesn't make, it doesn't seem like it would make sense,
but when you see it in context with all the capitalizations incorrect, it actually is a
full sentence, right? That's crazy. But sorry to interrupt. Yeah. Let us know the differences
between Unix and Linux.
Yeah, so this is just going completely off the top of my head.
I mean, I didn't read it off Wikipedia, but if I was
going to write a Wikipedia, I might say a few of
these sentences. So, the original
Unix is AT&T
Unix, and that was started
in the late 60s, early 70s at Bell Labs.
Right. So that's like
the OG. It wasn't even open source, it was
proprietary. AT&T
licensed Unix to various parties
in the 70s, and
that led to the different Unix variants.
You see Berkeley's BSD,
Sun's Solaris,
IBM's AIX, and there's
more than just those.
Now, all caps Unix,
that's the trademark,
which AT&T owned until the 90s.
Then it sold to Novell, which then sold the UNIX business group to somebody else.
But then they kept the copyright, which eventually ended up at the Open Group, which is like a consortium of different entities.
No idea if they still hold it or what.
So like capital, all caps UNix, that's Unix the
trademark. Of course, there were legal disputes along the way, but those are not interesting.
Back in the 80s, the GNU project began, which was an effort to create a free software Unix-like
system. You probably have heard of GNU, stands for GNU's not Unix. It's not Unix, but it's Unix-like.
And it's famous for many things,
not just the invention of the recursive acronym,
which is pretty rad and has been copied over and over again.
What else does GNU do?
The GPL, the GNU General Public License,
GNU's compiler core.
What's GCC stand for?
GNU's compiler something.
They got GCC.
Of course, the core utils like LS, RM, et cetera, and more.
They have their own core util that they implemented.
So GNU had a lot of things going, but they didn't really have a working kernel.
There was GNU Herd, H-U-R-D, which was being worked on back in the early 90s,
but didn't totally work yet when Linux came around.
Of course, Linus Torvalds released Linux back in 1991, and that's a kernel.
So the Linux kernel is an operating system kernel.
It's not an entire operating system.
He released that as GPL, so it got integrated with a bunch of other GPL stuff.
And then there's also the BSD Unix effort, which was released
in 1992. That led
to NetBSD, FreeBSD,
later on OpenBSD,
and I think Dragonfly?
A few others.
I honestly don't know very much about BSDs.
I do know there's some people that are very
passionate about BSD, but I don't know very much
about BSD.
What about you, Nick?
Have you dove into the BSD side of things at all?
I have not.
It's funny, like, you know that story behind Richard Stallman,
where, and I'm not calling him out to, like,
make fun of his philosophies or whatever,
but, you know, Linux is called Linux,
but then he thinks it should be called GNU Linux because, really, it's like you're getting the Linux kernel,
but you're also getting these GNU programs
like LS and GRAP and SET and all
of them. So it kind of makes sense that
you're combining both of these together to give you
an endgame solution so that we, the end user,
actually have something to run in user land code.
Yeah, absolutely, because Linux by itself is not
an operating system, right? It's just the kernel.
So you have to combine Linux with other things
to create an operating system.
These are the Linux distributions,
which we know very well. Arch Linux, Ubuntu, Debian, Gentoo, Suze, Fedora, CentOS, Rocky Linux,
all these things. I just keep listing them and listing them. But you bring up a great point,
though, by the way, because there's such a difference between the GNU version of SED and the FreeBSD version of it.
And that's why you can't use certain SED flags on macOS versus maybe Debian or Ubuntu or whatever distro that you like to use that uses GNU SED.
Have you ever noticed that with a dash i flag?
You can't do in-place edits when you're trying to redirect out to a file in macOS?
I've been on macOS for so long that I don't know probably the intricacies.
I don't work too much in Linux anymore like
I did back in the early aughts.
I do notice some of the
I have to send different
flags. In my Bash RC, I'll
have slightly different aliases
depending on if the
OS is Darwin or not, if I'm on Mac or not.
I don't remember what they are. I think maybe
even LS might have a slightly different way of coloring
files or something like this. The DNS
flushing, you know, the DNS
cache is slightly different. So that
is interesting, and it's based on
the roots of the operating system,
right? The BSD side versus the Linux side.
Yeah, so Linux and BSD,
they have more in common than they have in difference.
I mean, they're very similar, but the differences
are what we focus on, of course, because those are the interesting bits.
That's what makes it unique.
That's why we should even have more than one in the first place.
But what they have in common is the Unix philosophy and the Unix architecture.
The Unix philosophy is something we talk about on the show all the time.
In fact, we just talked about it with Matt Reier with his tool Xbar and how it accidentally followed some of the Unix
philosophy and had some awesome results from that. So we talk about that a lot. The Unix philosophy
includes ideas like make each program do one thing well, write programs that work together,
and write programs that handle text streams, because that's universal interface. So everything
is text. If you can assume it's text, then you can write more simple programs
that work with more things.
Then there's a Unix architecture,
which has the unified file system.
It uses inter-process communication through pipes.
We've already talked a little bit about pipes
to serve as the primary means of communication.
It also includes a shell scripting
and command syntax called the Unix shell,
which brings us kind of full circle, right? So when we talk about unix tools or modern unix we are mostly referring to programs
that follow the unix philosophy run inside the unix architecture and are executed from a unix
shell this could be on bsd this could be on a linux distro or it could be on mac os all of which
are unix-like systems.
Just off the top of my head.
Yeah, right.
That was a good one.
Well, the important thing, I think, with maybe this discussion, too, when you say modern Unix tooling, right, or tools that you can install, is that you don't have to accept the sed that comes with. You can accept an alternate that may be community-driven, which I think is empowering to users, right? Like being able to install Tree despite it not being installed directly on the OS.
That's sort of par for the course, but new folks coming to the command line even
or being a daunting thing for them, understanding how they can choose the different tooling,
maybe even installing it via HoBro if they're on macOS or AppGate if they're on Linux or something like that, a different version of that.
I think that's cool. Being able to say, well, this version of
LS comes with Unix, the GNU version
or however, whatever the history is that you just described. But
if that doesn't work for you and there's a community-driven version of it that might have different
features or different things that are maybe, in this case, modern with the way modern things are going.
In fact, behind the scenes, we have a Unikernel's post coming out soon by Ian Iberg. developed by Bell Labs back in the 70s was built for computing in that day where if we considered what an operating system for
the data center might be like today in 2021, how will we design
that? And I think you might get different results with
maybe, LS may be a good example because it's just simply listing
directories, but maybe SED might be different or
with some of these
tools you're going to get different results based upon today's needs yeah and being able to install
them you know if you want to just boom install it you're done use it yeah i think there's an
interesting conversation around that because it's like do you know some folks where they install
vim and they're like well i want to be a purist and not install any plugins so that if I were to ever SSH into another machine, then my environment there is going to be the same as it is on my dev box.
Because, you know, Vim is probably going to be installed there.
You don't need to worry about different plugins.
And I think that's similar to this type of thing that we're talking about here, because when it comes to installing like a separate version of LS or something like that, like, I don't know, it's a weird one, right? It's like, you kind of want to optimize for what you're doing most of the time, like 95% of the time.
So like in the Vim case, that would be like install whatever plugins you need to make things
work. But I think one of the beautiful things about just the command line in general is,
you know, like things like SAD and grep and LS and whatever, it's like, once you know them once,
you kind of know them everywhere. So I'd be curious to know, like, you know,
I haven't used like the custom version of LS,
the one from modern Unix tools,
but I wonder if the flags are the same or are they different?
Because I think it would be harder to get me to use it
if it were to be different.
Yeah. How compatible are they with like,
while modern, how backwards compatible are they?
Do they just simply, are they additive or subtractive?
The same thing with me.
I don't actually use Vim, but I use VI a lot.
I will favor VI more than anything because it's just simple.
I'm just trying to get in, edit a file, get out.
I'm not trying to do programming.
I'm just more or less editing config files or messing with DNS stuff or whatever it might be.
Adding a cert or confirming a cert is there in the known hosts,
whatever. That's the things I'm trying to do. So I'm not actually like opening up Vim myself
personally. So I'm not like installing a special version of VI, for example.
I think that's a good example because I think what you'd find, Adam, is that at the base level
that you're using VI, using Vim, you will find is identical.
You wouldn't notice a difference
if you're just opening files.
Every time I get into Vim,
I get stuck.
That's why I favored VI.
Well, you get stuck
for those reasons.
Every time I'm trying to get out,
I can't get out.
Yeah.
I'm not sure how you're
getting out of VI, but...
You know,
I don't know either.
Maybe I found tricks.
Maybe it's just simply fear that keeps me away
and less logic.
It's more fear than logic.
Yeah, so I think that's a good example.
I think a lot of these tools,
we're going to talk through some of them.
Some are meant to be direct replacements.
So in the case of Exa,
we're going to get into this with LS.
It's basically like you could alias Exa to LS
and not know the difference
and just keep typing LS and it's supposed to be a drop- exa to ls and not know the difference and just keep typing
ls and it's supposed to be a drop-in replacement other ones are not really what you call they're
not really api compatible but command compatible i mean the flags for instance i guess the flags
are an api to a certain extent they're meant to be used instead of but not really to like
plop on top of or replace one-to-one an older version so we can talk through some of those
i know i'm kind of in the keep it vanilla er camp nick i'm not sure it sounds like you're kind of
in that one as well yeah but i think it's kind of like progressive enhancement on the web you know
so i have my personal cd built in wrapped with a cd function that i wrote which provides additional
functionality and mostly what it does i think maybe just the only thing it does is it just
automatically calls ls anytime i change to a directory because i just found what i did every
single time like what do you do right after you see the ls cd ls right so I just monkey patched my CD to just do the LS for me
right when I enter any new directory.
Just go ahead and display what's in there.
I find that to be additive though, right?
Kind of like a progressive enhancement
because then when I go to another system
that doesn't have that,
then it just doesn't do it.
It's like an operator overload,
but you're not making it do some sort of
destructive or random thing
that you wouldn't expect.
So I don't find it problematic
that way. I think with Vim
it is so complex where if you do trick it out
completely, you go to another system,
you don't know how to use the bog standard
Vim anymore because yours is so customized.
I think that's what you're speaking to. But some of these are so
simple that as long as you're just adding
functionality and not removing
or changing it, that in practice
I'm not sure if it would really be a problem.
Yeah, I think if things stay the same, but you get more new stuff, that's a good way
to go about it.
Like, I would be less opposed to not trying it out.
You know how it is with some of these command line tools, right?
Trying to remember some of those flags for all of them can be very, very difficult.
Like using the tar command or something to like unzip a GZ file, right?
It's like those flags are very
very very confusing the only way i remember that one there's like this stupid little honored
schwarzenegger meme where it has a picture of him and then there's like the flags where it's like
extract c file verbose me down where it's like xz f v or something like that right yeah yeah i think
tar is the poster child for impossible, inscrutable command line flags,
right? Like we've all kind of memorized ZXVF,
CSV,
Z,
and you're just like,
I don't know what any of these mean.
But we brought up about,
you know,
running an LS after CD is really,
really cool,
right?
It's like,
that's the really cool thing about using the shell.
It's like,
you can just make an alias to CD where I'm guessing it,
what it's just CD and,
and LS or whatever,
right?
Yeah.
I'm looking at it now. It basically does like does like there's like there's two if statements that are
nested it's the one condition is do i have any arguments or zero arguments right so if i call cd
with nothing it goes home right if i call cd with arguments it goes to where i say it's going to go
so it kind of if the first case it just calls the built-in and then calls ls-g if the second case then there's
another if statement so it's probably like 10 lines of code uh if i'm passing dot dot which
does to go up a directory then it will take a specific case for that otherwise it just passes
my arguments directly into the built-in and calls ls and so yeah you're basically just calling ls
after you do what you're gonna do with some of the slight little tweaks to make sure you don't futz up with any of the arguments that you're receiving.
Yeah, I've got similar aliases like for Vim.
So I happen to use Vim on the command line, but you can use Vim to diff two files side by side, which is kind of nice.
You know, you kind of get like a GitHub side by side view of that.
But as far as I know, Vim doesn't have a really great way to do diffing two different directories, like multiple files in a directory. So I wrote a little alias that
either runs Vim if you're passing
in two files as arguments, but if
you're passing in two directories, then it just runs a different
command, which is like a Vim plugin that
handles doing a directory diff.
But from my point of view, I just run one command
and it figures out the dirty work behind the scenes.
One more shout out to
OhMyZSH. I just do dot dot
to move around as well. so if I'm in a directory
I want to go back rather than going cd
space dot dot
I just type dot dot
It's like it's cool
It's so efficient
Do you know what that's doing behind the scenes?
It's just calling cd I suppose
I imagine it's probably just doing cd
I don't know
That's the other thing I remembered
my cd function does I'm starting to realize this thing's more powerful than i ever expected it will take cd
dot dot dot and go up two directories and dot dot dot and go up three so oh my zsh does that so
that's spectacular because who wants to go dot dot slash dot dot slash dot dot slash nick even nobody
even type in dot dot slash all this time or what do you do? So, okay. I have an interesting take on this one because I would love to be able to do the dot dot dot stuff.
But if you're recording video courses or doing YouTube videos, sometimes it's hard for other folks to follow along if they don't have those aliases set up.
And if I have to like segue into, by the way, I have this alias for every single one, then it becomes like not really sustainable.
So, yes, I do the dot dot slash dot dot slash dot dot slash.
Like a chump.
No, that's actually a really good reason.
And also a good reason to keep your Vim kind of standard,
especially if you're going to be pair programming
or if you're going to be instructing people,
is that if you have a completely customized Vim
and you're trying to teach programming,
all of a sudden you're teaching Vim customization, right?
Sort of, kind of.
I mean, in that regard, I optimize for me.
So I do have like, I don't know, 50 or something plugins and it's all set up. But I have all of that available
on my.files and GitHub. And I have everything installable where it'll work if you're using
macOS or any distro of Linux. So it's very easy for folks to just copy paste stuff if they want.
But yeah, when it comes to like teaching like a video course on programming, I try to like,
sure, I'll link to my.files and let people know like how to set up their environment. But I don't
want them to go on like a side quest where it's like seven hours to
get Vim configured when they can just use VS code or sublime text or, you know, whatever editor they
happen to be using already. So I did some more hunting while you're talking there, Nick. And
so every dot takes you back a directory. Nice. So as far back as you are, if you want to go back
five, you five dots enter. Kind of cool cool so what happens if you put in like 45 dots
does it like recursively go back around back in time it might go back in time i think it just goes
back as far as i can to the rut yeah yeah This episode is brought to you by our friends at LaunchDarkly,
feature management for the modern enterprise,
power testing in production at any scale.
Here's how it works.
LaunchDarkly enables development teams and operation teams
to deploy code at any time,
even if a feature isn't ready to be released to users.
Wrapping code with feature flags gives you the safety
to test new features and infrastructure
in your production environments
without impacting the wrong end users.
When you're ready to release more widely,
update the flag status,
and the changes are made instantaneously
by the real-time streaming architecture.
Eliminate risk, deliver value,
get started for free today at LaunchDarkly.com.
Again, LaunchDarkly.com.
So you've probably used cat a few times actually what is that one command that you can run to see your most used commands that you've run in your history so history is the history command there
is a command that will do that what was it adam we were just using it the other day
that's bugging my mind too how do you recall it though it's Adam? We were just using it the other day. That's bugging my mind, too. How do you recall it, though?
It's one of those things where... I think it's history.
No, it's not history. History is just a list.
I saw a bunch of numbers. They'll sort them by the times
you've used them and show them to you.
We should actually look that up
and we'll go back in. That way we'll have it.
Maybe one of those things where you're
just piping together a couple of commands, like maybe
history with sort, possibly. I'm not really
too sure, but it's one of those things where cat is up there, probably, as like top-ish type of
command, along with get.
Let's see.
Here it is.
History, pipe it into set, pipe it into sort, pipe it into unique-c, pipe it into sort-rn,
head-10.
So here's a good use of the Unix command line right here.
I will throw it in the chat.
We can all execute this.
And you can see what makes your top 10.
I don't have cat in here.
Do you have cat?
I do not.
I thought it would be for sure, but no.
I think it takes, if it just did the commands themselves,
I think you'd probably have better.
But for instance, if you pass, like mix test is one of mine, right?
So that's mix plus the specific command inside of the mix command
so in there I've got one, two, three of them are git
so that should just be one
so this particular one that I found on Stack Overflow
is not sufficient
I type exit a lot apparently
it's because I'd like to quit for the day
actually that's probably getting out of different TMUX shells.
So usually exit's like, I'm SSH'd into something,
and usually it's exit to get out,
and it's left on that machine, isn't it?
I mean, wouldn't exit be there?
It depends.
If you launch a screen or a TMUX session in a remote SSH,
you can set it up to detach to where it'll hang.
But by default, if you exit enough times,
it'll close the ssh session and the
shell will close as well so yeah mine are mostly git rspec mix ls cd and git x which is launching a
git gui what are yours nick i was just curious My bash history got cleared and I don't have a handy, so I really don't know,
but I'm going to roll with, um, you gotta make it make some guesses,
some like informed guesses. Yeah. So mine are actually pretty similar.
I've got a couple of custom aliases that I use pretty often,
but it's funny that exit did make it on the eight spot.
And it's so funny too,
because I have these mental reminders where you just need to hit control D to
exit as well. Like you can do, that's like the same way to exit. And it's so much faster, but I have these mental reminders where you just need to hit control D to exit as well.
Like you can do, that's like the same way to exit and it's so much faster, but yeah,
I always type exit as well.
I don't know why, but yeah, I've got like drafts is like a custom alias I created that
helps me create like a draft blog post, but I've got like 800 draft blog posts, like for
comparison, like there's a lot of them.
So yeah, I run that a lot.
How many of those are published?
Like 340 of them. That's, I run that a lot. How many of those are published? Like 340 of them.
That's pretty good.
You do publish quite often.
I know many of us have way more drafts than we have published because we like to start
a blog post, but finishing it is a lot more difficult.
Yeah.
So Vim is up here too in the top three, just because I'm running Vim dot Vim dot Vim dot
like all the time.
Right.
Adam, did you get the command ran well apparently it's a zsh thing
or something else because what the command returns is no matches found zsh no matches found
and then it passes the the regex part of it which is like the 09 through 09 part of it so i think
maybe something's not right with ZSH where it
can't take this command properly.
So I was googling when you asked that.
With no indication
of solutions.
So here we have an advertisement for using the standard
bash that's installed on most systems.
Although isn't ZSH default
on macOS? I think they switched it.
I think there's an escape hatch that you might
be able to run.
Now, if you run bash space dash C
and then put double quotes in
and paste that whole command in there,
then that'll run it through bash instead of ZShell.
Nice.
That's why I invited Nick,
because he has that kind of knowledge.
Say that again, Nick.
Can I try and do that right now?
Yeah.
So just run bash, like B-A-S-H, space,
dash C.
Live doing this in the podcast.
We'll see if it makes it to the actual production.
Space, and then put in double quotes,
and then pop the command in, in the double quotes.
Like, surround them in quotes.
Okay. Well, that says
invalid command.
For me. Maybe it's because there's some quotes
already in there, too too which are just a
single single quotes the double quotes it works did you do regular dash c or did you go dash dash
c because you said dash dash c okay yeah it seems like maybe it's a said thing because said is
actually said colon space one colon can't you just launch a bash prompt somehow can you just say like
bash that's not going to have
my history though is it
no
like zsh history
oh your bash history
that's a really good point too
because this would have
this would be the same
as running bash
and then now you're
in a bash prompt
but yeah your history
is going to be empty
yeah
yeah
I mean
what a bummer
I know what I use
I know what I use
I can tell you
he uses tree
I'm like npm-ing things
I'm brewing things
I'm ssh-ing things
I'm dot dot-ing things I'm ls-ing things but I'm brewing things. I'm SSHing things. I'm dot dotting things. I'm
LSing things, but I'm doing a VLL
because I'm Cool J.
That's pretty much it. Maybe a couple of Node things.
I'm checking versions often, you know. Node-V.
Which one do I got?
What's going on with this?
What's going on here? A lot of SSHing.
And as a matter of fact, I lied.
It's not VI. I'm nanoing.
Oh, that makes more sense.
Sorry. So I'm nanoing. So if you listen to that when i said vi before just replace with nano and it will make so much more sense because i was like how is he getting out of vi but he
can't get out of him it's the same exact thing nano is a bit simpler yeah like control c a few
exits in my list here all right a lot of lot of gets, you know, get something, you know.
Several alias type things.
So Adam, I'm going to put you in the spot here.
How do you exit Nano?
How do I exit Nano?
I think it's Control X or Control C, I believe.
Yep, you got it.
It's X.
Yeah.
I think Nano actually displays it in the bottom of the UI while you have it open.
Yeah.
Which is a very nice feature.
You know, just show me what I'm doing here.
Don't make it be like, because the screen doesn't change in Vim or VI.
It's just very hard to grok what changed.
Yeah.
Anyways, you know, and then quit is pretty easy.
Control Q, it's pretty easy.
Well, we're trying to talk about cat.
It turns out none of us use cat.
Well, I do use cat.
The main times I will use cat is when i'm
looking at say a markdown file or in the cases when i'm doing say nsh keygen yeah i might cat
that and pipe that into the clipboard kind of thing pb copy kind of thing those are times i'm
using cat primarily i'm not using it often yeah but you know if we're comparing cat to bat why
wouldn't they do vat or something closer
to the c because or zat you know because like just make my finger not move over what two keys
the c key is two keys away from the b key so because bat has a much better brand because
it says it's cat with wings oh that's good okay that's why that's why they picked it
okay that that's making more sense now so cat for for the uninitiated is short for concatenate,
and it just prints files to standard out
and will also concatenate multiple files,
which one of the cool things that I have done
that you may not know
is it can actually concatenate multiple MP3 files
into a longer MP3 file.
So let's imagine you have a couple of text files
and you want to create
a combination of them right one after the other this is very common for certificates where you'll
take multiple certificates and a private key or whatever and you'll concatenate them all together
into one new file so you like file one so you do cat file one file two and then you do the the
caret or greater than caret to direct that instead
of to standard out to direct it to this file which is the next argument to file two or file three
you can do that with mp3s and we'll actually concatenate them as if they're text files
so if you want to just like splat a bunch together you can say cat mp3 one well one dot mp3 two dot
mp3 and direct it to three.mp3, and it will work.
You just listen to them, and it just starts the second one
after the first one in the new file, which is pretty cool.
That's a new way to get your changelog master feed.
Yeah, there you go. Just concatenate all of it.
Cat them all together. Go, go, go.
There you go.
24 hours of changelog master feed.
That's very cool. I never knew that.
You can also use the star operator with cat as well. If you have to match on a file pattern, you can just do something
like, well, I've done this before in the past where I have my notes set up to where I have like
2021 dash and then zero seven dot TXT, like July 2021. But you can replace that zero seven with a
star and then redirect with like greater than sign and like, you know, export out to like 2021.
And now suddenly all my monthly notes got redirected out to a single file for like the
year 2021.
Very cool.
Yeah.
Is there anything missing in cat?
Like, do you ever use it?
And you're like, I wish it did this.
I mean, this is probably a good segue on what that actually does.
But yeah, syntax highlighting is would be kind of nice instead of having to open Vim
up to get that.
There you go.
Yeah.
So that's basically what BAT adds.
So it's just like Cat, only it defaults syntax highlights
as well as Git integration.
So if you call BAT in a Git repo,
it will show you the index of what's been plused and minused
since the last commit.
So it'll also do that for you.
And it shows line numbers and stuff.
So it's really kind of a cat with focus on
software development.
Whereas, you know, if you're catting MP3 files together,
you don't really want to see
the syntax highlighting on the MP3s.
That's a great example
of one where I could see myself aliasing
cat to bat then. Like, I don't do it right now
because it's one of those things where I kind of
want the syntax highlighting, but it's like, is it good enough
to install another tool? Maybe.
Right. That's really the question that comes down to is like,
how much work is this to adopt?
Do I have to then take it with me everywhere?
Again, it would be a progressive enhancement because it doesn't syntax highlight
on some other machine. You're just like, okay, don't care.
Because it's just a nice to have anyways.
Now here's where it gets interesting with these two.
Because bat is not a one-for-one replacement for cat.
And here's why.
It defaults to piping into less.
So bat will be paged by default, whereas cat won't.
So if you cat a JS file, a JavaScript file,
it'll just spit out the entire thing, right?
And what you'll see if it scrolls your terminal
is just the end.
Whereas with bat, it's going to syntax highlight it,
which that's the feature.
But then it's also going to send to less,
which is a pager.
And so it's going to let you navigate that file.
And so it kind of breaks API compatibility in that way.
Yeah, I'm curious.
Does it have a flag to disable the paging
and just have it go all the way?
It does have a flag to disable.
So there's like a dash dash paging equals never.
You can set that in your, there's a configuration file.
There's also a shorthand, which I don't know what it is.
You can also alias cat to bat dash dash paging equals never.
So you can make it as part of your alias so that it doesn't do that.
But then it's also kind of smart insofar as if you're using it to concatenate files
versus display them,
it will turn it off automatically.
Like it obviously won't go to a pager.
So if you're catting files together
the way you're talking about with multiple text files,
it'll work just like cat.
But when it comes time to print them to standard out
is when the pager is in there.
So you can turn it off.
But I think if it was my choice, I'd probably
say, well, you can turn it on. You know, if you want
to just page, go ahead and turn this on.
But, you know, the author of Bat must have thought
that that was a big enough feature for
them that it'd be worth breaking that compatibility.
You just need a BatRC file.
Yeah, and then you've got to ship that
BatRC file around or something.
You know? Well, at least in your main machine you've got
it covered, you know? Yeah. I guess in your main machine, you got it covered, you know?
Yeah.
If you're hopping around, I guess if you're hopping around, that's the question too.
I guess most people don't hop around to machines often.
Maybe they do.
I guess if you're a developer, maybe the reason you're using these modern Unix tools, you want the developer-y things of them.
So maybe you are.
I guess I jump around to a lot of machines, but I'm not doing sophisticated things.
I guess it kind of depends right
like most things
if you're taking these things with you
because I'm not
I'm mostly SSHing into Raspberry Pis
and the occasional Mac Mini
you know it's about it for me
I'm not really doing a lot of Linux server management myself personally
yeah
yeah I mean in that regard
I try to set up my servers
so that I don't have to SSH into them
you know?
And if I do, it's like, yeah, very one-off things like, oh, go through this engine X-Log and grep a couple things out.
Yeah. So, I mean, if you're tricking your personal, you know, for lack of better terms, PC out, then trick away.
And don't take the tools with you or don't feel like you have to.
But, you know, Jared, a long time ago, you said, I think we were, this must have been like four years ago,
we were both upgrading operating systems at the same time,
having to be getting like new machines, same timeframe.
And I think you did just before me,
and you were like, you know what?
I'm not installing any extra stuff on this machine.
I'm going to keep it pristine.
I'm using Terminal.
And ever since then, I've been using Terminal.
Whereas before I was an iTerm user,
I guess just because, not because it was better,
but like Term terminal's good enough
and ever since then I've been using just simply terminal
so I can kind of appreciate
the minimalist approach to these things
and that's kind of the
why cat versus bat, why bat over
cat, would you install it, should you install it
yeah, the other thing you can do is
install it but not alias it
so then you can just kind of
use them both side by side
and maybe when you want the syntax highlighting,
you just have to remember to type bat.
Now I'm the kind of person
I will never remember I have it installed
and I'll just type cat
and I just will see it the old school way.
But if you are actually actively trying out
the new one for a while
and you want to run it side by side,
none of these are like install them
and it replaces your cat with bat.
That's not how it works, right?
So that's nice is you can kind of limp in that way.
I am a fan of only installing what you use.
And I do appreciate a purge every once in a while.
I'm excited to upgrade my laptop because it's getting long in the tooth again.
And I'm going to do it again.
I'm going to start fresh.
I'm just going to like, you know, it's like survivor for software.
You know, who's going to cut the muscle?
Who's not going to get voted off the island?
So what's your top one that you're probably going to get rid of?
Well, that's the thing is I'm going to get rid of everything
and I only install what I need.
Well, I guess I should say,
who's coming back on season two?
Who's coming back?
Good question.
Tmux is coming back.
Git, obviously.
What else is coming?
I do have my.files.
I'll move them over.
So it's not like I'm getting rid of all aliases.
It's mostly like desktop apps and command line tools
that you have to install with Homebrew and whatnot.
So yeah, all the typical things will be there.
I'm sure I'll need Postgres right away.
I'm sure I'm going to need Elixir right away.
Like everything to run changelog.com,
you know, software development.
Maybe I'll just leave VS Code off this time.
I'm getting ready to just go back to Vim
100% because
VS Code's just been slowing down on me
lately. Really?
Not me! And they kind of annoyed me
with the, what's it called?
That mode, restricted mode?
Not sure if you guys have gotten that yet.
Is that what they do, a pop-up where it's like,
hey, by the way, do you trust the files in this directory?
And there's like a yes, no button or something?
Yes, and it's new.
It's like in a newer version, so I update it.
And all of a sudden I have to trust all my own directories.
And the reasoning is it's for security,
but it has to do more with collaboration.
So you can securely view other people's files,
but not be afraid that they're going to execute something,
maybe in that shared mode or whatever. And these are things I just never use. And so for me,
it was like offensive. Like this is the same folder I've been working with my entire life.
And all of a sudden I have to tell you that I trust it. Like you trusted it yesterday.
Yeah. So I got kind of bugged. I didn't understand that really. I was like,
of course I trust it. And so I was like, yes. Yeah. So imagine that there's a new version of
LS where every time you run it,
it's like, by the way,
are you sure you want to view
the contents of this directory?
Exactly.
That kind of perturbed me.
And I was like,
that plus it's kind of been running slower,
like, you know,
things I'm waiting on it more.
I'm like, sorry, VS Code,
you're kind of pissing me off.
You know,
you might not be coming back next season.
We'll see.
We'll see.
We'll see.
Well, there is NeoVim 0.5
just came out recently i saw that release now
what's the skinny with neo vim why is everybody so excited about it's a performance thing or what
is it so i use regular standard vim but neo vim 0.5 it was a couple years in the making and i
think one of the biggest features as far as i know is the built-in lsp support so some of those nice
things that you get from VS Code,
like being able to do code complete
with really nice IntelliSense,
that functionality now
is something you get with NeoVim out of the box
without having to run an external LSP server,
as far as I know.
It's now built into the editor
as maybe a core plugin or something like that.
Hmm.
It may be time to dip back in and go full Vim
and give NeoVim a try and see if that cuts the muster.
Well, let's move on to some more of these modern Unix tools.
So we've got Cat and Bat.
There you go, listener.
Decide if you want to give Bat a shot.
It's definitely cool.
I mean, I think the syntax highlighting is nice,
especially if you do a lot of catting of source code files.
FZF, this is one, Nick, that you put into the document.
You want to tell us about that?
Yeah, so this would be one,
like if I were purging out all my tools,
it would come back for season two, season three,
all the way to season eight,
and then the show would end.
But yeah.
FZF would win.
Okay, so if you're not using FZF
and you are on the command line
and you want to rerun commands
that you've run in the past before,
like your history file, it becomes very tedious to find these commands. Like, you can be one of
those people who just hits the up arrow like 400 times in a row to try to find that command that
you ran like six days ago, or you can hit Ctrl-R, and this will work without any plugins. You can
do it right now, and that is going to allow you to reverse search your history. So you can just
start typing a command, like let's say you have a long git command or some, you know, whatever commands that you run, you can just start typing it first couple
of characters. It is going to find a match. And if it doesn't find a match, you can just hit control
R again to cycle through all these matches. So it's very, very handy for recalling commands that
you've run in the past. And FCF takes it to another level because now it brings up a nice
little menu that pops up where, and it starts to fuzzy find all of these, like basically every command in your history.
So instead of just like having to start the command off as you run it,
it's going to do a fuzzy match,
just like control P or I guess in VS code or whatever.
If you're going to like try to open a file quickly,
it's that,
but for your bash history,
where is he?
I get something like that for free with all my ZSH.
Do you?
Does it pop up?
Can you see it?
Like it's not as gooey like this,
but you know, if I know the first few characters, let's say I'm doing a Geekman.
I do GI or GIT even, and I just hit the up arrow.
I'm going to cycle through, and I don't know if it's based on any sort of order, so it's not quite as sophisticated.
And I do admit that FZF is more sophisticated, but it's kind of most of what I want. And if I'm typing mix a lot, for example, I just do MI and I up arrow until I find the
server one, the get depths one, the whatever's.
I don't remember those things in my brain.
Thankfully, it's kind of there for free with my ZSH.
Yeah.
Which is why I kind of like take that with me everywhere.
Right.
Yeah.
I don't use ZShell personally, but that sounds like it's doing some type of like an autocomplete
and it's showing you a preview of the command in like gray font, right?
Or a color.
And then as you type it starts filling it up.
No, it's just like just normal terminal.
Okay.
It's like you're just upping through them.
It's like upping through your history, but your history is scoped to those first couple of characters.
Based upon what you typed.
Yeah, kind of.
Yeah.
It's sort of delimiting based upon that.
So I'm installing FZF as you speak, Nick,
which means I missed the part where you talked about
how I use it for my history.
So if I just type FZF,
it's like searching the files in my current folder.
Right.
So how do I use it for my history then?
I would say, did you go to the FZF get repo on GitHub?
No, no, no.
I just brew and installed FZF.
I didn't have time for that.
I also didn't have time to read the docs.
I need you to explain to me right now.
Right now, around this podcast.
Go, Nick, go.
So I think the thing is,
when I followed their instructions on the documentation,
you may have to add something to your.rc file
or zshell file to have that enabled.
Gotcha.
Okay, so FCF is more than just reverse searching your history
because it can go through your files and directories too.
But if you just do that in your home directory, you probably have, you know, tens of thousands of files in there.
So I would imagine that list got pretty filled up quickly.
So it's kind of like an interactive replacement for grep.
Is that a good way to describe it?
It's a general purpose command line fuzzy finder.
So, I mean, grep is a command line finder.
Well, you might use grep to like grep through a file to filter out some content
of a file like if you're looking for specific log entries
or whatever this is more just like
show me commands I've run in the past without me having
to type in like those you know the start of a command
or whatever just like opening a file
with a couple of characters you know
like if you're opening up your mix.ex
s file or something like that you can
just type in like ix or something and hit enter
yeah that's a bad example because it's such a short file name in the root of the project anyways but you get the idea sure sure sure yeah.exs file or something like that, you can just type in like ix or something and hit enter.
That's a bad example because it's such a short file name in the root of the project anyways, but you get the idea.
Sure, sure, sure.
So yeah, now I'm looking at their deal
and it looks like you have to set up their fuzzy completion
key bindings through Homebrew.
So I will do that offline, but I am excited about this
because you know what?
Even just control R is not something I actively use
and not because I'm against it. It's because I don't remember it.
What I do is lame. I do have history alias to H.
So I can type H for history, right?
And I can just pipe that into grep for a part of the thing that I remember
and then hit enter and then there it was.
Which is not cool. Even Ctrl-R is cooler than that, right?
Yeah, also FCF works with Vim as well.
So if you want to open files very quickly in Vim,
fuzzy matching them, then it's the same interface in Vim.
And you can also use it in Vim for other stuff too,
like searching your get commit and even Vim snippets
because those are a little bit hard to remember.
Yeah, it's pretty cool.
It's like you can always remember a little bit of something,
not the full thing, so.
Right.
I think that's an interesting thing, too,
because on the command line, right,
there's so many commands to run, so many flags to run,
so many flags and commands to remember.
Yeah.
Yeah.
I like using the command line.
I still feel like it's a very good interface to find things,
but sometimes, like, you know, I don't know,
like psql's a great command to connect to a Postgres database
and run some raw SQL or whatever you're doing in there,
but sometimes GUI tools are just a little bit nicer.
Mm-hmm.
100%. We talked a lot about LS.
We didn't mention a specific
modern replacement, so I'll do that
now. There's one called
EXA and one called LSD,
which is like LS
with a D at the end.
Both
written in Rust,
which a lot of these modern tools
seem to be Rusty or Go-y,
if that's a word.
But written in Rust or written in Go,
like FCFs in Go, I believe.
And these are written in Rust.
Now, I just did a quick perusal of both of these tools.
It seems like Exa is a little more advantaged
with just features and more modern in terms of support,
like maybe just a newer tool.
So I didn't look too much into LSD.
But Exa is like LS,
only similar to the way BAT does for CAT,
Exa will use more colors.
Now there is LS in color mode,
like we talked about before.
So you can have LS support colors,
but Exa uses colors
i guess more fully to distinguish file types and metadata it also knows about symlinks extended
attributes and it's get aware and then it's small fast and just one single binary but let's face it
ls is also small fast and i assume it's a single binary that's a built-in exa does have tree view
built in so there you go.
If you install Exa,
you don't need Tree because you got Tree for free
right there inside that, which does
feel a little more modern. You think like Tree would be
like a feature of LS if you thought about it,
right? And other such things.
So there you go. If you're interested in
maybe LS on
drugs, try LSD.
It's actually deluxe. I'm glad you said that because I clicked through to it. It's not LSD. It's actually deluxe.
I'm glad you said that because I clicked through to it.
It's not LSD as you might think, Jared.
It's LS deluxe.
So it's a bigger version of LS, essentially.
There you go.
The deluxe version that was never shipped.
Or the EXA version.
And I think this one is as much compatible
insofar as you can directly alias it EXA to LS,
and they think you'll be happy
i think it's smart to replace a given tool like ls for example but do it in a way that you sort
of keep compatibility and additive like we've talked about i think that's a i'm not sure you
know as you get on this list how often that's a hallmark of each of these but i'm hoping that's
more of the case like it's common because if you do that then it's a hallmark of each of these, but I'm hoping that's more of the case. Like it's common because if you do that,
then it's a lot easier to adopt because you're pretty much just able to
alias it in the end.
You know,
I wonder how much that's an optimization point for the maintainers of these
projects.
Yeah.
It just seems like a net win if you get the new stuff and don't have to worry
about learning new stuff.
Yeah.
Why would you not do that?
Basically. don't have to worry about learning new stuff. Yeah, why would you not do that, basically?
This episode is brought to you by Sentry.
Build better software faster.
Diagnose, fix, and optimize the performance of your code.
Sentry just shipped their SDK for Next.js.
Now in your Next.js apps, you can capture errors,
measure performance, manage releases,
configure suspect commits,
and automatically upload source maps to view unminified JavaScript and TypeScript
with zero-ish configuration.
You get your events enriched with device data,
breadcrumbs created for outgoing HTTP requests,
release health for tracking crash for users and sessions,
and automatic performance monitoring for both the client and the server.
Check for a link in the show notes for details of this release.
Best of all, our listeners get the team plan for free for three months.
Head to Sentry.io and use the code THECHANGELOG when you sign up.
Again, Sentry.io and use the code TheChangelog when you sign up. Again, Sentry.io and use the code TheChangelog.
So next up we have Man, good old man pages versus TLDR,
which is probably the best name for a modern Unix tool out there.
Definitely not a one-to-one replacement for man,
but trying to do something slightly different.
And this project admits that we all love man pages,
but we don't actually love the contents of the man pages
because many of them are old, not well written, bare bones, perhaps terse, don't have many
examples. And TLDR is kind of a new take on an old idea, mostly focused around, hey, let's provide
some examples. I think they actually use tar as the one that says, well, what if we just showed you a bunch of ways you can use TAR and what that does? That's better than
reading through a man page, which I can definitely agree with. That being said, this is one where,
I don't know, I've just been reading man pages for so long. Maybe it's Stockholm syndrome. I'm
just okay with them. I can read a man page. And maybe it's better for people who haven't been
initiated and subject to the pain of grokking man pages
but I've just had that skill already. What about you, Nick?
Yeah, I'm basically similar to you but
when it comes to some of these commands, I do really like seeing examples
so usually for me it is like, let's say I want to
recursively go through files of a specific file type
to count words or something like that. So that's something I don't
have memorized but I'll just Google for that one thing and typically
find a Stack Overflow example with the exact
syntax and flags and stuff for the find command.
So yeah, I guess if TLDR
were searchable
in that regard, that'd be kind of nice, but
I can go either way on that one.
And that's a good thing, is you can go either way
because the old-fashioned man pages
aren't going anywhere. They're long established.
They're going to continue to be there they probably will not be updated or maintained very
often of course it's up to each individual author of the tool or maintainer of the tool to maintain
that man page and so some man pages are better than others you know people put more more or less
effort into their docs this tldr is a collaborative thing which cool. So it's not just going to be the maintainers of the project.
It's going to be the community contributing examples.
So in theory, that means it's going to be actively maintained
and improved over time in practice.
Latest commit 43 minutes ago, over 8,500 commits to the repo.
So they're definitely working on it and keeping it up to date.
So that's spectacular.
Very cool.
That's interesting though.
So when you run the command
and search through it,
is it actually doing
like a network request
out to somewhere
or is it all installed locally?
Like would you need to get a new build
to get the new information
that's contributed by the community?
Great question.
I just ran tldr tar
and it says local data is older than two weeks. that's contributed by the community? Great question. I just ran TLDR tar,
and it says local data is older than two weeks.
Use dash dash update to update it.
So it sounds like it will cache locally,
probably the first time you run it,
and then you have to manually go out and grab whatever's new.
I don't think you have to update TLDR itself.
It probably just has some sort of source
for the information that it caches and grabs from.
Yeah, it's a good way to go. Kind of a middle and grabs from. Yeah, that's a good way to go.
Kind of a middle ground.
Yeah, I think that's a good way to do it as well.
So there you are.
If man is not doing it for you, check out TLDR.
Definitely practical examples is a great way to learn different command line tools.
Next up, ping.
All classic, ping.
The old ICMP.
What's the alternative one?
Was it G ping or something like that?
Like the new one?
Yep.
Yeah, so I think this one's like,
it depends on what you're using it for, right?
So for me, typically when I'm running
the regular ping commands,
you know, I'm pinging some domain or whatever
just to see if it's available
or to see what my latency is.
Like, it's a very hard sell for me
to use something like G ping for that use case because it's like,
well, I can do ping, run it for two seconds, get the
numbers, and I'm done. The graph is cool.
It's awesome looking, but it's like,
is it really helping me that much in my day-to-day?
But then if I wanted to see a graph of
all the response times, then GPing
I guess would be really cool, but I just don't have that use
case personally. What about you guys?
I'm the same way.
It's more for me, like, is it responding? Is it responding? Yes, it is. How fast is it? That'm the same way. It's more for me like is it responding?
Is it responding? Yes it is. How fast is it?
That's it. I don't really personally care about the graph.
I used to be more of a network administrator
back in the day
where I was making sure certain
servers were available and responding
on time and I had
to debug routing errors and stuff
like that. And so then I would actually look at ping
and pay attention to the round trip times and stuff like that. And so then I would actually look at ping and pay attention to the round-trip times
and stuff like that.
And in that case, I needed more tools.
And so there are other tools besides ping
that you can get into and use.
And I think GPing is definitely a step up in that regard
if you're doing network administration
or a lot of network troubleshooting.
Maybe trying to see why your Raspberry Pi is so slow
or usually it has to get outside of your local network
for things to really matter in terms of round-trip times.
But back then, I definitely would have liked this tool.
I rarely even use ping today, and when I do,
it's just literally like, is this thing going to respond or not?
It's almost like, is it there?
Is it still at that IP address?
Did it, for some reason, not get a new something from the DNS or something like that?
I am running it side by side with a ping though on what is my
home server here and I don't think it's additive personally.
And no knock against the software, it's just the graph isn't necessary. I think
ping is good enough. Yeah, I think in a similar vein there's also dig versus dog
where if you want to look at what IP address is associated to this A record or something, you can use Digg and get that information.
Jared, does Dog do the same thing, but it's more colorized, I guess?
As far as I can tell, that's the gist, because it's not providing any additional information. So if I just dig change.com, I'm getting back
pretty much everything
that dog...
So it's kind of just dig
with colors.
Right. Yeah, it's kind of in the same thing
like ping with the graph. Right.
It's cool, but it's like, am I going to install it?
I don't know. Not to be negative or whatever, but...
That being said, there's lots of options.
There's lots of query options.
So maybe we're just looking at a face value
and saying it's the same with colors.
Maybe once you dig in, there's...
Dig in. Pun not intended.
Maybe there are more differentiations
that we just don't see at surface level.
So maybe worth a look.
Also written in Rust,
so there we have a continuing theme here.
I will give them a plus one on this, because we haven't said yet in the GIF on the repo,
in the readme, is showing a ping of two different domains at the same time.
That's not something that I think I can do with ping.
Can you ping two different endpoints at the same time with ping
and get the same results backwards as sort of just one resource.
Because this is pinging Google and Facebook
and sort of getting that graph with both.
That's cool.
Now this is regular ping,
it's just one address or one domain.
Yeah, so it's single-threaded essentially.
This is multi-threaded when it comes to endpoints to ping.
It's basically the Tmux of ping.
There you go.
Or you could just use Tmux and then do ping twice.
There's a lot of ways to license it.
Yeah, I do like that.
So there's lots of these that are kind of in that same vein.
There's a bunch of, by the way, kind of grep replacements.
I mean, FCF is kind of that.
We talked about that one specifically.
There's also ACK, AG, RipGrep.
This has been a competition on which one's the fastest,
less keystrokes.
I always loved ACK's little tagline.
Well, first of all, the domain was better than grep.com.
But secondly, the tagline is like it's faster than grep
because it's only three characters instead of four.
So it's like 25 faster i don't
know how it broke out but i always said that was kind of funny so we don't need to dig into those
too much another one that i think probably lots of people are already using is jq not really a
replacement i mean a replacement functionality because you could use sed to basically like
get into certain aspects of a json blob of text but it's not like set has any sort of JSON aware anything.
That's been a big change over the last couple of decades
is most people who are doing data interchange
are basically parsing and sending JSON around the web, right?
Yeah, so that one's really cool.
So I've done a little like couple of one-liners
where it's like you curl something,
like let's say maybe you're, I don't know,
contacting GitHub's API, do a curl response there
and get back that JSON result,
pipe it into JQ, and then you can just,
yeah, you basically just read the JSON with JQ.
Like if you want to get, you know,
user.repos.whateverwhatever,
you know, it's like an object-oriented way
to access your JSON, which is way, way easier
to parse than using something like ReproSet or whatever.
Yeah, and JQ is pretty ubiquitous at this point.
See it all the time.
I see it in a lot of people's tutorials
or in their readmes showing how to use their API.
They'll often have JQ,
and so I don't think we're necessarily breaking news
on this one except to say
that there really wasn't a modern Unix tool
specifically for JSON
just because JSON is more of a modern format
that didn't exist back
when these tools were written. So JQ has placed itself. Now there are alternatives to JQ, which
aren't on this repo. We can get into that at some other point. There's people who are trying to
provide different ways of slicing and dicing JSON. So on a similar vein, there is an alternative to
curl. And there's lots of alternatives to curl.
Of course, we know Wget, but that's not a modern alternative.
Those two go back.
More modern than those is HTTPIE.
And that's just a very stark, less verbose way of requesting HTTP resources.
And that's been around for a little while.
What's newer and I think more interesting from that
is this project, which I actually didn't know anything about
until I hit this repo.
The modern Unix repo is Curly.
C-U-R-L-I-E.
And Curly is an attempt to take what was cool about HTTPy,
which is really a simplified HTTP client for the command line but doesn't provide very many of the facility
I mean we all know how many things you can do with curl
it's incredibly featureful
and HTTPy didn't really have a lot of those things
so whenever you needed like slightly more functionality
you'd have to abandon ship and go back to curl
and curly is an attempt of kind of providing the best of both worlds.
And so it gives you what they say,
the power of curl and the ease of use of HTTP.
The cool thing about that is it's actually just a front end for curl.
So how do you get the power of curl?
Well,
you don't re-implement it.
You wrapper it.
And so everything inside of Curly,
every command that you come up with in Curly,
you can actually pass it a flag that says,
show me which command you're generating for curl.
Which I thought that was a really cool way of like,
kind of eventually just learning what it is
that it's generating for you.
Maybe you decide I don't need this anymore
because I've learned.
So it's kind of cool that way.
Definitely this is one that I would use.
I did download it. I've been using it today. So it's kind of cool that way. Definitely this is one that I would use. I did download it.
I've been using it today.
And it's kind of one I think would stick with me
because I do like just the simplification of that command line,
but still being able to reach under the covers when I need to.
Yeah, I love that feature of just echoing out the actual raw command
that it runs for curl.
But I haven't heard of that one before.
But yeah, I'm going to check that one out.
So you're not replacing curl with it though, right?
Or you are? Nope. You are calling are calling curl well not what i mean is like are you using
that instead of calling curl yourself so even if like normal daily uses you'd say curl this would
you still do curly or would you do curl i'm going to start doing curly for a little while and see
what i think basically yeah okay and remember that I am a basic curl user. I'm not
an advanced curl user. Right. So mostly I'm looking at header, like the most advanced thing I do is
like looking for redirects, looking at headers, you know, I'll take the output from curl, redirect
it into a file so I can, you know, inspect a file or something. Those are mostly what I'm doing with
curl. And so I think this is like going to give me that pretty easily but we'll see yeah one more
thing i do with curl pretty often is i forget the flags to do it but there's a way to just get the
status code back so like 200 or 500 or whatever you're looking for yeah totally so there's curly
getting to the end here we have end thest versus envsubst.
I don't know, Nick, you wrote that one down, so take it away.
Yeah, so this one is not listed in the modern Unix directory there.
Oh, you're cheating.
But envsubstitute is a way for you to take, let's say,
I don't know, an Nginx config file, or basically any config file that doesn't have the ability to do templating in it.
And what you can do with env substitute is write out, let's say your nginx config or a Kubernetes
YAML file or whatever you happen to be using, put in like the shell style environment variables like
dollar and then, you know, whatever the environment variable is, and then pipe it into env substitute
and it'll go and take any set environment
variables that you have, and then update the config file, and then spit that out at its
output.
So it's basically a way for you to template out config files that don't support templating
naturally.
That's a cool thing.
So what is a typical use case of that?
Obviously, some sort of production deploy is where it makes sense to me, but give us
a few hooks.
Okay, so I just used this a couple of days ago where I was spinning up a Kubernetes cluster
on AWS. And there's a lot of ways to do this one. And I just wanted to get the cluster up quickly.
And AWS has this tool called EKS CTL. It's a way for you to define, I don't know, maybe like 10 or
15 lines of YAML. And that'll just spin up the whole cluster with parameters that you define.
And I'm making this cluster to do client work, but I'm running this test cluster on my own
personal AWS account.
And there are certain variables of this cluster that I want to be different.
Like, for example, when I set it up on my personal account, I want to be on US East
1, but my clients are on US West 2.
So the region of the cluster needs to change.
So that's like one variable.
And then other things
too, like they want to spin up like 15 servers or like beefy ones, but I just want to throw up a
couple just to like see if things work. So basically like long story short, there's like four or five
things in this one config file that I want to change between my environment and their environment.
And I didn't want to have to duplicate two config files that are basically the same, except for just
like two or three or four different variables. So in this case, now I just have a dot env file in the directory, I define my versions that I want to use like us east one,
but like a couple, you know, T two smalls or whatever. And then I just pipe it through
env substitute. And then you can pipe that into the EKS CTL command, like it supports that. So
then it's like, I can just pop in my dynamic config file. And like, it doesn't support that
naturally. But now it does with ENV substitute.
That's really cool.
I think a lot of times you rely on
kind of your target platform
or your runtime that you're running
to support templating, right?
And a lot of them do it differently
or don't do it at all.
Okay, it makes the most sense
for when they don't support it at all,
but almost kind of provides
a decoupled way of doing it.
Even if there are templating supported inside some of these tools that you're using
together you have like this standardized way that you do it and inject those in regardless of what's
natally supported is that am i on point like could you use it that way as well yeah totally but there
is one catch you with this one so when you're dealing with environment variables on the shell, you can do like dollar sign, blah, blah, blah.
And then you can do colon dash,
and then you can supply default value for that environment variable.
So if that environment variable isn't set in your shell at all,
then it's going to fall back to this default value.
And ENV substitute doesn't support that.
So like any environment variable that you plan to run through this program
needs to be set on your terminal. So you'd have to do like export foo or whatever, and then give it
some value. So I wrote this one down in the notes because there is another tool called ENV substitute.
It's like the same exact name, but it was rewritten in Go and it supports that idea of having a default
variables in there. So you don't need to set them all up. You can just set a reasonable default in
the config and then it works for, you know, however you want. And then you can optionally
override that with your own environment variables. Very cool. So that's why you have ENV subs versus
ENV subs. I didn't see it in the parentheses. It says go version. I thought, I thought they're
both go. Okay. So this command ENV substitute, I think it should be built in. Like I didn't have
to install it on Ubuntu. I'm not sure about macOS, but I'm pretty sure you probably have it.
Yeah. News to me, TIL. That's cool. I don't think I can find some uses install it on Ubuntu. I'm not sure about macOS, but I'm pretty sure you probably have it. Yeah.
News to me, TIL.
That's cool.
I don't think I can find some uses for that in my life.
Yeah, and you can just very easily try it out on your own.
You can just use the echo command and echo out an environment variable and then pipe it into env substitute, no arguments,
and you can just see how it works.
It looks like it is here on macOS by default.
So the play-by-play would be like uh export space hello equals world
okay gotcha and then echo dollar sign capital hello and then pipe that into envs sp or env
sub st env sub st or if you want to get fancy, tap complete the command. Oh, do I need any sort of quotes?
It didn't echo anything.
Did you export the variable first?
Oh, I exported it on the same command line.
I should export it and then run the echo.
Dork.
Yeah, two separate commands.
Yeah.
Tab completion for the win this time.
Hey, it says world
nice
so cool
but I mean
you don't need to
do this one live
but the idea now
is like you can
just take a file
and then
just pipe that
through there
and then send it
over to whatever
you need to
and it's going to
like be the man
in the middle
that processes the
file and turns it
into a template
that the tool
understands
very neat
well we've come
to the end of the
show we haven't
come to the end
of the modern Unix tools.
So definitely check out the repo.
All the little things
that we've mentioned will be linked up,
including this ENV substitute
with the Go version.
So you can get that one
if you're into defaults,
which I certainly am.
And I agree,
should probably be built in by default anyhow.
But nonetheless, there it is. Oh, hold on. Sorry on sorry to interrupt but here's like I don't know a pro tip or whatever but if you are
on the command line and you tried out the command that jira just ran if you did define a default for
that variable it is going to work but the only reason it's working is because your shell is
actually interpreting that default variable so it's a very tricky subtle thing so it's not going
to work if you have the variable in a file but it will work in the command line because your shell is actually interpreting that default variable. So it's a very tricky, subtle thing. So it's not going to work if you have the variable in a file, but it will work in the command line
because your shell is pretty awesome. That's the worst when you have something like that,
where you're like, it's working right here in my shell. Why doesn't it work when I go to use it?
You know? Yeah. Good pro tip. Yeah. Anything left unsaid? Surely you've left some things unsaid,
but anything else you want to say before we tail off? Nick, tell folks where they can check you
out, the coursework you do, etc.
Yeah, so I have a personal blog at nickgenitakis.com.
N-I-C-K-J-A-N-E-T-A-K-I-S.
And I put out a new post every week.
A lot of them are YouTube videos lately, but I do have written versions of most of those.
Like, you know, if there's a command line heavy video, you're going to see reference
tables of the commands there.
As for courses, I have a Build a SaaS app with Flask course,
where we build a SaaS app with Flask and use Stripe and a whole bunch of different stuff there.
I have an intro to Docker course, dive into Docker.
I keep that one up to date basically for new to Docker,
want to figure it out, there's that.
And there's also like the runninginproduction.com podcast,
where, yeah, we went over that one before.
Basically just talk to new folks every week about how they're building
and running their stuff in production.
New courses on the way.
I do have a deployment course coming out.
Still working on it, but it's not available yet.
But if you go to nickgenotakis.com, you can get notified there and when it ships.
That's about it.
I'm also on Twitter at nickgenotakis.
All the places.
Everywhere.
All the places.
We do link it up in the show notes so you can find everything Nick just said pretty much there.
We'll do our best to do great jobs.
Hey, but guess what?
They're also open source.
So if you see that we've missed something, well, then you can step in.
And if it's October, you get a t-shirt.
Not from us, from DigitalOcean.
That's right, from DigitalOcean.
Nick, you're always awesome.
Big fan of what you do.
Thanks for coming on the show, man.
Thank you for sharing your thoughts, your wisdom, et cetera.
Yeah, thanks a lot for having
me. And this is really fun. All right. That's it for this episode of the change log. Thank you for
tuning in. We have a bunch of podcasts for you at changelog.com. You should check out,
subscribe to the master feed, get them all at changelog.com slash master, get everything we
ship in a single feed. And I want to personally invite you to join the community
at changelog.com slash community.
It's free to join.
Come hang with us in Slack.
There are no imposters and everyone is welcome.
Huge thanks again to our partners,
Linode, Fastly, and LaunchDarkly.
Also thanks to Breakmaster Cylinder
for making all of our awesome beats.
That's it for this week.
We'll see you next week. Game on.