What helped me at the beginning was the discovery of "!!". If you forgot "sudo" in front your command you can type "sudo !!" and it adds the last command after the "sudo ".. Saved a lot of nerves :)
Great video, I have been a RHEL, Sun Solaris, AIX Sys Admin off and on for about 17 years now, and I would have to say that I have learned more from your videos and the comments, both good and bad, in the past year (I think I just discovered your videos about five months ago). I have read tons of books and watched more videos on Linux systems admin than I can remember, but not all of it would stick. The way you demonstrate and put things just makes sense. Thank you. I really wasn't an Ubuntu user, mostly because I worked mainly with RHEL since 2005, but I recently started using Ubuntu Mate on one of my personal lab setups and really like it, I haven't bought a Linux admin book in years now because I just wasn't really learning from them. But, because of the way your videos are done, I am going to buy your book because I feel that it would be a far better reference than any of the previous books I have sitting on my shelves, well, with the exception of "Unix and Linux System Administration Handbook", there are so many good nuggets in those books.
Hello, I have a question for you based on your experience. Actually I have worked as a chemical engineer for over 7 years and now planning to change my career into software. What jobs can I look for in the Linux related job market? I have been using several Linux distros on my personal computers since 2006 (Ubuntu, Pardus, Mint, Manjaro, Fedora). I can build some projects with React (JS), Express (Node) and MongoDB + MySQL, and I know how to write some basic stuff with Golang, Java, Python.
@@AlazTetik Even though I have been a systems admin, a lot of the work I have done has been more database related, creating reports for our company and maintaining our internal website which we built with PHP, I worked/work on the back end of the site. I have many other skill sets that were/are necessary to fulfill this position, but to really answer your question, it's really up to what you are looking to get into. I see DevOps as one direction you could go into. I started off in a small software dev company which had been bought out several times until it is now, or it was at least part of one of the largest companies in the world. While I was there I saw people move around constantly from one position to another. I moved from software QA testing to systems administration, where I mainly administered RHEL and Sun Solaris servers, and I performed Oracle database admin tasks. That was before DevOps, I don't know a lot about DevOps, but it seems to be where a person performs many of the things you have been working on along with other task including sever admin work.
Aliases are great. Been using them for a while. I would recommend a naming convention for aliases. I like to capitalize the first letter of each command to indicate it's an alias. I find that very helpful.
good idea - I used "w" for a weather alias and lost the "who" details you get with it - IOW, check that you're not losing another function before you make it permanent. I'm going to make aliases for session settings specific to whatever tasks I'm focused on.
Your solution to not see the verbose warning messages when opening audacity is just to drop them in another terminal session. What's better is to send the output to /dev/null audacity &> /dev/null & &> redirects both stdout and stderr, dev null is a special device where you can send stuff, it's basically a void. The last ampersand just puts the program in the background, it's optional.
@@llortaton2834 Because you have to separate the alias, i.e. "i" with a space from the program to install, i.e. "nano" like this: "i nano". So there is already the requiered space. In contrast "inano" would not work, whether the alias is defined with trailing space or not.
A nice alternative / extension to using aliases is to define your own bash functions. U can also do this in your ~/.bashrc or ~/.bash_aliases file. It has it's advantages, if you not just want to substitute commands for something else, but do some slightly more complicated things. (Like putting our parameter in the middle of a command string...) An example would be a small command to insert a (configurable) horizontal rule into your terminal: function hr() { printf '%*s ' "$(tput cols)" ' ' | tr ' ' $(if [ -n "${1}" ] ; then echo -n ${1} ; else echo -n '-' ; fi ) } try: hr hr '#' hr '='
For your speedtest alias, you could add "&& nslookup " to verify you don't have a DNS issue. Maybe even add a ping to veify you are able to reach the modem/firewall, etc.
I just learned that every time you start a new shell ./bashrc is run. You could also put it higher up the food chain in /etc/profile which is executed whenever any user logs in.
loved the video. Tmux is one of the best CLI applications bar none, and your series on it is awesome. One of the things that kept coming to me during the video was , why not use a CLI file manager, like ranger, lf, nnn or Midnight Commander. (maybe not the last one). ?
Type in a really short command, sl for steam locomotive in whatever distro you're using and just type sl after and a steam locomotive will travel across the screen, I think it works in most distros.
Working from the code in the video I was able to put the PS1 prompt together and integrate it with my .bashrc and include a function to parse my git repositories.
For sure! This is much neater practice, especially if you have quite a number of aliases. And it reduces the possibility that you introduce errors in .bashrc itself.
@@vanadium4167 Well - how should defining an alias delete something else? Not plausible. And "messing up the main file" - depending on how many aliases I have and how they are organized. A weak reason, but at least something.
I know this video is old, but a really easy way to add aliases to you bashrc without actually going in in editing it is this command: echo 'alias newAlias="{command}" >> ~./bashrc this will append that alias to the end of your bashrc file stright from the terminal :)
I store all my defined aliases in ~/.bash_aliases which searched for and loaded if present from the ~/.bashrc file (at least it is in Linux Mint). I find it a better way of doing it without cluttering up the .bashrc file. I do like the ~/.bash_prompt idea.
In fact it's from at least Ubuntu (and maybe underlying Debian). The code in .bashrc to source .bash_aliases was right there on the screen... I was hoping he would at least mention what it was for, and that you might consider using a file like that.
Just found this video. Been using the channel for a while for learning. Anyway, an alias I added and love is for running updates. I used: alias u="sudo apt update -y && sudo apt upgrade -y" This will (after I enter my password if prompted) run update and upgrade and not stop to ask me to enter the y.
can you make a video on fully optimize the bash prompt since is hard to change the colors + i like to see what can by added to the prompt. automatic bash prompt makers are not really that great
FORTUNE mod is a savage i love it The hair ball blocking the drain of the shower reminded Laura she would never see her little dog Pritzi again. -- Claudia Fields, runner-up
The tip on easyer chest sheets is great for everyday use. But on a side note if your studying for any certs such as RHSA like me you might not want to get into a habit of using anything but man pages as that's the only aid your allowed to use in the exam.
Hi there, cool video. For detaching a process from bash better use setsid, like "setsid audacity 1>/dev/null 2>/dev/null", maybe a bash function -- or if you start always the same program -- an alias will suffice. ;o) A function would be like this: function x() { setsid $1 "$2" 2>/dev/null 1>/dev/null ; } An alias like this: alias audacity="setsid audacity 1>/dev/null 2>/dev/null"
42:00 - I use Ctrl+Z, in this case you dont need & while launch. How is it differ? If there is no difference nder the hood, Ctrl+Z is more convenient, imho.
Many thanks. Very interesting video. I am stumped on the bash prompt. Like you I like to understand what is going on. I do not understand the line variable's with the following syntax: LINE_BOTTOM_CORNER="\342\224\224". I have spent hours searching the internet and cannot locate a reference for the command meaning. I have found nn as an octal. Can you point me to a source for this? Clearly I am not using the correct terminology as to what it is, or I would have found something about it. any help is greatly appreciated.
1:42 Does it last 60 days IF you don't spend it or does it just last 60 days so if you choose a cheap package, you only get 2 months free then the $100 is used even if you're cheap package is only like $5 a month package? Because $5 / 100 would be 1 year 8 months. But sounds like you really only get 2 months free is that right?
Currently at work, where I have Cygwin running on a Windows 10 Enterprise PC. When trying to use your custom bash prompt, I see two error lines, both saying "-bash: $' ': command not found" followed by a line with a closing square bracket "]" and the name of the machine. Not sure where to start troubleshooting, but I believe that Cygwin may require slightly different character escaping, than a terminal on "real" Linux (at least that's what I seem to remember from some previous awk scripting that I've done).
Found the issue - Notepad++ was set to use Windows EOL (in order to save some text files to import into a label printer), but once I set it to Linux EOL for the .bash_prompt file, the new prompt is working just fine in Cygwin.
1. You don't need the space at the end of your aliases 2. NEVER EVER RUN A SCRIPT DIRECTLY FROM THE INTERNET (the speed test thing), this giving direct access to your computer to anybody for remote code execution. And don't run scripts, even downloaded, unless you are sure to understand what they do.
you could write a function to do that. in .bashrc, the same place he added the aliases, you could enter ua() { alias e="nano" alias d="ls" } then when you type ua in the prompt it would enable the aliases. You could include a second function to remove the aliases with ra() { unalias e unalias d }
I use aliases all the time and never put a space at the end. Why are you? At least for bash, "help alias", there isn't any requirement for it. In the late 90s was this a thing? I don't remember it's been so long ago but certainly now it isn't needed.
Shortening commands to one character is very dangerous, as any typo can lead to potentially destructive behavior. Autocompletion with tab key is much safer.
Dang man, how can you mention fortune without mentioning cowsay/cowthink? fortune | cowsay is much more fun. And you can install a cli speedtest in most repos I think, just sudo apt install speedtest-cli (run it as speedtest). The means you mentioned would certainly be useful if you can't or don't desire to install something on whatever machine you're working on, but having it installed is much nicer if you can.
My prompt actually tests the outcome of the previous command--if it is successful, my prompt is green, if it fails, my prompt turns red. I put it in my .bashrc file. GREEN='\[\033[32m\]' RED='\[\033[31m\]' NC='\[\033[37m\]' PS1="\u@\w \`if [ \$? = 0 ]; then echo ${GREEN}:\\\)${NC}; else echo ${RED}:\\\(${NC}; fi\`"
(Spain) Hello, very good job. The weather has been very curious to me. The fact is that I am from Spain but not from Madrid but from Almería. Is there any way to configure it so that it appears in Almería and in Spanish? Thanks.
Great video, Jay. On the issue of keeping your aliases, the best way I have found is to put them into the ~/.bash_aliases file which if it exists is automatically loaded by the .bashrc when it runs at login. In fact, I keep a .bash_aliases in my git repository so I can easily add it to a new server or desktop.
[HELP] I've been using a modified copy of your bash_prompt for a while and really like it. My problem is, how can I create a bash script to create the bash_prompt file in a new environment? I'm trying to create a master script to create new environments in proxmox and niceties line nfs or other file transfer protocols are not available yet. What I'm running into is that the ANSI codes are being translated while trying to create the data to pass as text to the new script I'm trying to create on the fly. Any thoughts?
Jay, great video! I already had many of these, but there was one or two that I didn't. Thank you for all that you do. Sorry I couldn't make ATO 2022 this year. I was hoping to get you to sign my "Mastering Ubuntu Server, 3rd ed." book which I purchased a year or so ago. Maybe next year. Take care.
I must say that I am now a big fan of the alias command (as well as adding it to your Bash config) and wish I knew about it sooner. I always like to update my system by going “sudo apt update && sudo apt upgrade -y && flatpak update -y” and typing that out so often is rather tedious, now all I do is “update” and away it goes!
Just not ever had aliases really mentioned to me before, but in my case would be super useful for spinning up and down groups of Docker containers, "arr-up / arr-down". I've seen people use 'll' which translates to 'ls -al', so that's already added. I have the weather tip added also, as 'weather'... super super cool 😁
RE the bash prompt configuration at 17:10: Note that the Mac OSX Terminal doesn't follow conventions for .bashrc. Instead, opening a new terminal uses ~/.bash_profile for configuration. To make the prompt work on Mac, just create a ~/.bash_profile with the "source ~./bash_prompt" line in it (see video at ~19:20).
Save yourself the hassle of going back and forth from desktop app to terminal window by appending your terminal command for the desktop app by "disown": ~$ audacity & disown This will break the parent link to the terminal window process.
I actually use the files referred, you can see it’s right above where you entered aliases in .bashrc, (if exist) .bash_aliases just so I have a specific file, plus seems like they kind of planned it that way, and I forget what federa uses but I do that same thing there.
On my private device I use aliases to set up the backlight brightness of my laptop. My GUI of choice is Mate. Another one is "openssh ssl -showcerts -connect". In a project I used that one fairly often so I used an alias for it. Other than that if there are scripts I use often (for example at my job) I use aliases to access them quickly from anywhere with aliases.