 So you want to become a command-line wizard, huh? Yes, okay, so Yeah, this talk Basically, it's gonna be Sorry Too quiet It's not hello. Oh, there we go. Okay. I'm sorry. It's a bit I'm a quite a tall person. So I gotta have to leave for a little bit. So yes In this talk, I'm gonna show you Quite a few new command-line tools and in fact, I'm gonna give this talk on the command line and They get the takeaways Supposed to be at least that you know some new tools at the end of this and you basically don't have to know anything Before that like you don't even have to know how to get around any kind of Unix system and and One thing to note is that even though I'm gonna be presenting many tools and many alternatives to Well-known tools, this is not meant to be like that you have to replace your old ways of doing things It's just like that you can so plan so plant your current knowledge with some new tools and These tools are mainly meant to be for interactive usage and not so much for script usage for script usage You should always kind of use the old tools that you used to because they are most likely not gonna be available on the systems That you're gonna be scripting for so with that said Let's talk about me just a real quick So yeah, I'm a command-line enthusiast as you might have figured I'm an arch Linux developer Yeah and I use arch by the way and Yeah, and I work as a DevOps consultant freelance so Why even bother Sorry, it was meant to be like this. Why even bother with the command line Yeah, so anyway, so command line is not going to go away. It's been here for like many decades It's gonna be here for some more decades might as well embrace it It's efficient for many kinds of tasks. It's not so efficient for other kinds of tasks But the you know, you should pick the right kinds of tasks to use a command line for right or that pick the command line for the right kinds of tasks and Sometimes you just can't use a GUI, right? Sometimes you're locked into some servers now me working as DevOps. I lock into many servers a day and Basically, I really gotta know my tools around that and you can't always have an X server. It's really not possible And yeah, tax is still the only truly universal exchange format Despite what other people might tell you And yes the slides themselves. I'm just gonna go ahead. They are on the command line Yeah, all right, I Want to draw your attention to the fact that we have fade out effects and fade in effects watch this All right, so Don't worry, you don't have to memorize this. This is just like an overview because this is essentially a completely live Kind of a fair that we're gonna have going here So please cut me some slack if something goes wrong, right? So Yeah, we're gonna be looking at some of tools and some common tasks and how what you were probably used to and then what you might be What are you using now? So let's have a look Right. So first of all exa exa is a tool for listing files Now you might know that you can list files and unique systems using LS and tree But exa is pretty by default and it has good support. So let's take a look what that means, right? So Normal LS looks like this. All right. It's a pretty pretty plane So my LS looks like this because I have some areas to make it pretty But usually if you look into some default system looks like this, right? But exa also looks like this by default, but now this is not really So fun is it so let's for for fairness sake. Let's use LS dash L and use my oh shit It's a bit. I don't want it to wrap. I'm gonna I'm gonna see what I can Can you guys see there at the back? This is Okay, great, and then I'm gonna keep it like this so it doesn't wrap. So So we can see here what the LS dash L output looks like so it lists my user the attributes lots of stuff It's not particularly helpful though if you want to know the real sizes you gotta do this right so that you get the human readable sizes and Everything could be more colorful, right? You could always make it no colorful. Basically the trend nowadays is to make everything more colorful And so you've got exa dash L Now it's very colorful. You can see here that the the attributes are all colorized so you can easily skim that and the The sizes are human readable by default and the users actually my user is twin star Oh, so it's like yellow ish and the root user which is not my user is just kind of like grayish and Then the other thing is also readable now the the way the the files are colored is that executable files and that have the executable flag on the This side here and they are green so you can see these are screen Multimedia files are like violet and so on and so forth. So there is actually some logic to that But we can go even further now. What if we had git support right built in so we have this git column here I can actually show headers So it might be a bit more. Oops header Header we have this git column and on the right side of the git column You have files which were changed locally but not get staged and then left side you have files Which were stage so we have n for new and m for modified so this is pretty cool Alice doesn't really have that but we also have tree right you have this unique stool called tree Which shows you a fail tree and if you want to have the same an extra you can also do like Exit as tree now it looks like the same right it's a second essentially the same but Can your tree do this? it can It was a trick question it can but you have to do you have to like D. I actually had to write this down P right like that Not quite as colorful. No is it but Now we have we have seen that extra can do this, but can your tree do this? No, it can't and this is amazing right you can basically check your structure And you don't have to alternate between tools like it status all the time right like that That's pretty amazing. So that's extra in a nutshell. Let's continue FD finding files now a person a pet peeve of mine is like find is kind of sucky to be honest in interactive usage like if you want to just kind of do something and and like make a fuzzy search for something it's and you always have to put the Put the single quotes at the right location put the asterisk is the right location that kind of sucks now But we have FD which is like find but it doesn't suck for interactive usage and it's colorful as well so You might see a trend here, so Let's find let's find all of the readme's in the C Python source code, right? So I have to prepare so we have find right and I've C Python right here and We want to kind of because people can we have we have to give I name because it might be case and sensitive because people might write Readme's and we had kind of Realization so go like that and we have to go like this read me asterisk and then we get all the readme's in C Python Great, so we can do the same thing with find every FD go like this FD and then just source C Python and It's the same output but a lot less tedious to type right if you compare these guys a bit less tedious to type and Honestly just nicer to look at because it has colors, but we can go even further of course What if we wanted to find all of the? Python files in the Colonel output kernel source code actually right we can do that Or actually, let's do something else. Let's let's find all of the parser files in the C Python The C Python cost source, so we might want to go like this And we only want to find Python files, so we do like this right Now we can do the same thing with FD Like this you have this dash e which means extension Like that and then we can do the same thing Right, but now we can keep adding extensions easily right like that For instance, we can find all the all the RST probably it has RSTs It has some you see and we can keep adding extensions for that so we can more easily do this I had to be honest. I have no idea how to do this and find because you can have to like write a wreck eggs and maybe make it a subgroup or something so that's kind of Annoying another nice feature of find is FD is that it actually uses our git ignore to Ignore files that we don't want so if we look at our git ignore right here It has some like they had this some example report that I did there's this ignored file and Lo and behold there is our ignored file and if we FD for ignore won't find it But if we go like you for unrestricted it will find it So that's a nice feature because usually you don't want to search for feature for files which are ignored by your git ignore. So that's FD continuing Rip grab now many people might have thought about that. It's quite a common tool nowadays. It's insanely fast It's like rep but it's really really quick And it's also user friendly and it has amazing colors And it also uses git ignore. So what does this mean in practice? Well How about we search through the whole Linux source code and We search for buffer right the buffer word comes up quite a lot with the Linux Contacts So I'm just gonna let it run for a little while But the general idea is that Linux uses a lot of buffers And it takes quite a long time like it took like nine seconds as you can see my shell there Let's do the same thing with rip-rip Oops there. Oh, fuck me. Hang on with the hell. Oh Because sorry because I copy this we don't have to have the we don't have to provide the recursive flag for we grab It also does this body fault It's quite a bit fast if you see two seconds against nine seconds But now and rip grab also does something nice. It ignores binary files by default which grab doesn't do And git is basically a bunch of binary blobs and we don't really need to search that and also it has git ignored by default So we search a lot less stuff and we usually don't care about all of that stuff And also if you check the the default way that things are Kind of looking so I have this file here the API helper and This is the output for rip grab and this is the default output for Grab and you can see here that the output differs quite a bit in the way that we get file numbers I think grab can do this as well But this is just like comparing the default output and by default grab actually doesn't do any recursive searching Which if you don't do this like it just kind of sits there and waits for standard input It's doesn't a very useful to be honest, right? So it might make sense to just search that so this is what grip It does It also allows you to search for specific types of fire So if we provide the fire type pi for python and we search for buffer in the Linux source code turns out there's actually some occurrences of buffer in Linux, right? So this is all Linux all Python files as you can see in Linux which do some Hepat house so that was pretty nice to do and with grab you kind of have to find all Python files grab pipe that into Grab and that's kind of annoying. So that's a rip grab. It's pretty cool Next up we have Tokai or Tokai. I don't know how to pronounce that but anyway, so it's kind of like clock Not many people have heard about clock actually, but if you want to count your lines of code on the On the command line, usually you would use them per script called clock now pearl is a language Engineer to be the slowest possible scripting language. So it takes a long time actually to do anything and in pearl and I can actually demonstrate this by just counting the number of files and the number of source lines in CPython Takes a little bit of time, but the general idea is that well The tanks of time is degenerate here to be honest. So there we go Yeah, it's wrapping. I'm sorry for that, but the you can see it it counted this we get some results now Tokai as an alternative Basically like that. Alright, so It's it's pretty fast Tokai allows us to count anything we want like Linux Takes a few seconds, but I did this with clock and it didn't finish when I like Take it took minutes to be honest We can also see just how many C files there are in Python we can only count the C files like T for type and Then turns out there's a few or sorry. No, I'm saying files, right, but I mean lines of code, of course So that's Tokai short and sweet if you want to count lines of code. It's not colored I think this is probably the only tool utility that we have today. That's not colorful Next up HTTP a personal favorite of mine. It's like curl, but it's like super user friendly You know curl also kind of was made with the ability to be super user unfriendly like you have to like if you actually want to provide Jason or something like I don't I can't remember the syntax ever, right? But let's try and request right? So I had to prepare this because I really can't So I have this local loop back HTTP server So it just gives us that so that let's do the same thing with HTTP And for some reason the command line tool is just called like HTTP, right? This I can't imagine this ever conflicting with anything at all So it looks like that So this looks a much much better, right? And this is the same kind of like output, but it shows us the response headers in a nice kind of formatting his colors And then it has the it knows it is Jason and so in parts is the Jason and and kind of formats adjacent as well, right? So that's pretty cool And now for instance, we can also tell curl to show response headers and request headers and everything and looks like that and I'm like if I Mean so these are the request headers because it has these lines going inside or the arrows going inside And these are the response headers and the response body, but to be on like act so Let's let's just go to send some data and I had to write this down because it looks like this So this is some Jason and then we can't forget to set the headers always set the headers like that and Then don't forget the method never forget the method All right, and it looks like that and then you have this right and we get this back because it's just like a dummy HTTP Server, but you get the idea right and this in in HTTP is like that I'm not kidding. It's that simple And yeah, we can actually also show the request headers and everything in HTTP pie using show and then the Basically, it's a bit weird of a syntax, but you get like capital ages I think the response headers and then the request is like the lowercase age and same for buddy And then it looks like that. So I think this is pretty cool, right? You can see that and you can also set headers the same way so Low rofl or something and you can see that we set the header low rofl, right? So that's pretty cool Let's continue Bet now bet is an interesting one bet is like like cat and If cat and LS had an amazing Magical unicorn baby, right and that's kind of what what bet is and it has syntax silencing support and It has automatic paging support for long files and it has git support now. How does that? How does that possibly work? Well, I can show you so If I just bet something like change file You can see that it has these weird things at the actually let me show you let me show you this Let me show you this first. So we have API. I have a wizard with just a Python program Which does something right but it looks like that right not not very interesting, but then we have bet looks like that And it also has a pager built in so we have like this, right? So we have syntax support. We have on the left side You can see that we have these little squiggles which means that this line was changed and I wrote this here This line was changed these lines were added you can see the pluses And it won't use the pager for short files. So if you just go like staged file It will like basically just not use the pager It will also give us line numbers, which is nice And that's essentially all there is to know about bet now Obviously never use bad as compared to like cat or less if you want to use or actually Compared to cat if you want to actually concatenate files, but if you just want to look at files, right? It's pretty cool. And also if you bet binary files it would just say like binary and cat is gonna be like, yeah Yeah, so So that's that SD SD is a short and sweet one It's basically like set but people can actually use that without looking up the main So Have a look at this we have this change file and we have this replace me replace So with set if you actually want to replace that we will go like set dash I S slash replace and then Something and then G because can't forget the G because it will only replace the first occurrence per line All right, so can't forget the G and then this and then change file and then as we if we bet this again See it to replace a but with SD you just go like something Change it back to replace and then change file and that will actually have to change it back But if you don't want to commit, right? We are a generation of millennials. We cannot commit, right? If we go like dash P We can preview that without actually changing the fight. So that's pretty cool Right. So that's all there is about SD Which is like set but user friendly and then we have hyperfine. Oh, this is interesting one Usually in Unix if you benchmark things you would what would you do? You would whip up time, right? And then just run time a bunch of times. I can actually demonstrate that I Have this taxi simulation here, which is a Very fast program that does something and a theory has some output, but we don't show it But so if we want to time that how long that actually runs for you can run this a few times and we have some like we have some data but eh, you know Then we have hyperfine and now watch this there's some spawn up time to measure something and then a Basically runs a program a few times to make sure to sort out these statistical Errors and we'll actually also take note of the min and max times and you can see that they were actually quite Quite considerable, right? And we can actually tell it to run a few more times But the general idea is that the program runs quite a few times In order for it to figure out how long the program really takes in total, right? And so we get the we we can execute very quickly terminating programs and still Make sure to benchmark them properly and so now we are down to a delta of like a plus and minus of 10 milliseconds Which is quite quite a bit still but at least I mean the program terminated very quickly But you can imagine how this is useful if you want to benchmark some other tools right so and Yeah, you can also specify a warm-up phase if you're into that kind of thing So where it basically runs a program like a few times beforehand and then completely discuss the measurements So just in case you have some kind of I owe Demanding program where you want your want to be very sure that the thing that you want to benchmark is absolutely not your IO cash Right so you can do that It's pretty cool. And now Yeah, we have a bonus because we still have a little bit of time MDP which is actually the program that I'm using right now to run this in this demonstration Which is basically at the markdown presenter. So you write some markdown files. It looks like this if you Want to be very specific It looks like this and this is my talk actually which is run right now by MDP and It is like PowerPoint, but it's 1% of the features But it's all the features that matter. All right And it's on the command line and your PowerPoint can't do that now can it We have another bonus Gen Act so Imagine you want to pretend to be doing some work But don't actually want to do any work. Now. What do you do right? So you can run Gen Act and go like CC and now we're compiling something And you can run Gen Act as M web log and pretend you're looking at some I don't know Colonel compile You'll get the idea right you can also just run it like and without any arguments It will go into demo mode and we'll run a few iterations of every kind of program that it has it has quite a few programs actually Has these programs you can run that so you can do this, right? I don't know you get the idea, right? So I am glad you like it because it's actually the only program in this whole list that I've written myself. So thank you Thank you for that Yeah, we have One more bonus which is a very short and sweet one ASCII aquarium It's just like that, right? You have fish on your command line. We have one more and then I'm done Which is C matrix probably everybody knows us, but still for completeness sake Yeah, thank you for my yeah, thank you very much Sven for this very colorful talk at any questions or comments Does FD also have a statement like execute less fine. Yes, it does In fact, it also has a batch statement for execute So if you want to have if you want to get rid of X arcs, you can do that instead. It's pretty cool actually much less painful to use So when you have questions, you can also line up at the microphones on the side There was those second signs after your like command line like after master like three seconds and so on what's that like? Oh, yes. Oh my god. Okay. So that's like I see yeah So if you run a command which takes a few seconds to execute after one second My shell will like it will always keep track of the command and it will show you along the command took always So you can't forget that It's actually called liquid prompt. It's for a tish shell and it's it's yeah for for the ZSH Yeah, you shall like yeah for that and it's like a special prompt which has this thing built in where Basically, it only shows you what you need to know. You can see I also like this is my my git state currently It's like almost a shell kind of no no. Well, it's a it's a special prompt for the show Yeah, there's also a bash version of that It's it's pretty cool. I can recommend like a prompt more questions Maybe in the meantime, you can tell us how this fade in fade out works I actually don't know. I think it uses NZ color codes, but I don't actually know but I actually wanted to look that up It's a bad page. I do know if he has an option to print to the alternative screen So when you close it doesn't show up in your shell Ah, I see so this is just a normal I think shell feature where you can press Control Z in order to background the task and then you have this you can see this this one sleeping process here Which is now sleeping which is my presentation you can type jobs to see which jobs are currently sleeping It's just this right and then I can press FG to foreground this again. That's pretty cool. Oh, sorry I will let let's let's I can show you outside Okay So if you're ever running graphics, what kind of window manager do you use? Oh, well, I use graphics right now Actually, I'm not really on the command line actually lying. It's I use I3 I3 as you can see it just normal a3 stuff Which I can do this right what terminal is that is that this is the termite terminal? Okay. Thanks any more questions Do use any other tools related to terminal work which increase your productivity or ergonomics for example, I I Think the best tool I found is a drop-down terminal I use Yakuwak. Maybe some another tips or tools you use or your work Well, so originally I wanted to show off whim because this I also put this in the title of the presentation or in the in the description text and I figured we didn't have enough time for that for whole whim thing So I use whim a lot for everything really I do everything No without team. I just use I3 and just keep opening terminals. I don't like the double kind of winner management I know that there's tools to make that easier But honestly, I like to keep it simple and that just have just a lot lots of I3 Windows in fact, I have 10 open desktops right now and all of them full of windows. So I use a lot of windows One question here is ripgrep faster than silver search Yes, at least I mean so I used to use the silver search. So the question was whether Ripgrep is faster than the silver searcher, which is another tool that looks a lot like rep and also has colors and also same defaults The basic philosophy of ripgrep and AG or the silver search are much the same It's just that ripgrep just happens to be like five times faster in the benchmarks. So Make some difference. I suppose with very large repositories Do you recommend using the T-Max? well So I use quite a bit of T-Max, but honestly not for development more for well Well, it looks nice. It's just I don't know So I I know T-Max is very popular with OS X people because they don't have a proper native window manager. I think nowadays they do but Generally speaking, I don't really like window management in T-Max so much as I like it in i3 And I don't want to manage them like in two ways Can all these apps that you demonstrated be installed with Pac-Man or yes In fact, I package most of them for actually next but also for other distributions and also for windows and OS X So they're all available in brew I think and they are also all they also all have pre-compiled binaries for windows which just work How difficult today is for you to reproduce the same environment on another system? Pretty easy. I mean it depends on how much control I get Since most of these tools that are demonstrated are written and rushed and have static binaries You can just kind of get the binaries don't know that and they will always keep working except for HTTP Pi which sadly is a Python and the distribution is a bit more complicated. I know it's a bit It's a weird thing to say here, but yeah, Python distribution is still not a Solve problem, I think but yeah, it's pretty easy to replicate the environments Do you use any other displays like the status bar or anything like that? Sorry come again. Do you use anything else like a status bar or any other kinds of displays? Oh, yes Well, so I use poly bar for for displaying my my system stuff But I like to keep the output to a minimum Like I'm not into a very flashy conky stats and stuff like that because I never look at them anyway Just I keep it simple and make sure that the system has enough battery time Good very very much. Thank you to Sven give a warm hand to Sven