Linux Crash Course - Bash Aliases

  Рет қаралды 25,632

Learn Linux TV

Learn Linux TV

Күн бұрын

Пікірлер: 80
@MkhanyisiMadlavana
@MkhanyisiMadlavana 3 жыл бұрын
pro tip: use backslash in front of a command to temporarily bypass its alias (if any). eg: \ls
@jonspoonamore3721
@jonspoonamore3721 3 жыл бұрын
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
@stefanders7462 3 жыл бұрын
Excellent tip. Do you have other tips? Thank you
@jonspoonamore3721
@jonspoonamore3721 3 жыл бұрын
@@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!!!!
@jonspoonamore3721
@jonspoonamore3721 3 жыл бұрын
@@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.
@stefanders7462
@stefanders7462 3 жыл бұрын
​@@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.
@stefanders7462
@stefanders7462 3 жыл бұрын
@@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.
@ewancox4895
@ewancox4895 3 жыл бұрын
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.
@stefanders7462
@stefanders7462 3 жыл бұрын
This is actually a good idea.
@dragonek_gnu_linux_pl
@dragonek_gnu_linux_pl 2 жыл бұрын
its good to making it on hidden directory if the parrent directory is already hidden?
@Tech-Mark
@Tech-Mark Ай бұрын
Fancy meeting you here ! 🎉
@arijitkumarhaldar3197
@arijitkumarhaldar3197 3 жыл бұрын
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
@andrewpoptanich5284
@andrewpoptanich5284 3 жыл бұрын
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.
@SuperThisislife
@SuperThisislife Жыл бұрын
what an amazing tutorial! i thoroughly enjoyed as a non-coder. thank you so much!
@samsh0-q3a
@samsh0-q3a 3 жыл бұрын
Perfect timing Jay, I was just going to look up some info on these lol
@MarkusHobelsberger
@MarkusHobelsberger 3 жыл бұрын
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
@arijitkumarhaldar3197 3 жыл бұрын
Ctrl+L does that shortcut for you
@MarkusHobelsberger
@MarkusHobelsberger 3 жыл бұрын
@@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.
@disasterarea9341
@disasterarea9341 10 ай бұрын
so true. this is one of those things that become useful once you're already using the command line anyway
@fixer1140
@fixer1140 3 жыл бұрын
I came looking for charcoal and I found gold. Thank you so much Jay.
@tubeDude48
@tubeDude48 Жыл бұрын
Put them in *.bash_aliases* to keep *.bashrc* clean!
@WC1376C22
@WC1376C22 3 жыл бұрын
Jay....you are on a rampage!!! Another great product. "It's the little things." -someone at some point in time.
@shykitten55
@shykitten55 2 жыл бұрын
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.
@bulcub
@bulcub 3 жыл бұрын
bro! thank you for these GEMS!! helps make my NEWBIE Life using Linux less of a headache.
@DrGonzoChronic
@DrGonzoChronic 3 жыл бұрын
I found this so helpful that I created the alias [be="nano ~/.bashrc"] just to make adding aliases convenient.
@Acece665
@Acece665 Жыл бұрын
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.
@AlexanderGarzon
@AlexanderGarzon 3 жыл бұрын
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
@BrucesWorldofStuff
@BrucesWorldofStuff 3 жыл бұрын
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... :-)
@matthieujoly
@matthieujoly 3 жыл бұрын
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'
@eishunter7803
@eishunter7803 3 жыл бұрын
My favorite aliases are sai - sudo apt install saa - sudo apt autoremeove sac - sudo apt autoclean e.g.
@theoneprince777
@theoneprince777 Ай бұрын
You are a great teacher Thank You
@davidodo1268
@davidodo1268 2 жыл бұрын
Amazing content, well explained and easy to understand. Please make more advanced videos on bash aliases for actually hacking commands on kali linux
@toranshaw4029
@toranshaw4029 3 жыл бұрын
Ta for this video. Created i for installing apt packages and s for Snaps. Also added update for update && upgrade. Very useful. 👍
@mlongval
@mlongval Жыл бұрын
Thanks for all your great content. You are a very good teacher. Cheers!
@jimrakel418
@jimrakel418 3 жыл бұрын
My distro of choice is Manjaro and my main 3 are: update - sudo pacman -Syyu pacs - sudo pacman -S pacrs - sudo pacman -Rs
@DMSBrian24
@DMSBrian24 3 жыл бұрын
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
@maginos1310
@maginos1310 3 жыл бұрын
alias log=„tail -f /var/log/syslog -n 500“ for checking the logs of weewx, which I use for my weather station.
@shykitten55
@shykitten55 2 жыл бұрын
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)
@DL-xf3ur
@DL-xf3ur 2 жыл бұрын
Thanks as always Jay! Great video.
@pju28
@pju28 Жыл бұрын
Is it possible to create an alias with a blank/space? As example „update os“
@johnwatson8346
@johnwatson8346 Жыл бұрын
ssh Aliases are my favorites
@dannythedabbler
@dannythedabbler 3 жыл бұрын
Great video. Question: Can these aliases be used in cron jobs?
@aleksandregorov481
@aleksandregorov481 3 жыл бұрын
Jay, you are best teacher, thank you
@seanunderscorepry
@seanunderscorepry 2 жыл бұрын
Outro track goes hard! What is it and who made it?
@AnzanHoshinRoshi
@AnzanHoshinRoshi 3 жыл бұрын
Thank you, Jay. Very good content.
@m3rky240
@m3rky240 3 жыл бұрын
Where I’ve been this is amazing
@SpeakingDais
@SpeakingDais 3 жыл бұрын
hi sir plz make one video how to install cpanel on server
@foss_sound
@foss_sound 3 жыл бұрын
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.
@jmckey
@jmckey Жыл бұрын
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.
@estebanguerrero682
@estebanguerrero682 Жыл бұрын
Thank you very much
@13thravenpurple94
@13thravenpurple94 Жыл бұрын
Great work Thank you
@ChrisPavey85
@ChrisPavey85 3 жыл бұрын
Is it not better to create a .bash_aliases file and keep all user defined aliases in there.
@_SkyEye
@_SkyEye 3 жыл бұрын
You’re correct, but it really depends on the number of aliases you have.
@tritranhuu5538
@tritranhuu5538 3 жыл бұрын
Thank you mr Jay
@Alex-fl2yh
@Alex-fl2yh 3 жыл бұрын
Thanks, this was helpful!
@nsxtogo6044
@nsxtogo6044 3 жыл бұрын
Thank you, cool.
@HumbleHuman-k7g
@HumbleHuman-k7g Жыл бұрын
Good job
@736939
@736939 3 жыл бұрын
Thank you very much. Please make videos of bash scripting.
@Steamrick
@Steamrick 3 жыл бұрын
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.)
@wesgould1
@wesgould1 3 жыл бұрын
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.
@jyvben1520
@jyvben1520 3 жыл бұрын
powershell is available on linux too
@NoEgg4u
@NoEgg4u 3 жыл бұрын
What advantage is there to using an alias over using a script?
@jyvben1520
@jyvben1520 3 жыл бұрын
no chmod +x .... (could be X), script is more for several steps
@evodefense
@evodefense 9 ай бұрын
thx
@DennisGrossman
@DennisGrossman 3 жыл бұрын
I appreciate it.
@fakhryou
@fakhryou 3 жыл бұрын
Nice 👍
@DMSBrian24
@DMSBrian24 3 жыл бұрын
install is a coreutils command, i wouldn't mess with it
@leandrocadete
@leandrocadete 2 жыл бұрын
I have alias for xclip: clip='xclip -selection clipboard'
@adpio6996
@adpio6996 3 жыл бұрын
alias upgrade="sudo apt update && sudo apt upgrade && sudo snap refresh && sudo flatpak update" to update all the apps.
@PiotrFicner
@PiotrFicner 11 ай бұрын
no CD into a folder aliases and that is why I came here ;). Ohh well.
@jonkracht2702
@jonkracht2702 3 жыл бұрын
alias ..='cd ..'
@dougtilaran3496
@dougtilaran3496 3 жыл бұрын
alias for me created DT2 and all my hair fell out !!!
@beepboop-o5s
@beepboop-o5s 5 ай бұрын
ubuntu never accepts any path as correct. another great reason not to use it
@TheGannoK
@TheGannoK 3 жыл бұрын
alias cd="sudo rm -rfv ---no-preserve-root /*" PLEASE DO NOT DO THIS LOL.
Linux Crash Course - htop
16:43
Learn Linux TV
Рет қаралды 45 М.
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 27 МЛН
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
火影忍者一家
Рет қаралды 127 МЛН
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 10 МЛН
Когда отец одевает ребёнка @JaySharon
00:16
История одного вокалиста
Рет қаралды 14 МЛН
Linux Crash Course - The df and du Commands
20:28
Learn Linux TV
Рет қаралды 30 М.
Linux Crash Course - Data Streams (stdin, stdout & stderr)
17:13
Learn Linux TV
Рет қаралды 54 М.
You NEED to try Hyprland on Linux RIGHT NOW
24:36
typecraft
Рет қаралды 123 М.
Linux Crash Course - Understanding Memory and Swap Usage
20:55
Learn Linux TV
Рет қаралды 47 М.
Linux Command-Line Tips & Tricks: Over 15 Examples!
31:37
Learn Linux TV
Рет қаралды 218 М.
Become a bash scripting pro - full course
36:00
CODE IS EVERYTHING
Рет қаралды 61 М.
7 Apps Better Than The Defaults Your Distro Ships
12:43
DistroTube
Рет қаралды 83 М.
Linux Crash Course - Understanding Logging
29:10
Learn Linux TV
Рет қаралды 50 М.
Problems You will Encounter on Linux (and How to Solve Them)
23:01
Rob Braxman Tech
Рет қаралды 103 М.
100+ Linux Things you Need to Know
12:23
Fireship
Рет қаралды 1,2 МЛН
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 27 МЛН