Episode: 3887
Title: HPR3887: 10 must-know commands for a new cloud admin
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3887/hpr3887.mp3
Transcribed: 2025-10-25 07:29:24

---

This is Hacker Public Radio Episode 3887 for Tuesday, the 27th of June 2023.
Today's show is entitled, ten must-know commands for a new clouded min.
It is hosted by Klaatu and is about 25 minutes long.
It carries a clean flag.
The summary is, learn these essential Linux commands so you know how to run your cluster.
The cloud sure is popular lately, and if you're using the cloud and you're not used to having
to interface with a Linux system, then sometimes it can be a little bit disorienting.
You might need a crash course on sort of what you're meant to do with Linux.
And I think honestly it can be boiled down to about ten commands, like ten must-know commands
for Linux for a cloud admin.
Here we go.
Number one, cube-cuddle or cube-control, Q-U-B-E-C-T-L, or your equivalent, your cloud
equivalent.
Very often it's cube-cuddle because the cloud generally is powered by Kubernetes.
But maybe you're running a front-end in front of Kubernetes, or a distribution of Kubernetes
if you will.
Like open shift, then you would be using the OC command if you're using K3S, well you
are still using cube-cuddle.
So I don't, well I think there is a separate command though for K3S.
But anyway, you're going to need to know cube-cuddle or at least the principles of cube-cuddle.
So learn that one for sure.
It does things like it gives you reports on your environment.
Like cube-cuddle gets node, cube-cuddle gets pod, things like that.
It'll tell you what you're running on your Kubernetes cluster.
You can get your cluster info with it, cube-cuddle cluster-info, and cube-cuddle top.
See what's actually using all your resources.
Cube-cuddle scale, cube-cuddle auto-scale to make sure that your replication control
is where you need it to be.
All of those kinds of things, creating a namespace, cube-cuddle create namespace, or cube-cuddle
create dash-namespace, one of those two.
So it's an important command if you're going to be interacting with a cloud, running image.
You could container images and pods and things like that.
Cube-cuddle is kind of the standard command, so I mean you're going to need to know what
like I say, but I mean there's also there are similar ones, there are similar functioning
things like pod-man or docker, those kinds of container engines, those are important
to know.
I feel like once you learn one of those, you get the concepts of the things that you have
to be curious about when running containers.
You might be used to running it locally with pod-man and then you get to Kubernetes and
you're using cube-cuddle instead, but the idea is still the same.
You know that you might need a list of the containers being run, you might need a list
of the pods that those containers are in, you might need to activate or deactivate a
feature.
They may or may not be the exact same term or syntax, well usually the same term, might
be a slightly different syntax, but at least you know kind of like what to look for.
Second one is curl.
If you're going to be using stuff on the cloud, then you're necessarily interacting with
a system that is remote.
You are interacting with a system that is not physically right in front of you.
You've got a computer right in front of you, but there's stuff out there on the internet
that you're going to need, even if it's just a question of downloading cube-cuddle or
K3S or whatever Kubernetes distribution you're using onto your control plane.
The way that you're probably going to do that is with curl.
curl is a really simple syntax.
It's curl, C-U-R-L, like C-U-R-L, space, and then the U-R-L that you want to visit.
So HTTP, colon slash slash example.com slash index.html.
You can do this in your terminal right now, space dash dash, remote dash name.
That'll go out to example.com.
It'll look for index.html and it'll save it to your hard drive by whatever name it was
on the remote server.
That's why dash dash, remote dash name is there at the end.
It's saying to go retrieve a file and bring it back down with the same name.
But that's not all curl does.
Another very, very common use of curl is for API testing.
And again, if you're interacting with stuff on the cloud, chances are pretty high
that you're interacting with an API.
I mean, every time you use Kubernetes, you're interacting with an API.
But I mean, you may also, you'll be running services that quite likely have an API access
to them.
So with curl, you can quickly test what that API is sending back to you.
For instance, curl, space, HTTP, colon slash slash, you know, ingenex-example.example.com.
If there was an API there, as far as I know, there is not, then you would get a response.
Now if you were expecting to see, I don't know, a specific response, then you could look
for that.
But if you just, you could also just make sure that it's up and running.
So if you do a curl dash dash dash dash head, HTTP colon slash slash example.com, then you
get just the head information, the header information from the HTTP response.
So if you're just trying to see, make sure that that API point is like responding at
all, then you can get the data that it's sending back to you, even if it doesn't send
the data from the application behind the API, if you know what I mean.
So that's an important and really basic kind of just a little test for a location on the
internet.
But you can do more than that.
I mean, with curl, you can specify what kind of HTTP data you are sending with the dash
dash request option.
So curl, space dash dash request space.
And then you're going to do either a post or a get, but really you're, you're probably
going to be doing a post to an API because you want to send specific information.
So curl dash dash request post, all capitals post.
And then the data that you want to send and you can send as much data as you want.
And each data that you send, I don't know if that's correct, each datum that you send
is dash dash data.
So dash dash data, space, quote, user equals clatu, close, quote, dash dash data, space,
quote, password equals password, one, two, three, close, quote, or more likely it would
be, you know, token equals maybe dollar sign, my underscore token or something like that.
And then HTTPS, colon slash slash example, dot com slash my API slash my endpoint and
assuming again, assuming that there's an API there and there's, there's not as far as
I know.
But there was then I have just sent the data of user and password or, or rather token
to that API as post HTTP, like post data, it processes that hopefully, hopefully I've
designed my API to expect that kind of data and returns, you know, whatever it's supposed
to return.
Of course, I just said, hopefully I've designed my API to receive that kind of data.
And that's another, that's yet another good test with curl to send data that you know
that your API is not expecting.
What does it do in that case?
That's an important thing to find out.
We've all heard the horror stories about people, I don't know, sending a dash, dash data,
quote, drop table, close, quote, to my, my SQL server and, you know, ruining a database
or something like that.
So you don't want to do that, maybe you do want to do that, I mean, to a test subject.
But that's an important, you know, that, that kind of chaos testing is kind of important
to see.
See what happens when you abuse your API with curl.
Next, unzip archives online are often bundled as zip files.
It's pretty common.
You're going to need to extract data from a zip archive at some point.
So the unzip command unpacks a zip file.
The command is very, very simple.
It is literally unzip space and then the name of the file that you want to extract.
Now, here's a pro tip.
You can avoid typing out the long archive names, a lot of software is developed, it is
delivered with, you know, I don't know, CRC dash, Linux, dash, AMD, 64, dash, 20, 23,
dot, zero, six, dot, zero, six, dot, zip or whatever.
That's a lot of typing.
So if you don't want to do that, you can usually unzip space, CRC, dash, and then hit
the tab key.
The tab will take you to the, the closest, you know, as far as it can take you without
having to, to make a decision, like if there's two very similarly named files, then you
might have to type another character to sort of give it a hint.
But just hit the tab key and it'll usually auto complete the, the, the name of the file
for you.
Unzip, that unzips it, that, that just unzips the thing into your current directory.
For tar, another common archive format that you've, if you've used Linux at all, you've
seen this, it's a, it's the tar format, usually encapsulated by some compression algorithm.
So like, maybe a tar dot gz or a tar dot xz, those are both popular right now, unarchiving
a tar file.
So it means basically a zip is just a different, it's a different format of, of that same principle.
And, and the command is a little bit more complex, but not very.
It's pretty intuitive, tar, space, dash, dash, extract, space, dash, dash, file, and then
the name of the file.
So whatever that would be.
Here's another pro tip.
Since I gave you one for zip, I'll give you one for tar.
I mean, they're actually interchangeable, but I'm, I'm spacing them out.
Instead of bothering with the, um, the tab trick, you could also just use an asterisk.
So if it's a very long file name, CRC dash, Linux dash, version number dash, AMD 64 dash,
whatever, um, tar dot xz, then you could just do basically the front and the end of that
file name with an asterisk in between.
So for instance, CRC asterisk xz.
As long as that's unique enough for your terminal to, like, be able to figure out what
that is, then it'll just untar that thing.
I mean, it'll untar that thing, whether it can, it'll untar everything that starts with
CRC in this example and ends in xz.
So I'm saying, make sure that you do that when there are unique things.
Otherwise, you might be doing actions on files that you don't intend to.
Not that tar is a destructive action.
It's just it would, it would be annoying.
Okay, five, pseudo, um, when you use a Linux computer, you are using it as a just a
normal logged in user.
You don't have any special permissions other than the permission that you have to modify
and edit your own data.
And, and the reason for that is that it's going, it's the computer is trying to protect
you from accidental data loss, you could, you could write over some very, very important
file and take down your entire server really easily.
And there would be, there's, you know, without pseudo, there is no, there's no, there
would be no protection against that.
It would be really easy to just bork a server just with a mistype.
So you don't want to do that.
So pseudo, you are required, rather, to type this pseudo keyword before dangerous commands
or really administrative commands.
And then it prompts you for a password.
As long as you are in the pseudo group, if you're not in the pseudo group, then you don't
have, you, pseudo is not, is not significant to you.
It will not, that won't do you any good.
You're probably working mostly out of your home directory anyway.
But I'm assuming that if you're interacting with the cloud in a administrative sense,
that you, you would need pseudo and you would have permission to use pseudo.
If you're not, then you won't need it and you can just kind of ignore this one.
The syntax is really easy though.
You just, whatever command you were typing before that it tells you you don't have permission
to do.
You put pseudo in front of it and then you, you do the command again.
So let's say that I was going to move a configuration file to slash Etsy.
And it wouldn't let me do that.
It says that I don't have permission.
Okay.
Well, instead of moveconfig.txt slash ETC, then I would do pseudo moveconfig.txt slash ETC.
So that's sudo.
And then it will prompt, it would prompt me for my password.
I would enter it.
It would verify that I was, I was, it was in the pseudo group.
I'm permitted to do this and complete the command as, as I requested.
Speaking of the MV command, the move command, that's a good number six.
Six would be moving a file when you download a command or a file from the internet.
You're going to probably need to put it somewhere.
It's it that usually you're, you're downloading or very frequently, I shouldn't say usually,
very frequently you're downloading a configuration file or a command that needs to be placed
on your path.
And to do that, you use the MV as in move, the MV command.
It's a very, very simple kind of command.
It is MV, the thing that you want to move, the place you want to move it to.
So for instance, let's say that you downloaded the cube cuddle command and you need to move
it somewhere so that you can run it.
Because if you just type, if you download cube cuddle and you're just typing cube cuddle,
you'll notice that nothing happens.
Nothing isn't the same as installing.
Now there are lots of different ways to install things.
So this isn't really a lesson on installing really.
But I mean, this is one option very often.
If you've downloaded something called cube cuddle and you know that that's a command that
you're meant to run because the Kubernetes instance that you're interacting with is telling
you to do this, then you'll have a cube cuddle command and you won't really have a direct
way to access it.
And the reason for that is because your terminal only looks for commands in a special place
called your path.
A path is, well, it is exactly that.
It's the special place where your terminal searches for a command.
When it thinks that you've given it a command, it looks in your path.
If the thing isn't there, then it tells you file not found or whatever it says.
So let's say you've downloaded cube cuddle and you need to move it somewhere.
You've been told maybe to use it to put it into a slash usr slash local slash bin.
It's a reasonable place.
So you could do in the space, cube cuddle, space slash usr slash local slash bin.
Now to verify what your path actually is, you would want to do an echo, e ch o echo,
space, dollar sign, all in capitals, p a t h path.
And that will return a list of directories, delimited by semicolons, no, by colons.
And those, those directories are valid directories where you can put a command.
So your terminal knows that command exists.
Now, if you did try to do a move, cube cuddle to slash usr slash local slash bin,
you would probably get an error for permissions.
You probably wouldn't have permission permission to put files in user local bin.
But you know how to solve that now.
Sudo, remember?
Okay.
Seven, Chamod, a command like cube cuddle, for instance, happens to be in a binary format.
It's written in a language that computers understand.
So when you download it and put it in your path, you can just run it.
There's usually not anything special that you have to do.
It just comes ready to go.
Not always.
It kind of depends on on who's distributing it and so on.
But that's generally the case.
Now, if you've written yourself a script or you've downloaded something,
like a script or you've downloaded something that just doesn't come with the executable bit active,
then you need to grant that file executable privileges,
meaning that file can be run as a command,
not treated just like a normal everyday data file.
You do that with the Chamod command.
It stands for I think Change File Mode, CH Imod, Chamod.
When you want to make something executable,
you do Chamod, CH Imod, space, plus X for executable, space,
and then the name of that file.
If you do that, now you can run that file that you've just granted executable permissions.
As if, though, it was a command installed on your computer all along.
Now, once again, you know how to do that technically,
right, because I've just told you how to do move
and that you need probably to use sudo to move a file to an important place.
And you already know the echo command, so you can find out the path.
So in that order, you would do echo path, echo dollar sign path, all capitals, P-A-T-H,
and then that would tell you your path.
And so then you would zero in on one of those directories,
and you could move with the MV tool,
but you'd probably remember it from last time it wouldn't let you.
So you would do the sudo move your file to a location,
and you've just Chamod at that file.
So it's ready to go.
You're just moving it into a place where your terminal, that your terminal knows
there are commands living.
There is a little bit of a hack around that, though.
And that is the dot slash notation.
And this is, I'm counting, this is number eight, the dot slash notation.
To run a script that you've just marked as executable
out of the place where it exists right now,
so you don't even have to move it to your path,
you can, you can target that thing with a dot slash.
So a dot stands for the place where you are,
your current location, and then slash is just like,
that's the notation for a directory.
So essentially you're saying, don't go anywhere,
stay in this directory, and run this file.
As long as that file has executable permissions,
then it will be run.
So for instance, let's say I just downloaded a file called install.sh.
It's actually pretty common.
So I've just Chamod added it,
Chamod plus x install.sh.
And instead of doing the whole echo path,
move the file to my, to my path,
because I mean install.sh is probably not a command
I want to keep around forever.
It sounds more like something I want to run
so that it puts stuff into the right place.
So I would just do Chamod plus x install.sh,
and then dot slash install.sh.
That would run the script.
Now it might fail, might tell you that you have to do it
as root, or as an administrator,
in which case you would do, what would it be?
sudo space.slash install.sh.
You're good to go.
All right, nine CD.
CD command is how you change your current directory.
When you open a terminal,
you start in your home folder by default.
Now if you work exclusively in your home directory,
you can do that.
But I mean it gets cluttered pretty quickly
because you start generating all these files
and then you just have a bunch of files
lying around on the floor in your home directory.
So instead you'd probably want to CD
into some kind of sub directory.
The common sub directories are things like downloads,
documents, music, video pictures, all those.
So you could CD into those directories
with CD space downloads for instance.
And then you could download stuff with curl
or you could CD till day.
That's the little squiggly line under the grave accent
to the left of the, no, right above the escape key I think.
CD space till day and you'll get back home.
Till day is a shortcut for your home directory.
And you can combine a lot of paths as well.
So you could do a CD till the slash documents
and maybe you've downloaded something
that is in a sub directory.
So maybe you are not documents.
Well, maybe documents who cares?
And then there's a sub directory called, I don't know,
school paper and you want to get into school paper.
So you CD school paper, now you're in school paper.
Well, where are you really though?
Well, you're in till this slash documents slash school paper.
So if you do a CD space till day,
then you go back to your home directory
and you could do CD documents slash school paper
and you would end up,
you'd basically skip over documents in a way.
You'd rush through documents and end up in school papers.
You don't have to do all of that up front.
That's kind of, it's a little bit advanced
to combine file paths like that all in one go,
but it is something that you can do.
And as you build up to that,
one of the things you'll probably need to do
is have a look around as you move through directories.
Because otherwise you're just sort of blindly moving
through your file system.
The way that you look around in your file system is L.S.
For list files, L.S.
You'd also just type Der, D.I.R.,
but L.S. is the more common one,
I guess because it's only two letters instead of three.
L.S. shows you it lists the contents
of your current directory.
So if you just CD into some directory,
like, I don't know, documents,
then you could do L.S. to see what other directories are in there.
Maybe there's a school paper,
maybe there's some configuration files,
maybe there's a programming project, and so on.
Then you could CD into one of those and do L.S. again
and see what files are in those directories
and other sub directories possibly.
So L.S. is a vital sort of,
it helps you find your bearings.
And I think I have the feeling you'll use that one
quite a lot as well.
CD and L.S. you tend to use quite a lot in the beginning.
And I mean, forever, really.
I mean, they're really useful commands.
Okay, and then finally, am I on nine or 10?
Or am I on 11 now?
Well, the other one I've already mentioned.
So echo, ECH, oh, echo.
Echo isn't really an active command.
I mean, it is, you have to type it in.
All it does is it returns information to you.
So if you need to know, for instance,
as we've already done your path,
then you can do echo, space dollar sign path.
And in that case, path is all capitals.
These are environment variables, they're all capitals.
Variables don't have to be all in capitals,
but a lot of them are.
Maybe you want to know what shell you're running.
You could do echo, space dollar sign shell.
And that'll tell you that you're running,
or in my case, slash bin slash bash.
You might be running something else like ZSH.
And the way to find out is just to echo, space dollar sign shell.
And again, shell would be all capitals, SHEL, all capitals.
So it's a useful command that's kind of to get a feel
for important things on your system.
And a lot of the cloud-based technologies
are gonna expect you to have certain environment variables
set either on your local machine,
or on the control plane of your cluster.
Since I've mentioned echo,
I may as well mention kind of the other side of echo
or another side of echo,
which is the variable setting in the first place.
So for instance, let's say your cluster
expects you to have a variable called FOO, FOO, all capitals.
And the value of FOO is supposed to be,
maybe the IP, the cluster IP of one of your nodes,
one of your compute nodes.
Well, maybe that's not set yet for whatever reason.
You can set that yourself.
So the way that you set a variable is the export command,
type in export space, and then FOO, in this case,
FOO, all capitals, equals, and then the IP.
So let's just do 10.0.1.101.
Say that's the internal IP.
You don't get anything back from that command,
it just accepts what you've said.
But if you do echo, dollar sign FOO, all capitals,
then 10.0.1.101 is returned.
So now that environment variable has been set
on your machine for this session.
And that's an important thing to realize
that it happens, it's essentially a temporary variable.
I mean, it'll last a while,
but only for your current,
as long as that terminal is alive,
which in the greater scheme of how long things
run on servers and clouds, that's not very long.
So one of the things you possibly might need to do
is preserve that variable somewhere.
But probably your cloud setup will tell you
where that variable needs to be listed
in order to be considered valid.
So I'm not gonna go into where you would put variables
to make them persistent.
You can certainly investigate that further.
It's a great topic to talk about,
but I think usually cloud providers or cloud software
tells you exactly where variables need to be set
or sets them for you.
But just remember, export variable name equals variable value
to set a variable, and then echo dollar sign
variable name to get that value back out.
Those are 10 great commands for a new cloud
and by hooker by hook Linux user.
So hopefully those are useful.
I've obviously concentrated heavily on the commands
that you're likely to use when interacting
with your control plane.
There's a lot more out there.
There are literally hundreds of commands out there.
And some of them are really, really important.
Some of them are just really, really fun.
And they're mostly on your computer.
So you can find out more about them by looking
in user bin or user local bin or just slash bin.
You'll find all kinds of cool commands there.
Look them up, learn more about them.
Trust me, you get better at this stuff
than more you do it.
Hopefully this has been helpful.
Thanks for listening.
Talk to you next time.
You have been listening to Hacker Public Radio
at HackerPublicRadio.org.
Today's show was contributed by a HBR listening
like yourself.
If you ever thought of recording broadcast,
click on our contribute link to find out how easy it leads.
Hosting for HBR has been kindly provided by
an onstoast.com,
the internet archive, and our sings.net.
Onstoast.net, today's show is released
under Creative Commons,
Attribution 4.0 International License.
