Rust Programs Every Linux User Should Know About

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

This "written in Rust" things seems to help apps gain popularity.

👍︎︎ 2 👤︎︎ u/Iuse_arch_btw 📅︎︎ Jan 28 2021 🗫︎ replies
Captions
why is all of our applications being rewritten in rust um it seems like the rust programming language has become the latest meme everybody wants to rewrite all the gnu core utils and rust people have even suggested rewriting the linux kernel in rust so what's the deal with rust i don't know i'm not a programmer but i can tell you this rust and especially these rust applications people are writing are definitely not memes because many of these rust replacements are actually better than the original applications today i wanted to highlight a few programs that are available on linux that are written in rust that i think you guys should know about and probably should have installed so let me switch over to my desktop and i'm going to open up a terminal and let me zoom in all the programs i'm going to show you today are actually terminal applications most of them are command line applications because that seems to be where most people are focusing their attention you know a lot of people are learning rust and when you're first learning rust you want to put it in action and the easiest thing to do is rewrite some basic command line utilities like some of the new core utils you know rewrite them in rust actually before i even get started on some of that i actually forgot the prompt i am using the shell prompt here in the fish shield this is the starship prompt now the starship prompt is uh available in the bash shell csh and fish and the starship prompt is actually written in rust so if i did a cd let me see in my wallpapers directory you can see the starship prompt gives me some git information and it's quite customizable you can configure the starship prompt to show you a variety of information so that's already one rus program but let's start with some of the rewritten core utils so everybody knows the standard ls command in your shell and a lot of people always ask me about my ls command because when i run ls of course it looks very very different right i've got you know the file permissions the user the group the date of course and then the file name and it's very colorful and each column of the permissions the read write execute permissions has a different color and it's a lot of people ask me hey how do you get ls to look like that well that's not actually ls that is actually a program called exa exa is a rust replacement program for the standard ls command if i ran exa you know this is what exa looks like without any flags typically i give it a whole bunch of flags i think uh it accepts the l and the a flags just like ls so that's a exa with the dash la flags i also add a few other options to it i have it grouped the directories before the files and a lot of other things and then i just simply created an alias in my shell config file so that ls actually is just the exa command with my preferred flags let me clear the screen there so starship and exa and both of those are very easy to get and to install starship for those of you that want the starship prompt again it's available in for bash zsh and fish and for those of you that are on arch i believe starship prompt is available in the aur for those of you that want to install exa exa i believe is also available in the aur or you could always install it with cargo which is the rust package manager if you will just do a cargo install exa the next rust program i want to talk about is a pretty common one most of you guys know about it's bat bat is uh like cat but it's rewritten in rust so it's basically somebody wanted to practice you know learning how to program in russ so what they did is they just rewrote the cat command so let me do cat so you guys can see cad on my bash rc here you it just you know spits out everything that is in my bash rc it spits out all the lines it just you know outputs everything in the file now let me run that same command except let's do a bat dot bash rc and you see this is a much better version of cat so not only has it been rewritten in a different programming language they actually added some really neat functionalities such as the line numbers they also added of course syntax highlighting the other neat thing about bat as opposed to cat when i headed my bash rc of course it spit the whole thing out and we ended up at the very end of the lengthy bash rc file here bad actually starts at the top of the file right and you just go down by hitting the space bar very similar to how you do with the uh standard less command in the shell and of course q to quit out of bat so bet is a really really neat cat replacement and quite frankly uh i i don't see why everybody just wouldn't replace cat with bad a matter of fact i probably would just create an alias so anytime i want to invoke the cat command i would probably just use bat instead another gnu core util that's been rewritten in rust is the standard grip command well in rust we have rip grip so rip grip i believe is available in the standard arch repositories or it may be a aur package i can't remember but to run rip grip after you have it installed is rg so just do a rg and then do a search for something i'll just go with the suggestion here so i'm going to search for the word alias in my bash rc because i know my bash rc has many lines that include the word alias of course and of course it just spits them out and the really cool thing about rip grip is by default we didn't have to give it any flags or options by default rip grip gives you the line numbers and it also gives you this highlighting so it actually highlights the string that you were searching for so for those of you that are not familiar with the rip grip program let me see if i can do a tldr on rip grip it may not have a tldr page does it have a man page for rip grip just a standard man page no it doesn't does it have a dash dash help flag it actually does not uh maybe i needed to do rg instead of rip grip maybe that's where i would get the help information ah there it is rip grip has a number of flags and options similar to the standard grip command it just does some things better it has some better defaults of course by already including the line numbers and the highlighting of the search term and you're going to find that actually with a lot of these rust programs they typically add syntax highlighting and coloring and things i mean we saw that with the bet command we saw that with the rip grip command let's try the standard gnu find command it's another core util but if you don't like the standard find command which has a ton of options and a ton of flags and can be kind of complicated to learn everything about the find command well there is a rust replacement called fd so let's uh do a find here in my home directory and i know we have of course a bash rc file in my home directory so let's just search for it nothing was returned well let's just search for bash and see what gets returned and this does a recursive search so it's basically does the find command recursively from my home directory and it searches for the string bash and it found several different things that had bash in the name and of course if you didn't want to search recursively in the directory you're in of course you could specify a directory so i mean i could search for something like like a search for the string w get in the directorydistrotube.com because i know that it's going to find something in that directory because i already saw it in the search results from the first command we ran and there you go we just did an fd and it found this file here that included the string wget and it searched in distrotube.com recursively fd is a really neat replacement because again the find command let me do a man on find and i'm going to page down this is the man page freaking new find right it's it's gigantic right and now let me see if does uh fd have a man page man fd and let me page down one two three four five six seven you know seven times i had the page down instead of about 50 like i had to do so it's a little simpler command and it's much more intuitive you know as far as flags and options it does it have a tl dr tldr and let's do fd and here's the tldr for fd and it's very simple fd pattern and then the path to the directory is typically what you'd use of course you can do some regex with it as well and you can also execute commands on the pattern you're searching for you as you can see fd pattern and then give it the exec flag and a command to run on all the search results returned so find this pattern so find this pattern in the this directory and all the files that have that pattern then i want you to run this command on it that is a really powerful command and i certainly would have a use for that on occasion another neat rus program is tokay at least i think that's how you pronounce it t-o-k-e-i and this basically tells you for those of you that do any kind of programming and development or you're just curious about you know what kind of programming languages are in use in a directory so we're in my home directory and when i run it in my home directory tokay it just tells me all the files that are written in the various programming languages that it knows about so that's what tokay is it's actually there's not much else to it i mean is there a man page for tokay there isn't but let me do dash dash help and see if that will give us some flags yeah it has really just a handful of flags and options let me clear the screen here uh one last rust replacement program if you will everybody knows about the standard ps command for linux so it'll give you all the processes so if i did a ps and give it a dash aux here you know we can take a look at everything all the processes that are going on on my system let me clear the screen well there is a rust replacement prox here is prox with no other arguments and uh it's very similar to like the cat command yeah as far as you know if you want to view the whole thing just hit the space bar you know it has that less kind of feel to it where you you want to go down line by line you can just hit the spacebar of course the scroll wheel works as well it also has the line numbers and this is just a nicer ps command right prox is just a better command than ps and if you wanted to search you really don't have to give it any flags or anything i think i could just do if i wanted to do procs and again i know i'm running the alacrity terminal so i could look for that process running i can look for a process called alacrity and you can give it a and or an or for example if i wanted to look for a process that included alacrity and the word fish because the fish shell is running in alacrity how do i know that well because i ran the command before so this will look for all the processes that have alacrity and fish you know as part of the process name if i wanted to do a or and then i would give it dash o for or and i could look for you know alacrity or systemd because those will be separate processes so there are several systemd processes running and of course the one alacrity process you know this one terminal i have open at the moment so those are seven or eight rust programs that i think are really neat and i think all of you guys should check those out right so what did we talk about today we talked about the starship prompt exa bat rip grip fd tokay and prox and if you guys don't have those programs installed really install them there's no reason not to install them i know a lot of people are worried about bloat and installing programs especially programs written in languages maybe you don't have other programs written in those languages already on your system you're not heavily invested in a lot of these rust applications get over that yes it's going to install some stuff on your system but most of these rust libraries and all that it has to install are just really small programs anyway you know really small things it's not like it's going to take up a lot of drive space so go ahead because really i think it will eventually get to the point where a lot of these rust programs even though they're kind of alternative programs at the moment i can see a day very soon where most people are using for example rip grip rather than grip that day is coming so i really think you guys owe it to yourselves to start investigating these programs now before i go i need to thank a few special people i need to thank abc dallas devin fran gabe corbinian mitchell economyarts5530 chris chuck david the other david donny dylan gregory lewis paul pickvm scott west and willie they are the producers of the show without these guys this episode about whether rust programs are really just a meme this episode wouldn't have been possible without these guys the show is also brought to you by each and every one of these ladies and gentlemen as well these are all the people that support me over on patreon because the distrotube channel is sponsored by the community if you'd like to support my work look for distrotube over on patreon alright guys peace i wonder when emacs will be rewritten in rust
Info
Channel: DistroTube
Views: 55,073
Rating: 4.9139028 out of 5
Keywords: basic linux commands, linux tutorial, linux command line basics, linux for beginners, rust programming, rust lang, linux terminal, linux basics, linux basics for beginners, linux basics course, rust programming language, linux, gnu linux, gnu utils, gnu coreutils, starship prompt, exa, ripgrep, bat vs cat, find vs fd, procs vs ps, tokei, exa ls, exa ls replacement, bat cat replacement, ripgrep vs grep
Id: dQa9mveTSV4
Channel Id: undefined
Length: 13min 17sec (797 seconds)
Published: Wed Jan 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.