10 Linux Terminal Tips and Tricks to Enhance Your Workflow

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] thank you know I just love learning new things especially when it comes to command line tips and tricks when I did the previous video where I gave you over 15 examples of terminal tricks you guys really seem to like that video so I figured it was time to do a sequel to give you guys even more terminal tips and tricks that you could use to enhance your workflow so what I'm going to do in today's video is give you guys 10 more command line tips and tricks that you can absolutely use and you're going to love these now to be fair the command line is really not required that's a myth but why wouldn't you want to use the command line it's awesome and it's fun it's about to get even more fun as I show you the additional examples that I'm going to go through in this video but before I get into that I'll just need to take a moment to mention the sponsor for today's video lenode I mean wouldn't it be really cool if we had a Cloud Server provider that was all about Linux maybe even a cloud provider that didn't have a billing system that was tedious to learn or even a provider that doesn't have an interface that takes it in entire certification track to learn well actually we already have that we have lenode the node doesn't have any of the problems that I've just mentioned their billing is very simple and easy to understand and their dashboard is also very straightforward so much so that you'll have your very own Linux server up and running in minutes no certification prep book required and speaking of setting up your very own Linux servers if you use the URL that you see on the screen right now it won't even cost you anything to check it out that URL in particular will get you one hundred dollars in free credit towards your new account and that credit will last up to 60 days and considering that lenode has Linux instances that start at just five dollars a month that means you can fit a whole lot of Linux within that credit and lenode is awesome they're the official cloud provider for learn Linux TV because every public-facing website for this Channel all runs on the Node so I really appreciate them sponsoring this video like they've done for many others that's really awesome I just really appreciate that they're an awesome company and I definitely recommend that you check them out anyway with that out of the way let's go ahead and get right into my list of 10 tricks that you can use to boost your workflow on the command line foreign trick that I'm going to show you is all about installing packages but doing so in a much simpler way myself in particular I've installed countless packages on Linux machines so much so that I bet if I had a count of every keystroke it would be a Monumental number but later on I picked up a trick that can condense your distribution's package manager command down to just one letter seriously don't believe me well see for yourself let's go ahead and install tmux wait a minute that was really fast what did I do well actually I ran that Command right there I ran the I command I for install well it works out in my mind anyway but as you can see that was a very simple command I just typed the letter i space and then the name of the package that I actually want to install but how did I set that up and also why didn't I need to use sudo don't you normally need to use sudo to install a package on a Linux distro well actually what you just saw was an illusion or actually an alias aliases allow you to basically create your own commands here's how that works let's say you wanted to create a command called install because you can't remember the name of your distros package manager I know that's not the greatest example but just keep following along you'll like this one anyway to set up an alias to create your very own command what you'll do is type the word Alias into the terminal and then after that you type the name of the Alias or whatever you want it to be called so I could just simply type install that's a pretty cool name for an install command and we're going to set that equal to Something in double quotes and what I'm going to set that equal to is sudo apt install because I'm running on Ubuntu in my case so I'll press enter and now what I could do is type install and then tmux but I've already installed it as you've just seen me do but now you should understand exactly what I did I created an alias and in my case I called it I and to shorten the command what I did was I just gave it a shorter name you just saw me create an alias called install but all I had to do was create an alias called I you can name your Alias whatever you want and I think I is as simple as it gets so with this Alias anytime I type I and then press enter what I'm actually executing in the terminal is sudo apt install space and even if you're not on Ubuntu this will still work you could be on Arch Linux sentos it doesn't matter whatever your distros package manager command happens to be you can simply create an alias around that command and from that point forward you can simply type I space and the package name and then the package installs just like that and you know what here's another example what I'm going to do is create another alias in this one I'm going to Simply name e e for editor so you could probably already understand the direction that I'm going with this anyway right here inside the double quotes we just type whatever editor we plan on using whatever your favorite happens to be so if you like Nano for example you could just set the E Alias to Nano just like that and then when you want to edit a text file you just simply Type e and then the name of the file that you want to edit so I'll press enter and check it out now I'm editing a file the file that I gave is an argument and I didn't even need to type out the name of the editor itself I just simply typed e and that was it that's all I had to do now one potential problem here is that as soon as I close my terminal window the aliases will drop they'll be gone and if I want to get those back unfortunately I'm going to have to create them all all over again and I don't know about you but that doesn't sound very fun but thankfully there's a quick and easy workaround to make sure that those aliases are automatically recreated every time we open a new terminal window so what I'll do is type e for the editor Alias I mean I didn't close my terminal window yet I still have it and the file that I want to edit is actually in my home directory and the name of that file is dot bashrc just like that that's actually the config file for Bash so let's open that up and then we can go all the way to the very bottom of this file depending on which distro you are using the default bash RC might be completely different than what you're seeing here but what's inside the file doesn't actually matter right now all we want to do is just add our aliases right here so for example what we could do is just type out the command that we used originally to create the alias in the first place but we're adding it inside this file instead so again that was alias and then the name or what you want the Alias to be called in this case I'll just use I again and I'll set that equal to sudo apt install space and then I'll close the double quotes and I'll save the file and exit out now every single time I open a new terminal window or a new session inside the server that I'm actually connected to right now and that Alias is going to be recreated for me it's always going to be there and that's the way I like it so let me know in the comments down below if you have any really cool aliases that you think people should know about I'd be interested to see what you guys come up with all right so it's time for my second terminal trick and this one has to do with weather I mean weather is something that we talk about a lot here in Michigan because our weather is just so weird I mean one moment it's you know July it's super hot and we're wearing shorts and enjoying some time at the beach and the next thing you know it's winter and we're dealing with thunder snow and yeah thunder snow is a thing the weather's weird so here in Michigan we're always checking the weather but what does weather have to do with terminal tricks well actually you could check the weather right in your terminal I'll show you so let's go ahead and see what the weather forecast is for today I'll just type wtr short for weather and then I'll press enter wait a minute it's actually showing me the weather forecast for my area right now it's actually looking like the weather is quite nice and we also see a forecast for days that are coming up so yeah I was absolutely able to check the weather for my particular location but how did I do that well if you guessed that the wtr command is an alias then you guessed correctly what we can do to find out what an alias contains is run the Alias command and then we type the name of the Alias that we want to check in this case I created wtr now notice that I'm not setting it to be equal to something I've already done that so if I don't include an equal sign what it's going to do instead of creating an alias is show me what the current one is actually doing and there it is I'm running curl space wttr.in now curl is actually a utility you could use to transfer information from a URL so that's what that's doing but what does wttr.in if you're under the impression that that's probably a domain well you're right that's actually a legit domain you can actually type that domain right into your browser and it'll give you the forecast but since that particular website is terminal friendly if I pull the contents of that website then it's going to display it right in the terminal and it actually takes a look at my location as well which is really helpful I don't even need to give it any arguments I simply type wtr and the weather shows up in my terminal how cool is that now my third terminal trick is actually really really simple and it barely even deserves its own number on this list but it is very useful and it is something that you'll run into every now and then now I don't currently have the problem going on right now but have you ever used a terminal and then notice that there's these junk characters or maybe sizing issues font issues or just something weird going on now if you've ever experienced that problem what you may have done is close out your terminal window and reopen it and to be fair that does actually fix it but you don't have to close your terminal window just to fix that problem if it happens what you could do instead is simply type reset just like that and when I press enter well the prompt went away and it came back what exactly happened well unlike what the name of that command the reset command would imply that wasn't a full reset but it does reset enough of your session to fix those terminal issues that sometimes happen so if you ever run into that then the solution is to Simply run the reset command and that's about it aren't these terminal tricks a lot of fun I have a bunch more to show you guys and I can't wait to get right into it so let's check out the next terminal trick that I want to show you guys hey Dad you got a minute um could you hold on a few minutes I'm actually recording a video right now yeah but I'm trying to turn in a book report and the internet's being really slow oh really okay uh no problem I'll take a look at it and I'll let you know what I find so apparently the internet is actually slowing down so I just need to run a quick speed test to find out if it's actually a problem with my provider or if maybe something else is going on so let's run a speed test I'll just run the St command short for Speed Test clever I know right but let's see what it does well the speed looks good to me that's about what I'd expect to receive from a speed test so it doesn't appear like my internet provider is the problem and considering that my ISP is Comcast I pretty much always assume they're the problem I think this is the one time where Comcast is not the culprit so it looks like the internet's fine um I'm not really sure what it is but maybe there's some interference in your room or something you might want to just check and make sure there's nothing in front of the access point okay so how the heck did I run a speed test from my terminal well let's take a look at that alias I created the St Alias before I started recording the video and here's what that's set to now that's actually a long command I'll have a blog post linked Down Below in the description and inside there we'll have all the commands that I'm using inside this video but what's basically going on here is the St Alias is running curl and the argument dash s it's running that against a URL that's a python script and then it's redirecting that into python 3. now on your end depending on the distribution that you're using you might have to change the name of python3 to just python each distribution names their python binaries differently but anyway at the very end of the command I have a single trailing hyphen as well you definitely want to make sure that that's included now also note that I used single quotes instead of double quotes but you know what it doesn't really matter in this case it does pretty much the same thing and this particular python script lives in GitHub as you can see right here it's coming from a GitHub URL and that's just something that's maintained there in the repository that I'm pulling down but all I'm doing is pull pulling down that one file and redirecting it into python that's all there is to it so with this particular Alias what I'm able to do is actually run a real speed test that's awesome so the next thing that I'm going to show you guys how to do is pull a summary of some information about the server that you're connecting to in fact we have a dedicated command that allows you to do exactly that there's the Neo fetch command and no I didn't create this as an alias this is actually the command that you'll need to enter to pull this information but you will need to install this package so what you'll need to do first is use your distributions package manager to make sure that this package is installed in my case on Ubuntu that's simply sudo apt install and then neofetch I don't need to install it because I already have it so let's run it check that out it shows me an ASCII logo for my distribution it lets you know the specific version of the distribution that I'm running the host this is a virtual machine running in proxmox it also gives me the kernel the number of hours of uptime how many packages are installed this is just so cool it's very useful but what I like is to have this actually show up when I SSH into a server for the first time I mean it's cool to run the neofetch command manually there's nothing wrong with that but I would prefer to have that show up automatically so one way that we can accomplish that is by editing the dot bashrc file the same file that we edited earlier to make aliases stay present on the system we could just use a text editor like Nano for example and again we'll edit the dot bash or C file we can go all the way down to the very end it really doesn't matter but I like to create everything at the end just to make it simpler and here we have the Alias that we've created earlier so what I'll do is just simply type neofetch right there that's it let's save the file and then I'll hold Ctrl and press D to disconnect from the server and now I'm actually back to my local command prompt here on my laptop and as an aside you're actually seeing my real bash problem now that I'm on my local computer and I will be showing you how to set up that particular bash prompt later in this video but anyway what I want to do is reconnect to that test server that I was using for the recording of this video I added the Neo fetch command in the dot bashrc file so let's see if it comes up automatically and it does check that out how cool is that so all you have to do is install neofetch add it to your dot bashrc file and then the next time you log into that server then it's going to give you some helpful information regarding that server we're moving right through these terminal tricks we're about halfway done now but the best is yet to come now the next one is something that you guys have been asking me for for quite a while now you guys want to know how I set up my bash prompt and you even caught a glimpse of it in the previous section but how exactly did I set that up well what I'm going to do right now is show you exactly that so here on my test server what I'm going to do is reproduce my bash prompt to show you guys how to set it up so if you want to clone my bash prompt then this section is for you so what we're going to do is create a brand new config file so we'll just use a text editor and the file that we'll create is going to be in our home directory and what I'll do is name it dot bash underscore prompt just like that and since the file doesn't exist we're going to be creating this from scratch but I'm going to warn you this is going to look extremely confusing if you aren't already familiar with how the PS1 prompt in bash Works you're going to see a bunch of weird characters all over the screen so what I'm going to do is copy and paste The Bash prompt config directly into this file and I recommend that you do the same thing because as many characters as there's going to be it's very easy to have a typo and here it is this is the actual configuration for my bash prompt now like I mentioned it's extremely confusing especially for those of you that have never worked with this before so what I recommend is that you copy it directly from the blog post for this video that way you don't have to worry about there being any typos and of course the text is wrapping off to the right side here on the last line so as we can see there's a lot more config here than what actually shows up in the default Nano window but anyway what I recommend you do again is just copy it from the blog post and it makes it that much easier now what I normally like to do is explain everything that I'm doing but I think this one kind of goes into a direction that would be really hard to explain in this video without it being its own video I don't know if I'm going to create an entire video about customizing The Bash prompt let me know if you want to see that in the comments down below but considering that I have the config right here I'll just go ahead and let you guys have this config and if you want to clone my bash prompt well this is how you do it anyway I'll save the file and there's one more change that we have to make so what I'll do is also edit the dot bashrc file as well because if we don't tell it to load the file that we've just created then bash has no idea that that file even exists now the first thing we're going to do in this file is take a look through it and find where the current bash prompt is actually being set what we're going to do is comment that out so we'll just scroll through and we're looking for PS1 that's actually what the bash prompt is called it's the PS1 prompt and right here we have it so what I'm going to do is just comment out everything that pertains to setting the bash prompt and that'll make sure that this doesn't conflict with what we're going to add at the end of the file and next I'll just scroll down to the very end of the file and what I'll do is type source and then I'll type the path to that bash prompt file that we've just created and there it is so I'll save the file Alex it out and then I'll clear the screen and the next time I log into this particular server my bash prompt will be my normal bash prompt now to cheat the system a little bit what I'll do is type exec and then bash to get a brand new bash session without logging out and logging in again and take a look at that neofet shows up from the previous tip where I showed you guys how to set up neofetch but at the very end we have my actual bash prompt so again if you guys wanted to clone my bash prompt well now you can because you have access to the code that I use to create the same one that I use every day but I do feel that some explanation of what I have going on in my bash prompt is in order now the first thing you'll notice is that it shows the time but that's actually not a real-time clock at all in fact that's not the real time but that actually is is the time that the previous command actually finished so if I was to run the ls command for example we can see that that command finished at 1842.39 now if I run another command same thing it's showing me the time that that particular command has finished why is that helpful well as you scroll through the scroll back in your terminal this will actually show you the times that the commands finished which gives you basically an estimated time about when you ran the command so if you're looking for a command that you ran during a specific time in your session when you scroll through the history you're going to see the time because it's right there in the bash prompt and believe me it might not sound useful to some of you but just give it a shot and you'll actually realize just how useful having the time in your bash prompt happens to be and if you're like me you won't want to live without it but that's not all that this particular bash prompt does now pay attention to the next section there's actually three sections here in Brackets by the way the first one was the clock the second one is the number zero in blue what the heck is that well check this out what I'm going to do is open up a config file let's say for example that I want to edit the SSH server the SSH server config and you don't have to follow along with this I'm just giving you guys an example so let's just say I want to edit that file which is slash Etsy SSH sshd underscore config and what you're editing or doing really doesn't matter here I'm just giving you an example anyway I'll press enter now let's say for example I'm editing this file right here and then somebody Taps me on the shoulder they want me to work on something else maybe there's a server issue that I need to pay attention to now what I don't want to do is lose the work that I'm doing inside this text editor what I also don't want to do is open up another terminal window because the next thing you know I'll have a bunch of them and what I do in practice is I will actually minimize what I'm working on to do something else I've gone over this in previous videos among them the actual video that this video is a sequel to I actually talked about it in that video so I'm just summarizing it here but what I could do is hold Ctrl and press Z and that background's the process it's kind of like minimizing not completely the same thing but it's close enough now notice that the number which was previously zero is now one what that's doing is it's showing me the number of background jobs that I have so that way when I go to log out of a server and if I see that there's a number there that's not zero then I know that I have some things in the background that I should probably bring back save the file or whatever it is that I have to do and then when that number gets back to zero I can log out now as an aside if I want to get back something that I've minimized or backgrounded I just type FG for foreground and it comes back and again Ctrl Z is what sent it to the background in the first place so what I could be doing for example is editing another file and I'm just going to bring up the hostname file because well I guess it's something and I'll minimize that too now the number is 2. now if I type jobs it gives me a list of the jobs that I have in the background if I want to foreground something in particular I could type FG and then the job number and that's what gets it back onto the screen and then when I want to log out for the day I close out of whatever I'm working on now we're down to one background job since we only have one I don't need to give it a number so I just typed FG let's close out of that one and now I'm back down to zero so that's why I find the job count to be so helpful because I always know how many things I've backgrounded and then I could do some cleanup when my session is about to end now the next thing that I like about this particular prompt is that the directory is shown in blue toward the end we see the host name and then we see the directory now at first it might not look all that exciting I mean pretty much every default bash prompt shows the directory that you're working inside of right I mean that's just how it works now watch what happens when I change directories randomly I'm just going to go into the varlog directory now it's showing the entire directory most of the bash prompts will only show you the actual directory you're in not the full path just the directory that you're in so in this case it would just show log instead of the full path but I have mine configured to show the full path why do I like that so much well let's assume that I'm inside of a subdirectory that's five directories deep most of the bash prompts out there they default to have everything on the same line so when you go to type a command you're typing it on the same line that the directory is printed on if you're very deep inside a subdirectory tree then that line could get quite long but in my case I have the cursor on the line below it which leaves the entire line above it to show the directory and it gives me a lot more room I really don't run into situations where I run out of room at all commands are typed on its own line I have the bash prompt basically as a status bar of sorts on the line above where I type the command and from me it works out well so consider giving my bash prompt a shot it might come in handy now we're up to tip number seven and this time around what I'm going to do is teach you guys how to cheat well actually I'm going to show you guys how to check cheat sheets and these cheat sheets will contain all kinds of useful information when it comes to Linux commands does that sound familiar well if you are familiar with Man pages then everything I'm telling you so far Probably sounds like I'm about to show you how to check Man pages and while Man pages are useful that's not what I'm going to show you but for those of you that haven't seen Man pages yet I'll show you a quick man page right now man is short for manual and let's say for example that I might want to view the man page for the rsync command now Man pages are awesome they are definitely a great resource for finding information about any of the commands that you can enter on the Linux command line but if you're the type of person that gets easily overwhelmed then Man pages might be well overwhelming let's check out another method that we can use to pull information about a command so what I'm going to do is use Curl and I'm going to point it to a very special URL specifically cheat.sh after the trailing slash here we could type the name of a command that we want to view a cheat sheet regarding so I was using rsync as an example so I'll type that now take a look at this how cool is this this information right here is condensed it's easy to read it's simple and it's right to the point this is definitely something that I recommend you guys remember because this information is extremely helpful and like I said it's just a lot easier to read so I definitely recommend that you jot this down in your notes because cheat.sh is very useful but in addition to rsync we could type well other commands here so what I'll do is replace our sync with I don't know let's try LS and here we have some examples regarding LS and that's awesome but I'll leave it up to you guys to experiment with this see if you could pull up some other cheat sheets for commands that you use on a regular basis and as an aside cheat.sh is actually a real URL you can go there in your browser and view the same pages so while this is technically a terminal tip cheat.sh is actually developed to look good in a terminal but well if you have a web browser in front of you and you don't have a terminal handy you can still get information via cheat.sh so next what I'm going to do is teach you guys how to get your fortune told seriously and for this what we're going to need to do is install another package so in the case of Ubuntu and Debian what I'll do is run sudo apt and then install and the name of the package for this particular tip is Fortune mod so I'll press enter and now it's installed but what can we actually do with Fortune mod well to be completely honest with you guys not a whole lot this is actually the most useless tip in this entire list and it offers you no value whatsoever at least when it comes to your productivity so what does it actually do then well I'll run it and then you'll see for yourself even though the package was named Fortune mod we actually only need to run the fortune command and it's telling me that a vivid and creative mind characterizes me and considering that I'm you know creating a video right about now this is surprisingly accurate but as a complete coincidence to be fair what this command does is it just gives you a random message that it pulls from its dictionary of messages that it can show you so even though the name of the package is Fortune mod it can indeed read you your fortune but there's different categories of messages that it reads out to you so it's not always going to be your fortune that's being told it might just show you something funny maybe something encouraging and also possibly something insulting so here's the thing neither myself or learn Linux TV accepts any responsibility for anything that the fortune command or the fortune mod package might show you in your terminal the thing is I haven't had enough time to go through the source code and look through every single message that it might show you so basically this particular command is limited for those of you that have a very specific sense of humor and if you're among those people then you know who you are but if you do like the fortune command then what you can do is pair it with the watch command and what that'll end up giving you is a brand new message every two seconds and as you see it just keeps going and going and going it can be a lot of fun but again I'll leave it up to you to decide whether this is right for you and if you really want to go crazy with this you could actually just consider adding this to your dot bashrc file and get a new quote every time you log into your server so the fortune command was certainly very interesting but let's return to useful tips and tricks unlike the previous one which was just there for amusement and actually I'm going to show you the ultimate productivity hack on the Linux command line something that will possibly transform your workflow more than anything else but before I actually describe it I'm going to show you a hypothetical scenario that'll probably make it very obvious why this is so cool and that trick is tmux using tmux will add quite a bit of benefit to your workflow and I'll show you an example of that on the screen right now I'm actually working on a python script now to be fair this is a very old script and I'm only showing it here just to have an example to show you but let's just say for example I'm working on a python script maybe something like the one that you're seeing right here but what happens when someone comes over to my desk or something like that and asked me to help them out with something now a few times already I showed you guys how to minimize your workflow and switch to something else and that was definitely a great way to do it but this is an even better way to do it so let's say that I have to context switch for one reason or another and I need to take a break from this particular python script so I'll just switch to another project and I actually have a few different projects that I'm working on here if I arrow through the projects that I have open what you'll see is a preview in the bottom half of the terminal window of what's actually going on inside that session so maybe I want to get back to ansible because I have something to do there so I have an ansible session open so I'll press enter on that and now I'm actually editing a play that's going to be used with my ansible configuration this one in particular is installing The Gnome web web browser and I have a whole video series about ansible so I'm not going to get into what exactly I'm doing here because if you want to learn ansible I got you covered I have a whole playlist that's full of ansible videos and you can check out those videos to learn all about ansible but the point is by using tmux my workflow is incredibly enhanced and another example of that is the ability to create tabs so now I have another terminal window here and I could just go through the different tabs that I have open and I could also scroll through the various projects that I have open and that's really awesome and another thing that tmux allows me to do is disconnect from whatever I'm working on completely and go back to the terminal and then I can run tmux LS to show a list of sessions even without tmux being open and then I could use t-box a dash T and then the name of the session that I want to resume and then I'm right back in that session as if I've never left that session actually I never really left this session at all I might have detached from it but it never changed state in the background it was still there and its date was maintained that's one of the many things that tmux allows you to do now to be fair a lot of terminal emulators out there offer you the ability to create tabs and some of them even allow you to create splits in the window as well which is what I'm doing here but the beauty of tmux is that it doesn't require a specific terminal emulator and it also doesn't even require that you have a graphical user interface at all and that portability is what in my opinion makes tmux the killer app for your Linux terminal and it's not even just specific to Linux I mean for those of you that are running Mac OS because I know at least some of you are using a Mac you could run tmux on Mac as well if you're using WSL well just apt install tmux and just start using it so tmux looks really awesome doesn't it so how do you use it well actually I have a entire tutorial series all about tmux it'll teach you everything you need to know so I'm not going to go through that in this video but if you are interested I'll leave a card for the first video in that Series right about here and you can watch that video in the subsequent videos will come after it to learn all about tmux and I recommend that you do because tmux is awesome now the next tip that I'm going to show you guys is how to open files and programs from the Linux terminal now when I say programs in this context I'm not talking about command line apps I'm referring to desktop apps so for example let's say that I wanted to open audacity what I could do is open up the application menu here on my distribution I could go through the menu I could find audacity probably in the multimedia section and then open it up but that was a lot of steps watch how fast this is and now audacity is open on my screen like you can see here I was able to open that app right for my terminal now of course any application that you might want to open needs to be installed otherwise how can you open something that's not present but even though I'm using a desktop distribution here I'm still able to use the terminal to do everything including opening an app which you've just seen me do so I'll just go ahead and close out of this right here and I'm back to the terminal now one downside to this particular approach is that you'll see a lot of information in the terminal and it also makes it really hard to use your terminal if you have your terminal open alongside an application however I am going to show you how to work around that in just a moment but there's another thing that I want to show you guys first before we get to that and the next part of this particular trick is the xdg open command like you see here and this command is very useful for those of you that are running a desktop distribution of Linux if Linux is your daily driver you're going to love this one but you can use xdg open 4 is for opening files but specifically what it's going to do is open the file in the default application that is registered for that file type and as an example what I'm going to do is show you a PDF file of a draft for my new Ubuntu book that's coming out pretty soon that's already out right now by the time you're seeing this video but this is actually a real project that I'm working on right now but you could use this against any file type that you have on your file system that is recognized by your distribution so in my projects directory I have a writing directory inside there I have a directory for the latest version of my book and then under chapters I have a folder for each chapter so I'll go into chapter one and there's the file so what I'll do is press enter and Watch What Happens and as you can see here the file opened and not only did the file open it opened in the proper application it opened an apdf viewer so now that I have the file open I can read through it I could create some notes or annotations if I needed to if I found any errors or anything like that and then when I'm done I just email my publisher and let them know but I was able to do that right here from the terminal which is awesome but again we're dealing with this junk information right here which I don't know it just looks bad to me it's useful information but it's probably too much information most of the time let's see how we can go ahead and fix this particular problem so I'll just open up tmux and I'll name the session and I have all the instructions for how to do this in my tmux series I'll just give this particular session a name I'll just call it app launcher I think that works just fine and then what I'll do is create another session so I disconnected from that one I'll create a new one then I'll name this one work I guess because I don't know maybe I just want to get something done inside this terminal window anyway what I could do now is switch to the other session and go to the app launcher I'll type audacity and then Ampersand you have to include the Ampersand at the end just letting you know I forgot to mention that earlier that background is the process but even though it backgrounds the process in the terminal it still shows up on the screen and then I could tab back to the terminal window here and then switch sessions over to my work session and now I don't have to worry about all those junk characters showing up while I'm working because I have all of those characters in the app launcher session and that's a session that I'll completely ignore unless I actually want to launch something now one thing that you guys should know is if you close the terminal window or the session that you launched the application from the application will close and to show you I'll simulate that right now so I'll just go back to my app launcher session and I'll just close it and notice that audacity went away immediately when I killed that session and again the same thing is true if you don't use tmux and you use a straight terminal session if you close your terminal window all of the applications that you've run from that window will also close but that is actually easily solved so what I'll do is just launch audacity again and I'm not really sure why I'm thinking of audacity enough to use it as an example maybe because I know I have to edit some of the audio for this video after I'm done recording but anyway audacity is now running and what I'm going to do is close this terminal window but I'm going to close it by holding Ctrl and pressing d but the window is actually stuck open that's fine I'll just close it right now and the app stayed open it didn't close now when you hold Ctrl and press D on a terminal it actually disconnects you but to keep it simple control D does so in a way that won't cause all of the applications to close they'll stay open and the reason why that works is because we added an ampersand to the end of the command which backgrounds the process that launched that particular application and then when we disconnect from the terminal by holding Ctrl and pressing D then we close it in such a way that the application is no longer reliant on that terminal window so the Ampersand and control D together is what makes that possible by using this approach right here you actually don't even need an application menu anymore well as long as you already know the name of the application that you want to launch but it's a cool tip especially for those of you that want to launch something in a pinch and you're already in a terminal then why not just launch your application from the terminal and you know what that brings us to the end of this particular video I had a ton of fun making this video and coming up with these particular tricks for you guys now if you found these tips helpful then please consider clicking that like button that lets YouTube know that there really does need to be more Linux related content on YouTube there's actually not even enough of that and it's really sad so click the like button if you like this video Let's float Linux to the top of the charts on YouTube that would be really cool if nothing else it would really help me out and if you haven't already subscribed to my channel then feel free to do so I release new content every single week anyway thanks again for watching I really appreciate it and I'll see you in the next video [Music] thank you [Music]
Info
Channel: Learn Linux TV
Views: 92,307
Rating: undefined out of 5
Keywords: Linux, gnu/linux, LearnLinuxTV, Learn Linux TV, LearnLinux.TV, Learn Linux, Linux Training, Linux Tutorials, Terminal, Linux Terminal, Linux Commands, Linux Tips, Linux Tricks, linux commands, linux tutorial, linux for beginners 2022, linux terminal, linux command line, linux tricks, linux terminal tricks, command line, linux commands for beginners, linux terminal guide, Cloud, Linux Server, Cloud Server, DevOps, Ubuntu, neofetch, aliases, bash aliases, bash, bash shell
Id: nkvW0-bVXPc
Channel Id: undefined
Length: 44min 16sec (2656 seconds)
Published: Tue Nov 01 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.