 One of my favorite parts about using the terminal is that aliases are a thing now if you don't know what an alias is basically The idea is to create a shortcut for another command So when you execute an alias it translates into something else Basically something that's supposed to be longer Or maybe it's harder to type or harder to remember or whatever it happens to be so what I wanted to do today Was two things first show you how to make an alias. It's really simple a Second thing that I wanted to do is kind of go through some of my favorite aliases so these are some of the aliases that I've either created or stolen from other people over the years and Maybe you'll find a few of them here that you're interested in putting in your files So let's go ahead and show you what an alias is and then go through some of my favorites So there are actually two types of aliases that you can create the first one that I'm going to show you is a Session-only alias basically what this will do is just create an alias for The length of time that this terminal is open once you've closed the terminal it will be gone now The reason why this might be useful is because you wanted wanted to create an alias that just exists here And you know you're never gonna need it again, but you're gonna need it several times during this terminal session It's just a way of kind of creating one, but you don't want it to clutter up your bash RC files So how do you how do you do this? It's the easiest way to do it and the best way is to do this alias like so and then the Shortcut that you want to be able to use in order to to execute the command that you're going to create So so let's just say we wanted to create one for cd-ing into my music directory So I could do Mu for music and then equals and then either double quotes or single quotes It doesn't really matter and then you want to do the command and then a space and then for me It's going to be slash hub slash stuff slash media and Then music I'm gonna have to go back and fix that so we're gonna I don't know why it was auto-correcting like so But it's fine. So if I hit enter now like this, I Should get no output whatsoever. So that means it was properly input So if I now use emu what it should do if I enter it should cd me into that directory So I didn't have to actually type it out. That's what an alias does It is basically auto expanding from emu into that command and it can be for any command that you want It could be a cd command a move command Whatever happens to be if you create an alias for it it can exist and it can be anything. So that's a session only alias How would you create one that is more permanent one that would last for as long as you have it in your files? Well, the answer to that question is a little bit more complicated because it's gonna depend on what shell you're using So I'm using zsh all of my aliases are in an actual text file and then I source that from my dot zsh Hrc, so I'm gonna them into that zsh rc here and All my aliases are done something like this line here now You don't have to do it this way you can put all of your aliases right in your zsh rc Now if you are using a bash or see or if you're using bash, I should say Yours would all go in your bash rc and it's the exact same process just the name of the files difference So I could if I wanted to put that same alias in here. So I get alias equals or emu Equals and then cd and slash hub like so stuff media music click so and then if I were to then Restart my computer or whatever or just close this session of terminal that alias would exist until I deleted that line And that's all you have to do in order to create a alias that lasts for as long as you want And like you said if you're using zsh You put it in your zsh rc file if you're using bash you're gonna put it in your bash rc file Both of those should be located in your home directory unless you've moved them like I have And if you've moved them like I have then you should know where they're at obviously because you move them So really that's all there is to it when it comes to actually creating an alias So let's get to the meat and potatoes of the video and I will show you some of my favorite aliases So this is my aliases.txt file and like I said all of these are sourced into my dot zsh rc file So they're all executed every time zsh rc is run, which is every time you start the computer So some of my favorite ones. So a lot of these are for Times when I mistype something so for example this one here if I were to mistype pwd It would automatically correct and do the right command I don't do it that often obviously But it is definitely something that I've done in the FET past this one here I do all the time if you forget to put a space between CD dot dot Yeah, I have it set so that I actually correct in this CD space dot dot I do that all the time by forgetting to hit the space bar. So that's one that I use These are probably my two most used commands even though they're not appropriately in the right section Basically, this one here uninstall something. So if I were to uninstall Say an application that I had installed be previously that I no longer need So I just do on in and then the name of the program that I want to install the package that I want to uninstall Very easy. I also use install all the time basically It just prevents me from having to type in pseudo DNF install all the time. I just do install Discord or whatever happens to be and it just installs it instead of me having to type all that stuff out So those are my problem. Those are probably my two most used aliases all the time This one here is actually pretty new this one here at the top and I think this is pretty clever because a lot of time Is when you are in a terminal, you want to know what the the work the current working directory is so let's say you've been working in the terminal for a while and You need to know where you're at or you don't have a prompt or whatever that tells you where you're at or whatever the situation is You want to know what the current working directory happens to be so you do PWD and it will print the working directory that you're in But a lot of times I don't actually need to know what working directory I'm in I Want to copy that thing to the clipboard so that I can use the path of the working directory somewhere else So either you know, I'm writing something or I'm scripting or whatever I need to use the actual path of the place where I'm in I don't want to have to go to my mouse Highlight that copy it. No instead what I've done is just I've aliased PWD so that every time it's run It will print the working directory, but it will also put that into X clip. Now. I'm looking at this now I'm probably could solve that just by piping it automatically into this without the double and so I'll fix that later But the idea here is that every time I run PWD the clipboard will also have a copy of the current working directory Also, so that I can then paste it wherever I need to be if I don't need it from just wanting the working directory I can just ignore the clipboard part of it. It doesn't hurt anything But if I do need it, it's automatically saved to the clipboard. I like that a lot Like I said, I can simplify that now that I look at it I don't know why I did that way I was being dumb But anyways, that is a really cool alias that I just added. It's really cool As I can say it's really cool to say that a lot. I don't know why I said it that way Anyways, I also have these here for get so I can do get add get push and get commit just by using GA GP and GM I'm pretty sure I stole those from arco several. These are actually from arco So if they look familiar just know that that's the case Mainly because I didn't really start using aliases until I was using arco So some of them came over from that config file. So Another one that I've done a lot is Any directory that I cd into a lot so the fanfic directory that I have Unfortunately, they're not very well organized. So I also have one for like doing going to my zshrc I into them into that I have one for cd into my scripts folder into my get things folder Into My knit not them which actually can be a knit dot lula now because I don't use the net of them anymore So I can change that Cool. So I have a whole bunch of those where I can Use it just a very short command to cd into several different directories, which is nice I have one here for Image magic, which will allow me to convert images from one place to another That doesn't work on fedora because image magic doesn't work on fedora So I could actually use ffmpeg to do that. I could so I should change that this one here is for any time I do an upgrade so it uses top grade and it will Basically update everything on my system. I just use up and then it will upgrade everything You've seen me use this one here in many of my Videos where I just use v for vim and basically that's an alias for nvim So I don't have to type in that the whole time. I also have this one here for When I want to Extract a tar ball So I just use utar and then the path to the tar ball And I don't have to remember all of the flags that go along with the tar command Because no one remembers what those flags are supposed to do So I just have them here permanently and I just use utar which is way easier to remember I have one for samba to restart my samba server so that if I make changes to smb.com file It will restart it or actually I think that that was originally created When I couldn't get samba to start on its own so I had to run that command at the beginning But that's no longer the case. I have a couple that use term down. So these are for when I do writing And I want to basically write for a certain amount of time and I want a timer so term down is basically A timer for the terminal. I don't have it installed right now. Otherwise, I'd show you basically it it takes the Command here. So in this case 20 minutes and it counts down to zero And then what I've done is it echoes obviously word sprint done But also we'll play a sound in my headphones. So this this is just they Path to a sound that's stored on your computer and it will play in my headphones. So that's really cool as well So let's see here. What else do I have? So these two here are replacements for ls and la Basically, it just uses exa as a replacement for ls. I use exa. So you've probably seen me do this before So if I do an ls here, basically, this is just running exa And that gives me the fancy layout here the colors and the icons. That's exa So if you've ever wondered what that is, that's exa and it's available basically everywhere I also have this one here that I don't use anymore because I have an arcing script But if I were to actually looks at like I haven't even used it since November 2021 Which is I'm honestly surprised that that it's that recent to be honest with you because I've had an arcing script for a long time But I used to run back up like so And it would just be an alias for rsync. So I could actually change this to my other thing now. So that's rsync sh I don't know that that's any easier than just typing arcing sh But if I wanted to use backup, I could probably just change this then to be you Do you like so? I don't know if I already have a b but we'll see if that works later on I also have c for clear because if I've ever wanted to clear terminal So if I go here and I want to clear this terminal There's many different ways you can you can clear you can write clear like so If you can spell it as obviously I can't or you can control l I just do c and it clears the thing It's one. It's one key press less than doing control l And it's not nearly as many as writing the whole word. So that's kind of cool I don't actually don't use it that often. I've just gotten used to control l but It's there So those are my favorite aliases and you've seen basically all the aliases that I have most of them are for easy Moving between different files So if I wanted to go to my you know, my main repo or my pictures folder or my aliases or whatever happens to be Most of them are to move around the file system And that just makes it easier to move around the file system. So I don't have to type out the whole paths So it's just easier that way Honestly, my favorite ones that I use are the install and backup and the The upgrade ones those are the ones that I use most often And it just keeps me from having to do all the fiddly stuff with sudo and dnf and stuff You know and just saves me a whole bunch of times And that's really what aliases are all about is saving you time keeping you from having to type in a whole bunch of extra stuff because you've created these small Basically shortcuts to all of the commands that you use now Here's where I gave you a warning and this warning came to me from my good friend terminal for life He when he had his youtube channel proclaimed loud and wide That you would regret having aliases and it's true If you get used to using v for vim Let's just say and then you go to using a new system That doesn't have that alias You're going to be very upset because it very quickly becomes muscle memory Like I use v for vim on every system that I have And when I either reinstall a distro or I use a new distro or whatever and it doesn't have that alias I'm always typing v for vim even though that alias doesn't exist It's kind of like when the power goes out and I think everybody has done this And when your power goes out and you walk into the bathroom, what's the first thing you do? You switch on the light switch even though you know That the power is gone, right? If you've been without power for like four or five days Like even then the first thing you do no matter what even if it's been a while You flip that light switch even though you know that nothing's gonna happen. It's kind of like that So use aliases with caution. They're they're really really powerful and I don't regret You know using them But just know that there is a pitfall there that if you get used to using the aliases And then you use a system that doesn't have them that can be a problem So just kind of keep that in mind. So In the comment section below, I'd love to hear what your favorite aliases are Probably many of them are going to be like mine, but if you have some really cool ones to share I'd love to hear from you Just be cautious when it comes to using symbols and stuff like that in the comment section below because YouTube likes to delete those kind of comments. So just if your youtube comment gets deleted know that I didn't do it So, uh, that's it for this video. You can follow me on mass designer odyssey those links to be in the video description You can support me on patreon at patreon.com slash the linux cast links for youtube in libera pay will be in the video description as well Thanks to everybody who does support me on patreon youtube. You guys are all Absolutely amazing without you the challenge. There's not be anywhere near where it is right now So thank you so very very much for your support. I truly do appreciate it. You guys are just awesome So thank you so very much for your support. Thanks everybody for watching. I'll see you next time You