Sound test? [Translated by Tom Süßenbach (KYBS2001 course assignment at JYU.FI)]
Yeah, that sounds better.
That sounds better, good.
Who of you already uses a customized shell environment?
Maybe made a few adjustments to the prompt, maybe using ZSH,
Plug-in managers—those are the things I'd like to show you today.
Before I do that, a little more about my
employer, B1 Systems.
I've been working for B1 for eleven years.
have also had contact with us.
B1 has been around for over 20 years now, specializing in Linux and open source from the very beginning.
We have about 150 people now. When I started 11 years ago,
we were still around 60.
So it's going pretty well, and we're doing things like this, I always like to call,
the all-round happy package everything around Linux in the data center.
From consulting to training to managed service operations.
As I said, I've been with B1 for, well, 10 years, now 11
years, working as a senior trainer and consultant.
The last few years, mainly training, but recently
significantly more consulting, especially in the area of ​​security,
Automation and Kubernetes, a lot.
But that's not what we're talking about today, but rather a bit of shell operation. Here again
a few key points. If you take a look around, we really have everything there.
from storage to virtualization, config management. I'm also supposed to
do a bit of advertising for our Linux Client Management, which
is the first product we've released. a centralized
Management solution for Linux clients.
There's also a webinar, I think on April 8th.
That's April.
You can get more information about this at our booth.
We'll also have a small raffle at our booth in 45 minutes.
Or not quite, in 40 minutes.
So if you're interested in a plush Tux or an
Emser coffee mug or a Make subscription, feel free to stop by.
I'll make sure I finish on time so that
everyone can still come to our booth for the raffle.
Pimp Your Shell.
I've already seen that some people already have customized shell environments.
But let's start at the beginning.
Because such a nice terminal emulator as we use today
didn't always exist.
In the past, computers often didn't have their own displays or
keyboards, but rather had truly classic hardware terminals.
We see an example here, a VT100.
It was connected to the main computer so that I could
operate it somehow and not just feed it with punch cards.
So it was a bit more convenient to have a keyboard as an input option
and so that I could actually see something a screen.
These devices were simply connected
So that I could even operate the computers via a shell.
But then it was more or less replaced by PCs, where I then
built the actual computer into boxes.
So now you work with terminal emulators.
These are virtual devices that are mapped in software.
You may be familiar with this if you take a look around in the DevTree.
There I see DevTTY 0 to something.
I see my PTYs, i.e. my virtual ones from the graphical interface.
If I start the GNOME Terminal, for example, I get
a corresponding virtual terminal, which isn't a direct terminal.
So, the first graphical emulator that existed was X-Term.
I could start it in my X server and then also had a corresponding option for issuing shell commands in my
graphical interface.
A few more examples are listed here: the console, one could
also mention the GNOME Terminal, and a few others that
I will also introduce again.
The Windows Terminal is, of course, also a terminal emulator.
or even iTerm from macOS.
So that's about terminals, now we're talking about shells.
This is the user interface of Unix-like operating systems.
Linux, BSD, and the like. It's used to execute commands.
On the one hand, there are built-in commands, shell build-ins, such as the
echo command to display something.
Or simply, I call third-party programs, such as
for example, an editor, VI.
or I execute an IP command,
a Git clone, or whatever.
But shells can do a little more than just run programs.
Shells can also work with variables.
I can define variables in the shell and then reuse them later.
You might also be familiar with it from the environment variables I have,
accessible via the ENDS command.
We can also take a quick look at what kind of environment variables there are, but I can
of course, also define my own.
I can export them so that they are then also available for other started
shells.
I can create linked conditions, I can create simple if-then statements,
but I can also create loops, so that things are simply executed
100 times.
A shell offers me such things and I can, and this is important when
combining commands, use the output of one command as input
for the next command.
This is done via the so-called pipe or I redirect the output to a
file using output redirection.
The Born shell was used for a long time, still found today
as BIN-SH on most systems So the classic was eventually
replaced by Bash, and I've listed a few more here.
The Cornshell, Dash, which was standard in Ubuntu for a while.
I don't even know if that's still the case.
I haven't had Ubuntu in my hands for a while.
ZSH or Phish as further examples.
I'll show one or two more again later.
Then we have the CLI, the command line interface, where I have
a line of text as input.
Which then executes the commands for me, interpreting them accordingly.
It's not just available as a shell, but also in interpreted languages, for example.
For example, if I now call Python, I also have Python
An interactive way to enter it via the command line.
In contrast, the graphical user interface, which then
I think Firefox or other graphical tools, my presentation tool here, which
is used, and of course also graphical terminal emulators,
so I don't have to switch.
A quick recap of Shell history.
1941 was the first time, with the Zuse Z3, that it was possible
to program computers using a keypad. Before that, it was really only possible
using appropriate circuitry.
The first real terminal that was available was the Datapoint 3300, also known as
glass teleprinter. I could then connect it and then control the connected
mainframe computers accordingly.
The first original Unix shell was the Thomson shell.
And then a few years later, the Born shell came along.
was replaced primarily by Bash from 1987 onwards.
For a long time, it had simply been the default shell in many distributions.
Things are a little different these days.
Different distributions use different default shells.
Then, yes, more history about the shell.
Shell History is a built-in function within the shell and
helps me to revisit commands that have already been executed.
How many commands are saved is configurable via an
environment variable called HisSize. This is usually set to 500 or 1000.
lines that are saved, which I can then easily call up again.
I can also display the history with the command History.
It then shows me all the commands with a corresponding number.
When it was executed, it simply counts up.
And then I can directly execute the command again by entering an exclamation mark followed by the
corresponding number.
Or even the last command entered simply via the double exclamation mark
For example, if I forgot to enter sudo before installing a package,
and then I'm not asked for the password somehow via Polkit or something,
then I can simply do, exclamation mark, exclamation mark
and then it will execute the last command. Run the command again with sudo in front of it, ask me
for my sudo password, and great, I can install the package.
And then we're talking about shell aliases. That's the first thing I'd like to show you
again.
You may be familiar with this: the LL is often preconfigured in the
distribution, which then gives me a long listing, which allows me to
not only see the file names, but also the permissions,
the corresponding timestamps, the number of hard links, and so on.
And I can configure these aliases very easily on the fly. I
simply enter "Alias," then I enter the name for my alias and then
following the equal sign the command I want to alias.
It's a very, very practical thing, because especially complex, relatively long commands
like a Git checkout from a specific branch or something like that.
tend to be a bit longer, and of course, it's nicer if I can simply make it a bit shorter, and I do that using an alias that I carry
5.000 / 5.000 920 I then create one—of course, I don't do this ad hoc, but I enter it
in my shell configuration file in the etc-profile in the etc-bashrc in
the .bashrc in my home directory or .zshrc, depending on
which shell I'm using
And these shell aliases are a very, very nice thing.
This will allow me to make things shorter.
I'll show you soon, when I've updated my ZSH configuration with a few plugins, that there are often quite a few aliases involved.
Then there are shell functions. So I can define things that I have
programmed in the shell as functions.
So that I can then call them like a normal external command.
Then I simply specify the name of the function I have defined.
And then I can simply use it.
This function, which I listed here as an example, the prefix,
You'd better not run it.
What does the whole thing do at this point?
This defines a function, those are the first three characters
called a colon.
So I define a function, and it's simply called colon.
Then the contents of the function appear in the curly braces.
And what does this function do?
It calls the command or function colon and then pipes the
output to colon again.
That means I have an endless chain of ever-increasing
colon functions that are called and at some point my
system simply crashes because the resources are exhausted.
I close the whole thing with the semicolon, which is the end
of the function definition, and then I call it at the end.
So if you enter that, it will only take a few seconds.
and your computer will be unusable.
Of course, that's not a great practical use case,
but that's how you saw it.
I don't have it here as a sticker for nothing, I think.
Okay, then shell plugins so that I don't have to do everything myself by hand.
Of course, I can also rely on functions and aliases
that people have already done and published.
For example, on GitHub.
And so that I can easily reuse it, there are so-called
plug-in managers for the shell as well.
The most well-known, oh, my ZSH, that was the first major plug-in manager.
And I still use it today. It has some nice features, gives
me the ability to very, very easily define a theme for my shell prompts.
and also gives me information about other plugins that I
can be easily activated, then nice things come with it, like auto-completion
where you provide your own functions or even a whole bunch of aliases
I work a lot with Kubernetes.
And all the kubectl commands, I might not want to
execute them forever, but I just do something like that, then use my shortcut.
There are now also similar plugin managers for the also widely used Bash and
Fish shells, and there are also similar plugin managers for a few other shells.
And that brings us a bit to the Beautiful Prompts.
I'll show you that in a moment.
So ein Share Prompt ist natürlich konfigurierbar Häufig ist das
einfach User at Host und dann habe ich da noch so ein Zeichen und dann
simply User at Host and then I have another character there and then
geht mein eigentlicher Prompt los. 5.000 / 5.000 13:59,625 --> 00:14:02,265 A share prompt like this is, of course, configurable. Often, it's
my actual prompt starts.
So then I can type.
But I can also record further information with it.
For example, I can configure it so that the hostname is now
only displayed when I'm on a host via an SSH connection and
not displayed on my localhost, or when I'm somewhere via SSH, I can then color the whole thing red so that I know
I'm not on the current system.
I have to be a little careful when I do a reboot, not to
restart any productive server all at once.
It actually happened to me once at a customer's, and it wasn't great.
I can also see additional information, for example, the time or
even dynamic information, for example, if I'm in a Git tree.
Then I can see which branch I'm on, where I stand with the upstream,
because I have any uncommitted stuff in there, am I ahead of
or behind the upstream, I can display all that stuff beautifully
and that via... Even with graphical symbols so that I can have
a Git logo in there or I've also configured it in ZSH like this
so that I have the distribution logo at the beginning of the line, like a Fedora logo.
Or on the Mac, I have a little apple next to it.
For Kubernetes, I can create the Kubernetes logo
or, of course.
Put in a beautiful penguin.
In order for the shell to display such characters, I also need a
font that supports the whole thing. These are the so-called nerd fonts.
There are a whole host of fonts, which often also have all these
symbols in them, so that I can make my Share prompt really colorful and
nicely decorated with symbols.
Are there a few themes for that too?
They preconfigure it for me and customize it for me.
These are simply themes from OhMyZSH, where I simply
found the names cool and the power level 10K, which I'm still using.
At least for me in the Z-Shell.
I'll also show you the Starship prompt, which I set up in
Bash.
It's very easy to install, very easy to configure.
Then there are also a few newer shells that simply offer even more features
than classic Bash, for example, extended file globbing,
things like inline tab completion, auto-suggestions, and things like that.
As an example, I would like to use ZSH, which was
the first shell that was truly modern and offered an expanded range of
features.
Phish is a bit more suitable for beginners because it simply
offers similar functionality to Z-Shell, but is a bit
better preconfigured.
Or I've listed Elvish here, but I haven't used it myself yet.
It's also a relatively modern variant. There are also
a few specialized shells, for example, the Xon Shell as Python.
Shell, which is based on Python and is ultimately a superset of Python.
So for those who program very, very extensively or almost
exclusively with Python, this might be an alternative. I don't work with Python that much myself,
so I haven't used it yet.
Then there's the NuShell, which also takes a slightly different approach.
For example, if I run a LS or any other command
that has a relatively long output,
If I then only have a specific
information, some commands offer appropriate options to filter out exactly
the information I want, other commands
cannot do that, and if I then only have a specific information I want or
I want to reformat it, then I quickly have to use
external tools like Grab or AWK, if
want to swap it around, then it quickly becomes complicated, while the New Shell is a
A bit similar to PowerShell in terms of approach, where I can also see the output
as objects individually can address.
And this is exactly the concept that NuShell follows, where I can then create selectors directly with Wear.
It's definitely quite exciting.
I've taken a quick look at it. For everyday use, it's probably not
yet for me, but it does offer a few interesting features.
I also installed it and brought it along.
Or for SQL fans, Hoth Query, where I use SQL statements to
execute commands with my shell.
Also really exciting.
And then there are terminals. I'll show them now and then.
The classic, of course, is X-Term.
It's not really pretty, but it's very, very functional and does what it's supposed to.
But there are also other terminals that may be able to do a bit more,
that can also handle tabs, like the GNOME Terminal
or Konsole, iTerm, or even Thermos on Android.
If I want to have it as a dropdown, there are also
solutions for Jaguarke, Guarke, or Tilder, so that the shell then
simply opens dynamically via keystroke, for example, F10 or F12,
usually drops down from the top.
It's quite practical because I don't have to open a shell window,
but I basically always have it available behind the keyboard shortcut.
Then there's multiplexing, which I can then use to display multiple terminal windows
without having to deal with the Sundays of Screen or
Temux.
But that's also possible, of course.
And more modern terminals like Alacrity or Kitty, which I use myself, also offer such multiplexer functionalities that I can very, very
easily divide my shell window again.
I can arrange the shells in different layouts.
arrange them side by side without needing any additional tools.
for me, that's what the Kitty program does.
There's also the Warp Terminal, which offers a bit of
built-in AI, with which I can then also get suggestions. I
can actually ask questions.
Yes, how do I do that in Bash?
Which then talks to ChatGPT, I think, and looks up the answers for me.
Or relatively hyped, I am I also came across it on YouTube
GhostDeep. I want to bring the functionality of tools like Kitty
and it should be super fast.
I think I've installed it myself, but haven't really tested it yet.
I'm very happy with Kitty.
And before we say thank you, let's go back
and open a bell.
I'll do that, slide 4.
We have a bell here.
Is it legible if I type something here now?
That's fine, right?
You've already seen when I do something like this here, it's actually
via the ZSH Auto Suggestions and the ZSH Completion, which shows me directly here
First, the alias I assigned, the K for kubectl, so that I don't always have to type it out,
but simply K and then API Resources shows me
the API resources from Kubernetes and then I search here
for the String Service Account.
Works pretty well so far, or something like that. If I now do a K
then we can also see here the last directory I
created is called CLT 2025.
If I want to see a little more, I can also
look here using Control R and then I can see here too what I have I
Because everything is listed here last, I can search it wonderfully.
I think that's pretty sexy.
Then I can, for example, look here for what
Brew has in it somehow.
We can see here that I also installed one or two things via Homebrew.
It just doesn't come directly from the Fedora package management.
We also see Fedora here, I'm in my home directory.
I can also see how long the last command took.
I can then also do nice things like... Like showing me whether
the last command was successful.
If I do something like that now, then we'll see, yes, it didn't find it.
That might not have been the best idea.
And I see the arrow is no longer green, it's red.
That also tells me directly that the last command was unsuccessful.
I can also configure it so that I can directly display the return value
of the last command.
If it's 0, everything's fine; if it's green, it's wonderful.
If it's red, then I might also want to know
what the return value is.
I wonder if that was an error in the shell because I mistyped the command, or if it's an error code from the command itself.
I can have things like that displayed.
Here on the right side, I can also see which user I am and which host I'm on.
I see the current time.
These are all things like that, and for me, they mostly come
from OMAZSH plugins.
And where did I configure them?
I have them in... Minus again
A1 to the point ZS HAC.
Maybe I should also tell them again what I
want to grepe for here, that's
Exactly, here we can see in Plugins which plugins I have installed here.
I also had to reinstall a few things, for example
I think I had to install the autosuggestions later.
And we see, I have a few things here, for
Example of using Git.
I do a lot with Ansible, so I've installed something there too. I've installed
something for DNF. Because I'm on Fedora, which makes it a bit easier for me
so I don't have to run sudo dnf update or sudo dnf install
I don't have to do anything. I just say dnfi and then I specify the package
I want to install.
So I'm bringing a few aliases with me that will make things a little easier for
me.
It brings a lot of aliases with it, so I don't have to
complicatedly specify the brand and what I'm doing with Git.
Then, of course, I have something for kubectl.
OC is for OpenShift, and we'll see a few other things
that I have in here.
FZF is a great tool for this.
For this, I need to have FZF installed as a fuzzy finder.
And that allows me to do things like this advanced reverse search,
that I configured, which I showed with CTRL-R, so that I
then get a direct list with the things that I
displayed that were in there.
Likewise, the ZSH navigation tools and the auto-suggestions, as well as
and the ZSH syntax highlighting.
You can also see it a bit, if I enter a command here,
for example, mkdir, then we see that it's a wonderful green.
As long as it's not a command it recognizes, the whole thing is displayed in red.
and it's quite good. Nice, in any case.
The Colorize Output. That.
I definitely recommend anything that starts with ZSH and FZF.
The Fark, I don't know if you know it.
If I've entered a command incorrectly, I can say "Fark" and then
it will try to correct it for me.
There's also an auto mode.
That's just a gimmick.
I already said, I'm now here in Kitty, and I said he
can multiplex, it's very easy and I have a new shell here
inside, I can then also adjust the layout accordingly here and, for example, place them side by side, it's very practical I don't need Themux for that.
Okay, let's go back out and then we can take another quick look at the Starship point.
in your line. It's very, very easy to configure, and I've
set it up in Bash.
So I'll just start a Bash and we can see here, I'm on here
I chose Penguin because I couldn't find the Kubernetes logo
and then I see Default on Default, in Default is of course, what is that?
This is my Kubernetes context. You will then see which user I am in,
which cluster I am logged in to, and which namespace I am in.
In this case, everything is now default.
Then I can also see here—I’ve expanded this a bit—
which shell I am in, and what my username is.
If I now switch to a directory where I...
have Git in there.
Let's take a look.
And then let's just take my Hyperlint Dots directory here.
We can also see which branch I'm in.
I can then also see the state of my branch and ultimately whether I'm in it.
I think that simply means there are things that have been marked.
We can take a look at that in the config right now.
The Starship config is very, very simple and very,
very nicely modular.
And we can take a look at them too. We'll find them
under config starship-tommel.
Up here, I've enabled Kubernetes, which then also tells me
what format the whole thing should have.
This ensures that the penguin is displayed, then my
Kubernetes user, my Kubernetes cluster, and the Kubernetes context.
Then there's something for terraforming, and then Shell and User, which shows me
which shell I'm in and which user I'm logged in as.
and then the Git status stuff.
We see beautiful icons here, but you can also customize them freely.
Okay, what else did we have?
I wanted to briefly show you the Nu Shell.
But I might have to look it up myself again.
the syntax. I call it with Nu.
And now I have to start it again very quickly.
I'm still here.
Oh God, oh God.
And then I can, for example, do something like this: LS-Wear-Size over
10 megabytes and then Sort by Modified without having to work with Grab and
Sort and any other shell tools.
Can I set such filters and sorting directly with NewShell?
And then get a completely different output than I'm used to from LS.
I can see it perfectly in the table here.
It's quite exciting. I haven't used it much myself yet, but I find it
very interesting, and I wanted to at least show it to you.
That's actually what I wanted to show you.
Do you have any questions?
Well, I also use a lot of aliases.
That's a Rust tool, a better LS.
But would that also work in this new shell, or is it a special
LS that's being referenced?
NewShell interprets the output differently.
So it would also work with... So would that work?
Yes.
Okay, that's what I wanted to know.
Thanks.
Any other questions?
Perhaps a brief note on the New Shell.
Very closely resembles PowerShell.
And if you look at how it works internally, they have something like that
the... I'd say, typed pipelines.
Relatively exciting, if you talk a lot, I'd say, you could
even about object orientation, somewhere like that.
Very exciting when you move away from the pure Bash, Shell, Dash environment
and a lot of, I'd say, intelligence into scripts like this
what we've just seen here.
The only disadvantage is, very much on the power level
in terms of syntax.
Does Alias ​​somehow expand the command by default?
So, that I type LL and press Tab and the command
which I have set as alias [is auto completed]? [Florian Winkler:] It depends, sometimes you have to
activate something for that. This is how it is with Kubernetes.
Since the auto-completion for Kubernetes works, where it then directly
requests the API, I also have to turn it on again for the alias Completion
How do I turn it on?
It doesn't work for me.
I should also have that in the ZSH-AC and
I'll pull that at the end, if I'm not very sad.
Okay, no, I don't seem to have that directly here.
The QCTL plugin does that for me.
Otherwise, I can just quickly find it.
Let's take this one, just open a new tab, k alias completion.
And there we see, after I've defined the alias,
I still need the complete-f command, so that it starts kubectl when I use the
alias. Then the built-in kubectl completion also works.
Okay, thanks.
Any further questions?
If not, thank you very much.
Then we'll all make it to the raffle. [Translated by Tom Süßenbach (KYBS2001 course assignment at JYU.FI)]