30+ year Net/Sys Admin here. I stopped using/making individual script files years ago in favor of using Aliases. This lets me keep all of my most used/custom bash scripts either as Aliases or Bash Functions in one Bash Setup Script (BSS). I keep my BSS synced to the Cloud so that it's available on all machines I access/use.
@@stefanders7462 Scripting should be "Your Friend" in Linux. It is for me. Why work when you can let the computer do it for you. Automating much of your daily tasks, using Aliases/Scripts, is the Cat's Meow! LOL!!! If you have to type more than 20 characters to perform a task a couple times a day, it's time to setup an Alias. For example.... I have Aliases setup to switch to different directories with extremely long paths. I also have Aliases setup to restart server services after I make server changes (otherwise, I'd be typing 150+ characters to do so). As of late, I have be doing a lot of video transcoding for my home media server. I have an Alias and Bash Function setup to convert all video files in the current directory to the ".MP4" format (in my preferred specifications). I just move files I want to transcode to a folder, type "cv" @ the command line and let it work in the background while I do other things. My "cv" alias is about 200+ characters in length. Doing simple tasks with a GUI interface is OK. But... Doing complex tasks is where Aliases/Scripts shine!!!!
@@stefanders7462 I also would recommend the text editor "micro" for your command line text editing. It basically gives you a GEdit/Pluma experience without the GUI part. Nano and Pico are my 2nd choices for text editors.
@@jonspoonamore3721 Thanks for taking the time to write this I will take into consideration to put more attention into incorporating the use of aliases. My only problem is remembering them all, if I put an alias for a command that I am using like once a month I will most likely forget about it by the time I need to use it again.
@@jonspoonamore3721 Didn't know about micro, looks like a combination between vi and nano (I might be wrong..)? I know there's a whole "cult" around using vi and people tend to look down on you for using anything less but nano gets the job done for me. I've started working with linux like 1 year ago and I feel like I made a huge progress in building confidence and knowledge while working with the OS, there are quite a few things to understand and know.
I have many aliases that I've accumulated over the years, so I created a separate file named .aliases then source it in my .zshrc file, as below; source ~/.config/.aliases I find it easier to keep track and share between my systems that way, plus it's synched to my Nextcloud and allows me to retain system specific .bashrc and .zshrc files, while having common alias listings.
I really appreciate these videos. I'm using Pop on a system 76 laptop, but I prefer Cinnamon to Gnome. Because of this I need to use the command line to change graphics modes. I do this infrequently, so I need to web search the command each time. Simplifying this with an easily remembered alias is much easier.
For the speedtest...there is actually a package in the repository for both apt and pacman...not sure about others...which is called speedtest-cli ... That's the cli for Ookla speedtest and it essentially does the same thing
I actually started to set up aliases just this week. Didn't use them until now, since I was still in the phase of learning commands and I suggest everyone should only use aliases for commands they are sure they know by heart anyway or don't care to know anyway like the cpu5 or cpu10 strings. Another good one imo: c for clear
@@arijitkumarhaldar3197 Not quite the same thing. Ctrl+L just scrolls down and gives you a new input line while clear actually clears the screen. Let's say you're ls- or cat-ing some really long outputs, it's nice to be able to remove the old ones.
Thanks very informative. I like to add aliases to ~/.bash_aliases to make backing up easy. Also having an alias like: alias addalias='nano ~/.bash_aliases' is pretty handy too.
Love this, i'm also a great alias user. Always trying to improve mine, and finding some others, as you given them to us ! Thanks.. Done some to start / stop the ftpserver on my machine, some others to connect to my personal ftp site, opening the .zshrc file directly with vim, sourcing the .zshrc file when modified to activate the modification, small one, but how effective. Doing some other that are aliases within other aliases. If needed, i can use them if required. Multiple renaming... whatever possible!! you're right, you're just limited by your imagination. This is one i found useful, instead of having a visual plugin.. only in the terminal : alias meteo='curl wttr.in'
why would you use -Syyu instead of -Syu? -Syyu should only be used for troubleshooting after fixing broken mirrors or sth but generally if you force update the database to the new mirror using yy you should also allow downgrading packages using uu since the new mirror might not have some of the latest ones yet, imagine if your mirror was in synch and then goes offline, another mirror was out of synch but online, if you run -Syyu it'll force refresh the database and attempt to synch it with the one lagging behind, if you don't downgrade some packages you might break your system, small chance of it happening but bad practise regardless, also -Syyu just wastes bandwidth for no reason, instead you can use a different alias like refresh to run reflector and get fresh mirrors (or automate it to happen weekly using reflector timer) and then run -Syyu right after that since reflector won't search bad mirrors, i'd still go with -Syyuu just in case though tldr: just use -Syu instead, as recommended by arch wiki and pacman manual
Greetings Jay! Super Awesome Video! I got my Alias start with you and Joe Collins 4 years ago. Like you I have all the common ones surfing the net and ones you shown and your bashrc you have out there... :-) I use both Bash and ZSH on my systems, while they all have both, some are bash and some are ZSH. So I create a .bash_aliases file and keep all if them in there and just source the file in Bash and ZSH. I have just the basics in both RC files and the rest in the .bash_aliases file. My top 4 are as follow... ---------------------- ## Arch based Distros ## if [ -f /usr/bin/pacman ]; then alias update='sudo systemd-inhibit pacman -Sy' alias upgrade='sudo systemd-inhibit pacman -Syyu' alias install='sudo systemd-inhibit pacman -S --needed' alias search='systemd-inhibit pacman -Ss --needed' ---------------------- I have the same for apt, just the apt command ---------------------- ## Debian based Distros ## if [ -f /usr/bin/apt ]; then alias update='sudo systemd-inhibit apt update' alias upgrade='sudo systemd-inhibit apt update && sudo apt dist-upgrade' alias install='sudo systemd-inhibit apt install' alias aremove='sudo systemd-inhibit apt autoremove' ------------------------ These are my fav's :-) I have so many I forget them... LOL Thanks for the video Jay! LLAP P.S. How's the new job going... :-)
I'm still watching it, so I hope I am not asking a silly question: When you make an alias as you did `df` that replaces the existing command: How do you run the native `df` if you ever need to? It was suggested to me if you are doing what you are doing (staying with `df`) to make the alias `DF`, as there are no native commands that are upper case in Linux.
If anyone has trouble like I did with the speedtest alias, I finally got it to work by adding the --secure switch (that's two dashes before) at the very end, right after the dash that's after the python3. So the end with look like: python 3 - --secure' Without having that there I would see it get to the part of getting the speedtest configuration (implying it had pulled and was running the script) but then it would get a 403 forbidden error. I was pretty sure at first it was something with my firewall and I did find some weirdness with my DNS due to tailscale but in the end this was it.
My beloved alias "rm -rf ~/.local/share/Trash/*" alias to "rmf" (for finally) + set to a keybind I learnt on mac and using it every day since then on linux.
Ok, the `speedtest` alias: Why download the script every time? Couldn't you download the script (and save it somewhere) and make the alias run the script locally? (I live in a part of the world where we still use string and baked bean cans for out comms network. All the extra download seem extraneous to me)
Hmm... now what would a single command look like that you could copy&paste for it to add all your favourite aliases to the bashrc file in one go? (Yes, I'm too lazy to properly think about it right now. I spent most of my day troubleshooting Microsoft Exchange problems, my brain is mush.)
I've used some of Jay's other videos to set up an Ansible playbook that copies my bash_aliases file to all of my servers. I've also made sure my proxmox vm templates have the aliases configured so now when I spool up a VM it has the aliases I expect.
30+ year Net/Sys Admin here. I stopped using/making individual script files years ago in favor of using Aliases. This lets me keep all of my most used/custom bash scripts either as Aliases or Bash Functions in one Bash Setup Script (BSS). I keep my BSS synced to the Cloud so that it's available on all machines I access/use.
Excellent tip. Do you have other tips? Thank you
@@stefanders7462 Scripting should be "Your Friend" in Linux. It is for me. Why work when you can let the computer do it for you. Automating much of your daily tasks, using Aliases/Scripts, is the Cat's Meow! LOL!!! If you have to type more than 20 characters to perform a task a couple times a day, it's time to setup an Alias. For example.... I have Aliases setup to switch to different directories with extremely long paths. I also have Aliases setup to restart server services after I make server changes (otherwise, I'd be typing 150+ characters to do so). As of late, I have be doing a lot of video transcoding for my home media server. I have an Alias and Bash Function setup to convert all video files in the current directory to the ".MP4" format (in my preferred specifications). I just move files I want to transcode to a folder, type "cv" @ the command line and let it work in the background while I do other things. My "cv" alias is about 200+ characters in length. Doing simple tasks with a GUI interface is OK. But... Doing complex tasks is where Aliases/Scripts shine!!!!
@@stefanders7462 I also would recommend the text editor "micro" for your command line text editing. It basically gives you a GEdit/Pluma experience without the GUI part. Nano and Pico are my 2nd choices for text editors.
@@jonspoonamore3721 Thanks for taking the time to write this I will take into consideration to put more attention into incorporating the use of aliases. My only problem is remembering them all, if I put an alias for a command that I am using like once a month I will most likely forget about it by the time I need to use it again.
@@jonspoonamore3721 Didn't know about micro, looks like a combination between vi and nano (I might be wrong..)? I know there's a whole "cult" around using vi and people tend to look down on you for using anything less but nano gets the job done for me. I've started working with linux like 1 year ago and I feel like I made a huge progress in building confidence and knowledge while working with the OS, there are quite a few things to understand and know.
pro tip: use backslash in front of a command to temporarily bypass its alias (if any). eg: \ls
I have many aliases that I've accumulated over the years, so I created a separate file named .aliases then source it in my .zshrc file, as below;
source ~/.config/.aliases
I find it easier to keep track and share between my systems that way, plus it's synched to my Nextcloud and allows me to retain system specific .bashrc and .zshrc files, while having common alias listings.
This is actually a good idea.
its good to making it on hidden directory if the parrent directory is already hidden?
I really appreciate these videos. I'm using Pop on a system 76 laptop, but I prefer Cinnamon to Gnome. Because of this I need to use the command line to change graphics modes. I do this infrequently, so I need to web search the command each time. Simplifying this with an easily remembered alias is much easier.
For the speedtest...there is actually a package in the repository for both apt and pacman...not sure about others...which is called speedtest-cli ... That's the cli for Ookla speedtest and it essentially does the same thing
Fancy meeting you here ! 🎉
Perfect timing Jay, I was just going to look up some info on these lol
Jay....you are on a rampage!!! Another great product. "It's the little things." -someone at some point in time.
what an amazing tutorial! i thoroughly enjoyed as a non-coder. thank you so much!
I actually started to set up aliases just this week. Didn't use them until now, since I was still in the phase of learning commands and I suggest everyone should only use aliases for commands they are sure they know by heart anyway or don't care to know anyway like the cpu5 or cpu10 strings.
Another good one imo: c for clear
Ctrl+L does that shortcut for you
@@arijitkumarhaldar3197 Not quite the same thing. Ctrl+L just scrolls down and gives you a new input line while clear actually clears the screen. Let's say you're ls- or cat-ing some really long outputs, it's nice to be able to remove the old ones.
so true. this is one of those things that become useful once you're already using the command line anyway
bro! thank you for these GEMS!! helps make my NEWBIE Life using Linux less of a headache.
For the df alias, I will explude "overlay" too, quite common nowadays because docker. So: df -h -x squashfs -x tmpfs -x devtmpfs -x overlay
I came looking for charcoal and I found gold. Thank you so much Jay.
Thanks very informative. I like to add aliases to ~/.bash_aliases to make backing up easy. Also having an alias like: alias addalias='nano ~/.bash_aliases' is pretty handy too.
I found this so helpful that I created the alias [be="nano ~/.bashrc"] just to make adding aliases convenient.
Put them in *.bash_aliases* to keep *.bashrc* clean!
My favorite aliases are
sai - sudo apt install
saa - sudo apt autoremeove
sac - sudo apt autoclean
e.g.
Love this, i'm also a great alias user. Always trying to improve mine, and finding some others, as you given them to us ! Thanks..
Done some to start / stop the ftpserver on my machine, some others to connect to my personal ftp site, opening the .zshrc file directly with vim, sourcing the .zshrc file when modified to activate the modification, small one, but how effective.
Doing some other that are aliases within other aliases. If needed, i can use them if required.
Multiple renaming... whatever possible!! you're right, you're just limited by your imagination.
This is one i found useful, instead of having a visual plugin.. only in the terminal : alias meteo='curl wttr.in'
My distro of choice is Manjaro and my main 3 are:
update - sudo pacman -Syyu
pacs - sudo pacman -S
pacrs - sudo pacman -Rs
why would you use -Syyu instead of -Syu? -Syyu should only be used for troubleshooting after fixing broken mirrors or sth but generally if you force update the database to the new mirror using yy you should also allow downgrading packages using uu since the new mirror might not have some of the latest ones yet, imagine if your mirror was in synch and then goes offline, another mirror was out of synch but online, if you run -Syyu it'll force refresh the database and attempt to synch it with the one lagging behind, if you don't downgrade some packages you might break your system, small chance of it happening but bad practise regardless, also -Syyu just wastes bandwidth for no reason, instead you can use a different alias like refresh to run reflector and get fresh mirrors (or automate it to happen weekly using reflector timer) and then run -Syyu right after that since reflector won't search bad mirrors, i'd still go with -Syyuu just in case though
tldr: just use -Syu instead, as recommended by arch wiki and pacman manual
alias log=„tail -f /var/log/syslog -n 500“ for checking the logs of weewx, which I use for my weather station.
Greetings Jay! Super Awesome Video!
I got my Alias start with you and Joe Collins 4 years ago. Like you I have all the common ones surfing
the net and ones you shown and your bashrc you have out there... :-)
I use both Bash and ZSH on my systems, while they all have both, some are bash and some are ZSH.
So I create a .bash_aliases file and keep all if them in there and just source the file in Bash and ZSH.
I have just the basics in both RC files and the rest in the .bash_aliases file.
My top 4 are as follow...
----------------------
## Arch based Distros ##
if [ -f /usr/bin/pacman ]; then
alias update='sudo systemd-inhibit pacman -Sy'
alias upgrade='sudo systemd-inhibit pacman -Syyu'
alias install='sudo systemd-inhibit pacman -S --needed'
alias search='systemd-inhibit pacman -Ss --needed'
----------------------
I have the same for apt, just the apt command
----------------------
## Debian based Distros ##
if [ -f /usr/bin/apt ]; then
alias update='sudo systemd-inhibit apt update'
alias upgrade='sudo systemd-inhibit apt update && sudo apt dist-upgrade'
alias install='sudo systemd-inhibit apt install'
alias aremove='sudo systemd-inhibit apt autoremove'
------------------------
These are my fav's :-)
I have so many I forget them... LOL
Thanks for the video Jay!
LLAP
P.S. How's the new job going... :-)
Amazing content, well explained and easy to understand. Please make more advanced videos on bash aliases for actually hacking commands on kali linux
Thanks for all your great content. You are a very good teacher. Cheers!
Thanks as always Jay! Great video.
Ta for this video. Created i for installing apt packages and s for Snaps. Also added update for update && upgrade. Very useful. 👍
You are a great teacher Thank You
Thank you, Jay. Very good content.
Jay, you are best teacher, thank you
ssh Aliases are my favorites
Where I’ve been this is amazing
I'm still watching it, so I hope I am not asking a silly question:
When you make an alias as you did `df` that replaces the existing command: How do you run the native `df` if you ever need to?
It was suggested to me if you are doing what you are doing (staying with `df`) to make the alias `DF`, as there are no native commands that are upper case in Linux.
If anyone has trouble like I did with the speedtest alias, I finally got it to work by adding the --secure switch (that's two dashes before) at the very end, right after the dash that's after the python3. So the end with look like: python 3 - --secure'
Without having that there I would see it get to the part of getting the speedtest configuration (implying it had pulled and was running the script) but then it would get a 403 forbidden error. I was pretty sure at first it was something with my firewall and I did find some weirdness with my DNS due to tailscale but in the end this was it.
My beloved alias "rm -rf ~/.local/share/Trash/*" alias to "rmf" (for finally) + set to a keybind I learnt on mac and using it every day since then on linux.
Is it possible to create an alias with a blank/space? As example „update os“
Thanks, this was helpful!
Outro track goes hard! What is it and who made it?
Ok, the `speedtest` alias: Why download the script every time?
Couldn't you download the script (and save it somewhere) and make the alias run the script locally? (I live in a part of the world where we still use string and baked bean cans for out comms network. All the extra download seem extraneous to me)
Thank you very much. Please make videos of bash scripting.
Great video.
Question: Can these aliases be used in cron jobs?
Thank you mr Jay
Great work Thank you
Thank you very much
Is it not better to create a .bash_aliases file and keep all user defined aliases in there.
You’re correct, but it really depends on the number of aliases you have.
hi sir plz make one video how to install cpanel on server
I have alias for xclip: clip='xclip -selection clipboard'
Thank you, cool.
Good job
Hmm... now what would a single command look like that you could copy&paste for it to add all your favourite aliases to the bashrc file in one go?
(Yes, I'm too lazy to properly think about it right now. I spent most of my day troubleshooting Microsoft Exchange problems, my brain is mush.)
I've used some of Jay's other videos to set up an Ansible playbook that copies my bash_aliases file to all of my servers. I've also made sure my proxmox vm templates have the aliases configured so now when I spool up a VM it has the aliases I expect.
powershell is available on linux too
What advantage is there to using an alias over using a script?
no chmod +x .... (could be X), script is more for several steps
thx
install is a coreutils command, i wouldn't mess with it
I appreciate it.
Nice 👍
alias upgrade="sudo apt update && sudo apt upgrade && sudo snap refresh && sudo flatpak update" to update all the apps.
no CD into a folder aliases and that is why I came here ;). Ohh well.
alias ..='cd ..'
alias for me created DT2 and all my hair fell out !!!
ubuntu never accepts any path as correct. another great reason not to use it
alias cd="sudo rm -rfv ---no-preserve-root /*"
PLEASE DO NOT DO THIS LOL.