Seite wählen

NETWAYS Blog

tmux – terminal multiplexer

In diesem Artikel möchte ich euch kurz das Tool tmux vorstellen, dass zu meinen Lieblingstools unter Linux gehört. In einem vorherigen Artikel hat Johannes schon einmal die Basisconfig von tmux gezeigt.

Da tmux eine Server Client Struktur hat, bevorzuge ich es in der Regel die Finger von der tmux config zu lassen. Da man die sonst auf jedem Server pflegen muss, mit dem man arbeiten möchte. Leicht hat es an der Stelle derjenige, der Puppet oder Ansible nutzt und seine eigenen Server pflegt. Ich als Consultant habe meistens Kundenserver, auf denen ich nichts verändern möchte was nicht nötig ist.

tmux hat für mich 2 Einsatzzwecke:

  • Bei Präsentationen Bildschirm- und Beamerterminal synchronisieren.
  • Bei Servern meine Sessions schützen, so dass ich nach Verbindungsabbrüchen weiterarbeiten kann.

Besonders der zweite Zweck ist sehr praktisch, da ich auch Bahnfahrer bin.

CLI

Jetzt zur eigentlichen Benutzung: Gestartet wird tmux über den jeweiligen User. Wenn man ein Terminal vor sich hat sind folgende Basisbefehle praktisch:

  • # tmux -> startet eine neue unbenannte Session
  • # tmux new -s „MeineSession“ -> startet eine benannte Session
  • # tmux list-sessions -> listet Sessions
  • # tmux -a -> verbindet zu einer unbenanntenten Session
  • # tmux -a -t „MeineSession“

Inside tmux

Wenn wir jetzt in einer tmux Session sind kann das folgendermaßen aussehen:

tmux ScreenshotTmux unterscheidet zwischen „window“ und „pane“. Wir sehen in diesem Beispiel 4 panes in einem window.
Um innerhalb von tmux zu navigieren braucht gibt es diverse Keybindings die immer mit Strg+b eingeleitet werden. Hinweis: Bei screen, einem ähnlichen aber älteren tool als tmux, war es Strg+a. Wem das lieber ist, der kann bei Johannes nachschlagen, wie man das umstellt.

Im Window hat man folgende Befehle:

  • Strg-b, % Horizontaler Split
  • Strg-b, “ Vertikaler Split
  • Strg-b, x Schließt den aktuellen Pane
  • Strg-b, <Pfeil-Tasten> Zwischen Panes hin und her springen
  • Strg-b, d detach, von tmux abmelden ohne es zu beenden

Ein Window ist vergleichbar mit einem Tab in deinem Browser. Zwischen einzelnen Windows navigiert man mit:

  • Strg-b, c Neues Window
  • Strg-b, w Windows auflisten
  • Strg-b, [0…9] zum Window Nr. 0-9 wechseln

Kopieren

Ein praktisches Feature ist das kopieren. Das funktioniert ähnlich wie in Vim aber, da es Terminals sind, auch zwischen verschiedenen Servern.

  1. Als Erstes braucht man mindestens 2 Panes.
  2. Strg-b, [ Öffnet den Scroll-Modus
  3. <Space> startet den Markier-Modus unterm Cursor
  4. <CR/Enter> kopiert
  5. Nach dem Wechsel ins nächste Pane . . .
  6. Strg-b, ] fügt ein

Am besten probiert man das alles selber mal aus. Es gibt auch eine Menge Cheat-Sheets zu dem Thema, die vor allem am Anfang hilfreich sein können.

Christoph Niemann
Christoph Niemann
Senior Consultant

Christoph hat bei uns im Bereich Managed Service begonnen und sich dort intensiv mit dem internen Monitoring auseinandergesetzt. Seit 2011 ist er nun im Consulting aktiv und unterstützt unsere Kunden vor Ort bei größeren Monitoring-Projekten und PERL-Developer-Hells.

You missed out OSDC? — Sign up for OSCamp!

Hey folks!

The OSDC 2019 is in full swing! You didn’t get to be part of the happy DevOps crowd meeting in Berlin?

Here‘s your chance to find some relief by participating in the next big Open Source thing happening in Berlin this week: Be part of our OSCamp on Ansible!

But you gotta be really fast to grab one of the few remaining seats at opensourcecamp.de

To get a glimpse of how it feels to be one of the OSDC guys, just take a look at the photos published so far on our Twitter channel. And start getting excited what’s coming up at the OSCamp…

See you in Berlin on Thursday!

Pamela Drescher
Pamela Drescher
Head of Marketing

Seit Dezember 2015 ist Pamela Anführerin des Marketing Teams. Mit ihrer stetig wachsenden Mannschaft arbeitet sie daran, NETWAYS nicht nur erfolgreicher, sondern auch immer schöner zu machen. Privat ist sie Dompteurin einer Horde von drei Kindern, zwei Pferden, drei Katzen und einem Hund. Für Langeweile bleibt also keine Zeit!

Fresh from the shelf

Hi !
This week I will take a little look into three command line tools which I find very nice for daily use on a server where we have almost no interface except the command line.
The first tool I would like to bring to your attention is a file explorer for the command line.
Ranger
Ranger is a finder/explorer/nemo/nautilus replacement for the command line with a simple but straight forward file management approach. It uses the almost everywhere liked miller columns and i personally like it more than the midnight commander but that is a personal preference.
I also like the extensibility as an example you can extend ranger with poppler for pdf support or mutool whatever is available for your distro.
It can be easily installed and can be just started from it’s own directory so no big installation fuzz. Simply unpack and start ranger.
mehr lesen…

David Okon
David Okon
Senior Systems Engineer

Weltenbummler David hat aus Berlin fast den direkten Weg zu uns nach Nürnberg genommen. Bevor er hier anheuerte, gab es einen kleinen Schlenker nach Irland, England, Frankreich und in die Niederlande. Alles nur, damit er sein Know How als IHK Geprüfter DOSenöffner so sehr vertiefen konnte, dass er vom Apple Consultant den Sprung in unser Professional Services-Team wagen konnte. Er ist stolzer Papa eines Sohnemanns und bei uns mit der Mission unterwegs, unsere Kunden zu glücklichen Menschen zu machen.

OSDC 2015 – Enterprise integration with open source, day 2

Attending conferences of a certain size always brings the pain of deciding what talks to listen to. I really wished I could listen to all of them live but at least there are the OSDC archives, so I will be able to watch what I’ve missed when the videos will be edited and uploaded. Following are my personal impressions of the talks I chose from the tracks.
Despite being at least a bit tired from attending the OSDC evening event at the Paulaner Bavarian restaurant in Berlin yesterday talks were interesting enough that from the first talk on day 2 of the Open Source Datacenter Conference on the two rooms where talks were given were full of attendees again.
As first talk of day 2 Timo Derstappen used the Pixar movie plot schema „Once upon a time…“ to give an introduction into microservices and how orchestrate them using the „ambassador pattern“. He showed with his demo that systemd and fleet on CoreOS can be a real alternative when running multiple containers depending on each other.
After the first coffee break of the day Ingo Friepoertner gave a short overview over the history of databases and why NoSQL databases will not replace relational databases but are the better alternative for many applications. Using the concept of „Polyglot Persistence“ you will want to use the right store for the right job, so split data into different databases: Financial data in an RDBMS, user sessions in a KeyValue store and recommendations into a graph database and so on. To avoid getting stuck in a swamp of many different databases from many different vendors you can use multi-model databases to consolidate several of the beforementioned technologies into one product.

Ingo Friepoertner with Polyglot Persistence & Multi-Model #nosql Databases in MOA 4 #OSDC /eh pic.twitter.com/YQaUJamRh7

— netways (@netways) April 23, 2015


In the next talk Matthias Klein showed us how to keep development close to production by creating your own package repositories and copy only selected packages into them. Then use vagrant or Xen and puppet to create test hosts that resemble the production hosts as close as possible to roll out new packages, run tests from Jenkins and, if all went well, deploy the same packages on production systems. One of the most important factors will be to convince everyone that only packages in your repositories are allowed and that every configuration change has to be implemented in puppet so it can be reviewed more easily and tested on test hosts before the same configuration (with just some parameters replaced) goes on production hosts.
After the great lunch John Spray showed us what CephFS is, how it developed lately and what the current state is. Being not so familiar with Ceph like I wished I was, I was glad hearing that CephFS, a distributed filesystem on the Ceph backend, is available now (even if it’s not supported for enterprise use) and CephFS volumes can be mounted simultanousely on different hosts just like a network share. A great „new“ feature (which is available for about a year now, which is almost no age for enterprise grade software) is the combination of Cache Tiering and Erasure Coding which basically means having a fast but small pool of disks (preferably SSDs) that handles all of your I/O and a second pool of big, slow disks where data is not replicated like in standard Ceph pools but split like on RAID 5 / 6 / Z systems where automatically „cold“ data, which is rarely used, is moved to.

A really cool talk about @Ceph by @jcspray. Thanks for coming over! #osdc /be pic.twitter.com/4QV7wYkxgc

— netways (@netways) April 23, 2015


Next was a talk I anticipated a lot, personally. Pere Urbon talked about one of my most favourite toolsets, the ELK stack. He gave a quick explanation about what Elasticsearch, Logstash and Kibana are and what they are used for. Then he dug a bit into some real life examples about scaling the stack, especially by using a broker like Redis or RabbitMQ. In fact, RabbitMQ might be a real alternative to Redis and I will definitely see into the different possibilities, the various brokers have to offer. Not only Redis and RabbitMQ but Apache Kafka and some others. During the talk we learned a bit about the new features of the to-be-released-today Logstash 1.5 and the coming-someday Logstash 2.0. After the talk there was only one question unanswered: How is the Green Lantern Corps logo out of the slides related to the Marvel comic multiverse, Elastic normally gets most of its names out? 😉

Pere Urbon talks about Scaling #Logstash:A Collection oft War Stories in MOA 5 #OSDC /eh pic.twitter.com/4fqeiDUZoO

— netways (@netways) April 23, 2015


The last talk of the day I attended was Bernds talk about why to use Icinga instead of Nagios. Whoever reads this blog should already know that Icinga (2) is way cooler than Nagios so I will not go into detail about his talk. But you should definitely look at the video in the archive when it’s online even if you’re already convinced because Bernd’s talks are always worth the while.

OH: "I will focus on #icinga2 cause that's our new hot shit" – @gethash at #osdc 😀

— Michael Friedrich (@dnsmichi) April 23, 2015


Thomas Widhalm
Thomas Widhalm
Manager Operations

Pronomina: er/ihm. Anrede: "Hey, Du" oder wenn's ganz förmlich sein muss "Herr". Thomas war Systemadministrator an einer österreichischen Universität und da besonders für Linux und Unix zuständig. Seit 2013 ist er bei der NETWAYS. Zuerst als Consultant, jetzt als Leiter vom Operations Team der NETWAYS Professional Services, das unter anderem zuständig ist für Support und Betriebsunterstützung. Nebenbei hat er sich noch auf alles mögliche rund um den Elastic Stack spezialisiert, schreibt und hält Schulungen und macht auch noch das eine oder andere Consulting zum Thema. Privat begeistert er sich für Outdoorausrüstung und Tarnmuster, was ihm schon mal schiefe Blicke einbringt...

Weekly Snap: Neon 110 & Coshsh, Confs & Camps in San Francisco

weekly snap18 – 22 August offered an eclectic mix of subjects – from sys admin and handyman tools to configuration generators and analyzers.
On events, Eva counted 99 days to the OSMC with Gerhard Laußer’s talk: ‘Coshsh – Configuration Generation’ while Bernd made plans to join Puppet Conf and Icinga Camp in San Francisco.
Continuing the travel theme, Thomas shared his thoughts on the troubles of flying with and without Swiss army knives as Ronny reflected on the excitement of discovering new sys admin tools.
Lastly, Georg helped bring about a firmware update for the Neon 110 network thermometer and Gunnar offered a peek into a new configuration analyzer for Icinga 2.