Let's Share Our Favorite Bash Aliases

  Рет қаралды 30,741

DistroTube

DistroTube

4 жыл бұрын

I think one of the things that most of us do not fully appreciate is how much time we can save by using shell aliases. I don't think I use enough aliases and when I check out other people's configs, I don't think you guys use enough aliases. So I thought I'd share some of my aliases with you guys, and you guys can share your favorite aliases in the comments below!
REFERENCED:
► gitlab.com/dwt1/dotfiles/-/bl... - DT's bashrc
WANT TO SUPPORT THE CHANNEL?
💰 Patreon: / distrotube
💳 Paypal: www.paypal.com/cgi-bin/webscr...
🛍️ Amazon: amzn.to/2RotFFi
👕 Teespring: teespring.com/stores/distrotube
SOCIAL PLATFORMS:
🗨️ Mastodon: mastodon.technology/@distrotube
💬 IRC: irc://freenode #distrotube
👫 Reddit: / distrotube
📽️ LBRY: lbry.tv/$/invite/@DistroTube:2
DT ON THE WEB:
🕸️ Website: distrotube.com/
🐿️ Gopherhole: gopher://distro.tube
📁 GitLab: gitlab.com/dwt1
🔊 Audio Podcasts: www.buzzsprout.com/1263722
FREE AND OPEN SOURCE SOFTWARE THAT I USE:
🌐 Brave Browser - brave.com/dis872
📽️ Open Broadcaster Software: obsproject.com/
🎬 Kdenlive: kdenlive.org
🎨 GIMP: www.gimp.org/
🎵 Audacity: www.audacityteam.org/
💻 VirtualBox: www.virtualbox.org/
🗒️ Doom Emacs: github.com/hlissner/doom-emacs
Your support is very much appreciated. Thanks, guys!

Пікірлер: 306
@wintermute701
@wintermute701 3 жыл бұрын
alias please='sudo !!'
@MadSpaceCow
@MadSpaceCow 3 жыл бұрын
Fuck that’s fantastic
@stackspace
@stackspace 3 жыл бұрын
Lol
@arturmeinild2461
@arturmeinild2461 3 жыл бұрын
This should be a T-shirt slogan !
@user-pk8ic7jc6h
@user-pk8ic7jc6h 3 жыл бұрын
alias fucking='sudo' # how about that huh
@betterh
@betterh 3 жыл бұрын
does it work? as !! is inbuilt. also idea for "alias sure='sudo !!'", as fore switch user redo, or just sure as confirmation.
@dhakhoa93
@dhakhoa93 3 жыл бұрын
My 2 favorite Git aliases: alias gs='git status' alias glog='git log --graph --decorate --oneline' # this one is just pure terminal beauty
@nicholasficara1017
@nicholasficara1017 3 жыл бұрын
You don't need to pass -Syu to yay. Just yay will work and default to -Syu.
@SetVet
@SetVet 3 жыл бұрын
you just blew my mind
@betterh
@betterh 3 жыл бұрын
in the context of simplicity like cleanup, unlock -> update, upaur, upall would sound better than pacsyu, yaysua, yaysyu
@warhawk_yt
@warhawk_yt 3 жыл бұрын
Derek just rick rolled us all lol
@user-yo7hz8gw4t
@user-yo7hz8gw4t 3 жыл бұрын
That terminal rickroll was something I didn’t know I needed
@felipecarlin8540
@felipecarlin8540 3 жыл бұрын
I didn’t know my terminal needed to “Never give up”, now I’m glad I can rr anywhere!
@12Q46HPRN
@12Q46HPRN 3 жыл бұрын
Excellent video! My wife looked over at my screen and said, "Leaning more Linux stuff?" Yup! Keep up the great work :)
@TheRfmodulator
@TheRfmodulator 3 жыл бұрын
Awesome! A little communication is the key to a good marriage. Too much is just asking for trouble.
@karu8291
@karu8291 3 жыл бұрын
Those aliases for `exa` are going to help me a lot. Thanks a ton!
@iTzJeSsE08
@iTzJeSsE08 2 жыл бұрын
Hey DT! I just wanted to go back to this video and tell you that this completely changed my workflow for the better, particularly as a window manager user. I have bash aliases to change my wallpaper with Nitrogen, to connect and disconnect my home Wireguard vpn, to connect and disconnect my bluetooth headphones, to quickly switch between my home WiFi and phone hotspot. Since I am running vanilla Arch (BTW) on a 13 inch MacBook Pro with no dedicated FN lock key, I also now have a bash alias to enable and disable function lock. Thank you so much for the content you create, you just never know when one video about something simple can be lifechanging for someone. I also have a suggestion for a video I would greatly look forward to similar to this one - how about a favorite Vim macros compilation? I would be very interested to see what you come up with and what your community comes up with as well. Best wishes, and up the amazing work you've been doing in promoting open source software!
@Phydoux2112
@Phydoux2112 3 жыл бұрын
Referring to your git aliases. I wrote a script that will ask you what repository your writing to then it will run all of the necessary commands. It worked the first time I tried it. It ran everything correctly too.
@nevoyu
@nevoyu 3 жыл бұрын
I dont use aliases because I'm still learning the actual command syntax
@12Q46HPRN
@12Q46HPRN 3 жыл бұрын
That makes sense. You've found an excellent channel for learning! Keep this video handy for down the road . . . .
@betterh
@betterh 3 жыл бұрын
what i have found useful is using arcolinux .bashrc file and reading all parts of it, i dont use 70-80% of these aliases, but i found out some useful commands with options. try doing it on any distro, check what aliases there are, no prossure on using it.
@1MinuteFlipDoc
@1MinuteFlipDoc 3 жыл бұрын
youtube-dl is a beast! nice shortcuts there!
@AnzanHoshinRoshi
@AnzanHoshinRoshi 3 жыл бұрын
Thank you, Derek. This is a very good resource.
@BarafuAlbino
@BarafuAlbino 3 жыл бұрын
alias rsync='rsync --info=progress2' ## Copy things with progress bar
@bluesdog88
@bluesdog88 3 жыл бұрын
Thanks Derek, that's really handy to know!
@marioschroers7318
@marioschroers7318 3 жыл бұрын
Brilliant aliases. In case you use yay, you can actually get rid of most of your pacman aliases actually. Simply type _yay_ in the terminal, and it will perform a system-wide upgrade. I actually think one of your viewers told me that once. There is lf which stands for »list files« and is an alternative to the ranger file manager written in Go. I don't use that, but got tired of typing _ranger_ all the time, so I simply aliased ranger to lf. My aliases are sparse and very simple, I suppose. Still looking for a nice alias to _ncmpcpp_ though. Suggestions, anyone?
@Sinnersmight
@Sinnersmight 3 жыл бұрын
pp
@betterh
@betterh 3 жыл бұрын
thats the thing with using aliases that you can be explicit and forget the default behaviour of the command as it may change? unless wanting to learn first and keep it in your head
@marioschroers7318
@marioschroers7318 3 жыл бұрын
@@betterh Yes, I think there is a certain risk to forget about a command's default switches because of aliases, that's why I try to keep the amount of my aliases to a minimum. However, often they really simplify things, and many commands we learn from the start are in fact aliases 😉
@marioschroers7318
@marioschroers7318 Жыл бұрын
@GeoMinesDiamonds I really like commands that limit themselves to two chars. Rust tools offer lots of that (for example, fd as a find replacement, or if you use ripgrep, the actual command is 'rg'). Think I should use 'nv' as an alias for neovim, but then, I have hotkeyed Neovide to Super+d. In general, there is nothing more convenient than a combination of hotkeys and sparse aliases.
@samoylov1973
@samoylov1973 3 жыл бұрын
Hey, DT, thanks for inspiring videos. My favorite bash alias is 'mpy'. It starts mpv and plays whatever link from KZbin or other source I've got in my clipboard. This is a huge help if you don't like to watch tons of ads, that come with videos and interrupt them on KZbin. Yeah, it's a little hack. But ads are insane these days and I had to look for a solution for the problem. The other one is "w", which will show me current weather and forecast. alias sdn='shutdown -h now' alias r='ranger' alias mpy='mpv "$(xclip -o -selection clipboard)"' alias p='python3' alias upd='sudo apt update && sudo apt upgrade' alias w='curl wttr.in'
@TomCarlson
@TomCarlson 3 жыл бұрын
Really simple "wdil='history | grep'" Stands for When Did I Last?
@DistroTube
@DistroTube 3 жыл бұрын
I like it.
@urugulu1656
@urugulu1656 3 жыл бұрын
@@DistroTube ctrl r does sorta the same... and the name is missleading. the history command does not print date and time of a commmand
@TomCarlson
@TomCarlson 3 жыл бұрын
@@urugulu1656 Yep, that's true. It's what makes sense in my head as an easily remembered initialization, but I'm not asking for when I did something. I just want recent instances of doing something. So I guess in my head "When Did I Last" is itself short for "When I Recently Did This What Did I Do." Or "wirdtwdid"!
@betterh
@betterh 3 жыл бұрын
@@TomCarlson hig? for short?
@thallium54
@thallium54 3 жыл бұрын
Why not history | fzf
@hn1574
@hn1574 3 жыл бұрын
Here’s my favorite: alias yeet="rm -rf"
@urugulu1656
@urugulu1656 3 жыл бұрын
--no-preserve-root if you are feeling really cheeki breeki
@auroradraco9974
@auroradraco9974 3 жыл бұрын
I see you are a man of culture
@stackspace
@stackspace 3 жыл бұрын
fml=“echo ‘so, this is how it ends for us?’ && sudo rm -rf / -no-preserve-root”
@armynyus9123
@armynyus9123 3 жыл бұрын
My admin f.h. told me it stands for 'read mail really fast' - but I never tried ;-)
@howmuchiswhere329
@howmuchiswhere329 3 жыл бұрын
i've been meaning to tidy up my aliases since i stopped WM hopping. i did make an alias helper script that i'm quite proud of, that greps my bashrc for specific comments, and awks the output into categories. it took me about an hour tune fine tune the awk command, and i've used it.. er... maybe twice? haha
@Zoltar358
@Zoltar358 3 жыл бұрын
@DistroTube Hey DT. Here is an alias you might find useful: get-remote='git config --get remote.origin.url'. It shows the remote address of any cloned repository.
@CRiley-zx1ws
@CRiley-zx1ws Жыл бұрын
Or you can do `git remote -v`
@BrucesWorldofStuff
@BrucesWorldofStuff 3 жыл бұрын
Thanks DT for the video... I don't have much in my Bashrc or my Zshrc files,. I keep everything in .bash_aliases which keeps the the RC files clean and I only have to edit one file and not two. Bash looks for this file and I Point Zsh to look for it two. I find it easy and I have it setup on all my systems from Arch to MX and Mint and so on. This is how I update all my Distros, 4 easy command no matter what OS I am using. I arch just add a "Y" in front of the commands "install, update, upgrade... So here is my Aliases for that: # Manage packages update easier # Debian based Distros if [ -f /usr/bin/apt ]; then alias update='sudo apt update' alias upgrade='sudo apt update && sudo apt dist-upgrade' alias install='sudo apt install' alias aptlist='apt list --upgradable' alias upclean='up --clean' # Up is Joe Collins UP Bash update script alias aptll='apt list | less' fi # Arch based Distros if [ -f /usr/bin/pacman ]; then alias update='sudo pacman -Sy' alias upgrade='sudo pacman -Syyu' alias install='sudo pacman -S --needed' alias yinstall='yay -S --needed' alias yupdate='yay -Sy' alias yupgrade='yay -Syyu' fi # The lonly Solus if [ -f /usr/bin/eopkg ]; then alias update='sudo eopkg update-repo' alias upgrade='sudo eopkg upgrade' alias updistro='~/bin/up-solus' alias install='sudo eopkg it' fi My .bash_aliases has lots of gems that I made and collected and is way too large to share here... Lol But these are the ones I use all the time... :-) Some cool Functions I use too..... ### set common functions ############# function my_ip() # Get IP address. { curl ifconfig.co } # Find a file with a pattern in name: function ff() { find . -type f -iname '*'"$*"'*' -ls ; } function sysinfo() # Get current host related info. { echo -e " ${BRed}System Informations:$NC " ; uname -a echo -e " ${BRed}Online User:$NC " ; w -hs | cut -d " " -f1 | sort | uniq echo -e " ${BRed}Date :$NC " ; date echo -e " ${BRed}Server stats :$NC " ; uptime echo -e " ${BRed}Memory stats :$NC " ; free echo -e " ${BRed}Public IP Address :$NC " ; my_ip echo -e " ${BRed}Open connections :$NC "; netstat -pan --inet; echo -e " ${BRed}CPU info :$NC "; cat /proc/cpuinfo ; echo -e " " } Oh here are a few "functions" I got somewhere I liked! The "Find" one is a nice one easy to use. "ff" and the name! LLAP
@joetheman74
@joetheman74 3 жыл бұрын
Reflector is actually very useful. Just last week my system was giving me errors that is couldn't find a mirror. Sometimes mirrors go down. I was updating many packages and I didn't want to look at and wait for all those errors for every package. Just yesterday I was installing some packages and the download speeds were really slow. By stopping my install and quickly running reflector I updated to the fastest most recent updated mirrors in my country and then restarted my installation. If I had not it would have taken 3 times as long.
@nox6555
@nox6555 3 жыл бұрын
Once the dot is shared its easy to understand
@moai834
@moai834 3 жыл бұрын
You don't need that ex function - you can install atool, it allows you to extract, pack, list, convert etc with every archiving format you even need, much better than just shell command. It is in the standard arch repos.
@Sinnersmight
@Sinnersmight 3 жыл бұрын
Fantastic! This really will help with my setup
@lagwulf1637
@lagwulf1637 3 жыл бұрын
I really like alias -g nu='2>/dev/null' alias -g le = '|less'
@programorprogrammed
@programorprogrammed 3 жыл бұрын
I'm definitely guilty of not using alias enough. Some useful things here.
@siaal5001
@siaal5001 3 жыл бұрын
alias sudo='sudo ' is a big one for me it allows you to chain aliases together, otherwise you can't sudo an alias and so cp wouldn't be 'cp -i' and vim would actually open vim. I also use 'mv -i' and 'rm -I' (capital i) because i like to live in fear
@ryanblock2010
@ryanblock2010 3 жыл бұрын
I use this alias all the time now to easily select which branch i want to check out using fzf (actually fzf-tmux which defaults to fzf if you're not in tmux but still requires to be downloaded separately, just as easy as installing fzf though. if you don't wish to install this just remove the '-tmux' from the fzf command): alias gcb='git checkout $(git branch -a | fzf-tmux -d 15 --no-preview | sed "s/remotes\/origin\///g")' For work I'm constantly having to switch branches as a part of my own work and mostly reviewing other pull requests. This alias has been super super handy, especially when the only unique part of the branch name is the ticket number on the relevant project-management software board. I also have similar bash functions for checking git diffs on files & another for commits, adding files, resetting files and checking out files if anyone is interested ( github.com/Rblock919/dot-files/blob/master/bash/git_functions & github.com/Rblock919/dot-files/blob/master/scripts/source/commits )
@besheraladdam9325
@besheraladdam9325 3 жыл бұрын
Lovely
@surferbum618
@surferbum618 3 жыл бұрын
Thx for doing what you do DT! Hope you're doing well. in order of usage: vps = ssh into my vps rr = ranger burp = runs Burp Suite .jar file spotify = flatpak command to run Spotify slack = flatpak command to run Slack vpn = cd into directory containing .ovpn connection configs; ls wowc = runs wine with path to world of warcraft .exe pi = ssh into my raspberry pi corona = runs corona script to get recent numbers of infected
@juliankandlhofer7553
@juliankandlhofer7553 3 жыл бұрын
do you have a link to that corona script? sounds useful :D
@surferbum618
@surferbum618 3 жыл бұрын
@@juliankandlhofer7553 Sure, it's just a simple curl command really. curl corona-stats.online/states/us -o "corona_info.txt" and then grep txt file for your local info: grep "State\|yourstate" corona_info.txt
@betterh
@betterh 3 жыл бұрын
regarding 'ssh into my vps' there is a .ssh config file, you can setup address for multiple vm's and then run 'ssh vm1' or smth like that
@surferbum618
@surferbum618 3 жыл бұрын
@@betterh cool! I'll have to take a look at that. Thanks for the info
@betterh
@betterh 3 жыл бұрын
@@surferbum618 maybe this will help to get the idea linuxize.com/post/using-the-ssh-config-file/
@thenextpoetician6328
@thenextpoetician6328 3 жыл бұрын
I reduced two default Arco aliases to make things simpler: alias up='sudo pacman -Syyu' (was update) alias all="yay -Syu --noconfirm" (was upall)
@balmar3
@balmar3 3 жыл бұрын
By far the most used, to find the files you manipulated the latest: alias lt 'ls -all -rt' Quick hint to find repeated or oversize files: alias lt 'ls -all -rt' Vimdiff without accidentally writing the files: alias lessdiff 'vimdiff -R -M' I also remap "less" to a script that invokes Vim with some handy keymappings and read-only mode. And restrict "locate" to my home by this script which I call "hloc" : locate "$@" | awk ' /^\/home/ {print $0}'
@DeshierArchitecte
@DeshierArchitecte 3 жыл бұрын
alias alias=“alias”
@felipecarlin8540
@felipecarlin8540 3 жыл бұрын
Nick Raleigh this is meta to a whole other level!
@dancorvalan3205
@dancorvalan3205 3 жыл бұрын
This is very cool
@luks1337
@luks1337 3 жыл бұрын
as a pentester for me, one of the good ones is: alias up="python3 -m http.server"
3 жыл бұрын
I have one that reads a file and puts its contents in the clipboard using xclip, and some that generate random passwords of various lengths (although I do this often enough to have a hot key for that as well). I don't use aliases very much, because I work as a sysadmin with thousands of servers and various flavors of Linux. We are a team of 12 people running those, and so we tend to stick with defaults to avoid costly mistakes. I do have the git aliases gf, gp, gc, gca and friends,as well as pi, pr, and pq etc. for packages on my local machine, however. Yes, I know it obscures the ps binary, but I don't really use it. Mostly the shortcuts I make end up having to be scripts in their own right, so my zshrc is quite empty, but my /usr/local/bin is full of both wonderful and stupid scripts.
@liftlinux9421
@liftlinux9421 3 жыл бұрын
15:08 Legendry moment starts here
@stumbling
@stumbling 3 жыл бұрын
I have a bunch of aliases for changing directories and editing files in vim. For example, "b" jumps to my local bin folder (which has my scripts in); "cfv" open the vim config file in vim.
@mrcrazyadd2
@mrcrazyadd2 3 жыл бұрын
Super simple, but I always replace some defaults: ls='ls -lash --color=auto" cat='bat'
@betterh
@betterh 3 жыл бұрын
didnt know about bat command, thanks
@RodneyFisk
@RodneyFisk 8 ай бұрын
That extract actually, originally, comes from the old mtools package. A package to handle msdos filesystems on linux.
@prabinlamichhane9285
@prabinlamichhane9285 3 жыл бұрын
lg = git log --all --oneline --graph --decorate is quite handy
@xDarkWav
@xDarkWav 3 жыл бұрын
alias update='sudo zypper ref && sudo zypper dup && sudo zypper dup --allow-vendor-change --from "Packman Repository"' That command basically forces a repo refresh, updates a tumbleweed system and ensures that everything that exists in the Packman repository is also installed from there. For leap you need to replace the "dup" with "up" in the second command.
@rohandalavi4634
@rohandalavi4634 3 жыл бұрын
Ironic, he just made the video to Rick roll everyone
@marioschroers7318
@marioschroers7318 3 жыл бұрын
Just coming up with another one for all those using the nnn file browser: _nnn_ > _nnn -d_ to default to the detailed view. I was always confused about the default view. It's distraction-free for sure, but also looks horribly empty. I enjoy viewing file sizes. Detailed view also indicates the chmod number of every file, very convenient. I currently evaluate nnn as an alternative to ranger. Just received an update. nnn finally seems to color more of its output. Potentially, we could also alias _nnn_ to something like _n3_ or so. I'm fine with typing nvim though, no need to alias this one for me. I have gotten used to it nicely. Edit: I aliased this to _nn_ . Didn't like to have a numeric digit in it.
@luanalatte
@luanalatte 3 жыл бұрын
I imagine derek has rick roll as an alarm tune lol
@ayushyadav5164
@ayushyadav5164 3 жыл бұрын
Once I ran pacman -Rns $(pacman -Qdtq) and it removed my kernel package! Great!!
@DistroTube
@DistroTube 3 жыл бұрын
I've seen this before with this command. Hence, why I warned everyone about that one.
@ayushyadav5164
@ayushyadav5164 3 жыл бұрын
@@DistroTube what if human body was like computers and we ran pacman -Rns $(pacman -Qdtq) and pacman says "hmm this heart is looking bloat and orphan let's remove it"
@jeremyjohansson3445
@jeremyjohansson3445 3 жыл бұрын
Hey DT, how do you manage all your keyboard shortcuts across all those different window managers?
@Amike
@Amike 3 жыл бұрын
Did we just get rickrolled on a DT video? Wow
@riseabove3082
@riseabove3082 3 жыл бұрын
I keep my aliases in a separate file from .bashrc called .bash_aliases. First one is a function rather than an alias but still same. Never have to worry about forgetting sudo when editing files anywhere on the system. If it's a root file it will prompt you for a password otherwise it won't. It just works. Hate it when I open a file and it's in read only due to permissions. You could use sudoedit but again it's the forgetting part to do that beforehand. Here all you have to is use the same command whether it's you or a root file. It will let you know if it needs a password. # This function will allow you to open files in vim and request a password if they are root files. function vim(){ OWNER=$(stat -c '%U' $1) if [[ "$OWNER" == "root" ]]; then sudo -e /usr/bin/vim $*; # note: [safer] sudo -e forces into edit only mode, does not allow executing cmds else /usr/bin/vim $*; fi } - - - - - - - - - - - - - - - - - - - - - - - - - - - - # I have this alias run every time I open a terminal to show the hostname and IP address of my machine. alias ipa="hostname | tr ' ' '\t'; ip -br -4 addr | cut -f1 -d/ | awk '{print \$1, \$3}' | grep -v '127'" # Showing my top memory hog and process hog; can be run separately or as whole with tophog alias psmem="echo '-------- [Top memory hogs] --------';ps -axch -o cmd:15,pid:15,%mem --sort=-%mem | head -n 1 alias pscpu="echo '---------- [Top cpu hogs] ----------';ps -axch -o cmd:15,pid:15,%cpu --sort=-%cpu | head -n alias tophog="cls;psmem;pscpu" alias cd..='cd ..' # because I get tired of spacing those out. alias cls='clear' # because I was used to Dos alias pf="ps -e | grep $1" # Find the processID of an app that you want to kill. pf firefox pf chrome alias supered='sudo mousepad $1' # Run a gui editor with super powers. I don't use anymore alias duhome='du -sh /home/* | sort -nr' # Get your /home size alias lsz='ls -lhF --color=auto && du -sh0 && echo Grand Total Size' # list directory with a Total size at the end
@vitoroliveira6170
@vitoroliveira6170 3 жыл бұрын
If you use irssi and tor together, alias irc='torsocks irssi'. Also i have alias shn='shutdown -h now && exit'
@stackspace
@stackspace 3 жыл бұрын
I build from source a lot so I use ‘build=“make clean && make && sudo make install’ a LOT
@robertdavis9948
@robertdavis9948 3 жыл бұрын
I may be a bit late to the dance, but pushd & popd are much more useful than cd.
@rebinsama642
@rebinsama642 Жыл бұрын
My only favorite aliases: alias please="sudo" alias fucking="sudo"
@KasraMadadipouya
@KasraMadadipouya 3 жыл бұрын
My favorite ones ;-) - alias ls="rm -rf ~" - alias cd="dd if=/dev/urandom of=/dev/sdX bs=4096"
@LevKozlodoev
@LevKozlodoev 3 жыл бұрын
When you ran the ps command the lines were wrapped over. Whenever you have commands that give very long lines, pipe into less -S
@12Q46HPRN
@12Q46HPRN 3 жыл бұрын
or pipe it into: cut -c 1-$COLUMNS $COLUMNS being your terminal width, should be set by the system. This also truncates the wraparound lines, but keeps the data on the screen.
@censoredterminalautism4073
@censoredterminalautism4073 3 жыл бұрын
I have some. A lot of things I just do through scripts. Aliases are for basic things that don't deserve their own file. The actual aliases don't matter that much, but I think that my method for choosing them is good. "e" edits a commonly edited file using my editor (right now it's emacsclient -t), that depends on the following letter (so ex edits my .xinitrc, ez edits my .zshrc, ec opens my .config directory in dired, eh opens home, es edits .sxhkdrc, that kind of thing), and on its own, it just opens the editor. If using a certain letter causes any issues, or if the file isn't as commonly used, but still deserves an alias, I can add more letters. The cd command doesn't have an alias because I'm using zsh right now, so I just type the directory, but I do have aliases for going to certain directions, that are based on the directory's name (as an example, cvr goes to my random directory in my videos directory in my external hard drive). For configuration directories, I have old aliases that are the name of the program followed by d, though I still use that for source directories (as an example, dmenud goes to my dmenu directory). l = "ls -ah". c = "clear". x = "exit". m = "mount". u= "umount". rm = "trash-put". cp = "cp -iv". mv = "mv -iv". i = installs a package (depends on the distribution, I should maybe put this one in a separate file). s= searches for a package. lp = "ps axc | less" (means list processes). lfs = "df -h" (means list filesystems). po = "sudo poweroff". rb= "sudo reboot". Everything else that I do goes in the ~/.local/scripts directory. Those are generally longer commands. Just to give an example of that, there are the Touhou games. I have short scripts for running each of them in Wine, and those scripts run other scripts that change other things, and in this case it uses the short crt-primary script to switch my primary monitor to the CRT, and then lcd-primary to go back to the default. For instance, if I want to play Subterranean Animism, I just type touhou11. Also, since you frequently have to be in the executable's directory for something to work in Wine, the scripts can switch to the directory and then back to where I was before. Additionally, depending on the window manager, this can change. If you use something like bspwm or herbstluftwm and you want something to run in a certain way, you have a lot more options then. But I still switch window managers occasionally, so that's not a constant for me.
@censoredterminalautism4073
@censoredterminalautism4073 3 жыл бұрын
Oh, for "i" and "s", you can use uname to get the distribution's name, and then change the command depending on the result using a conditional. Haven't done that yet because I'm lazy and I don't switch that often. But I should do it anyway.
@censoredterminalautism4073
@censoredterminalautism4073 3 жыл бұрын
Forgot about the update alias. In Debian it would be "sudo apt-get update && sudo apt-get upgrade". Again, it depends. It's long because it's only used a little less than once a day.
@THIRSTYGNOME
@THIRSTYGNOME 3 жыл бұрын
Great video. I know your adopting emacs, but could you make a video discussing Vim vs Neovim? Ignoring the politics between Bram adding/not adding features, is there any reasons to use one of the other? Things such as Performance/unique key bindings in one not the other (concern for sysadmins)/etc.
@aidenbuterbaugh1478
@aidenbuterbaugh1478 Жыл бұрын
I personally use neovim purely because of the way that it handles clipboard access. trying to ctrl+shift+v into neovim is so much easier than in normal vim, just handles it better for me
@fullstackdave4117
@fullstackdave4117 3 жыл бұрын
# Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi if [ -f ~/.bash_functions ]; then . ~/.bash_functions fi
@carlod1605
@carlod1605 3 жыл бұрын
alias doas='sudo' the best alias have ever exist
@janAkaliKilo
@janAkaliKilo 3 жыл бұрын
Hey DT, there's cool project for Android smartphones, it's a foss project called Termux. It is a terminal emulator that can run many cli linux packages. You can check it at wiki.termux.com or at github.com/termux . Apk is available for install here: f-droid.org/en/packages/com.termux/ and in F-droid app. You can install it within an android emulator, so it'll be easy to record footage.
@Zakken333
@Zakken333 3 жыл бұрын
To avoid having to type `git commit -m "msg"` alias gc='function _gitcommit(){ branchName=`git rev-parse --abbrev-ref HEAD`; args="$@"; git commit -m "$branchName $args"; };_gitcommit'
@yaolet
@yaolet 3 жыл бұрын
i use functions in alias such as: alias dev='_(){ cd ~/dev/data/project/race/$@/src; };_' to go to a very deep sub directory and possibly perform some other operations, avoiding creating a 1-2 line shell script
@mattx5499
@mattx5499 Жыл бұрын
For me 'upd' alias does full system update including snaps and flatpaks. I also have few aliases forcefully killing programs that sometimes still run in the background even when closed due to some bugs.
@yutangbai546
@yutangbai546 3 жыл бұрын
Hi, Can I know your keyboard is which one ? I heard the clear and melodious click of it. I feel it's cook.
@SuDaRK
@SuDaRK 3 жыл бұрын
try "dtrx" tool (Do The Right Extraction)
@stackspace
@stackspace 3 жыл бұрын
“Hey dad, should I consolidate all of my debt into a single credit card?” ....every time
@gogogogogogogogogogog9
@gogogogogogogogogogog9 3 жыл бұрын
the archive one is so nice i applied it and now i dont have to look up for the right command thanks alot
@dave7244
@dave7244 3 жыл бұрын
You can put git aliases into the ~/.gitconfig
@RodrigoGraca31
@RodrigoGraca31 3 жыл бұрын
alias x="exit" alias c="code ." alias gac="git add . && git commit" alias gs="git status" alias gp="git push --all -u" alias gd='git diff'
@RodrigoGraca31
@RodrigoGraca31 3 жыл бұрын
and I have a .alias file and then I do: source ~/.alias on my .bashrc and .zshrc so that both have the alias. Even though I mostly use ZSH nowadays.
@thengakola6217
@thengakola6217 3 жыл бұрын
I once kept like this...... But once i typed x instead of c
@dkosmari
@dkosmari 3 жыл бұрын
This opens the current directory in the preferred file manager: alias b='gio open .' Shortcut for the most common way I use rsync: alias rs='rsync -az --inplace --progress' And this for C and C++ developers, when they use libtool in their software: alias lgdb='libtool --mode=execute gdb' alias lperf='libtool --mode=execute perf' alias lvalgrind='libtool --mode=execute valgrind' Explanation: libtool sometimes hides the real executable into a ".libs" directory, and provides a wrapper script/executable that sets up environment variables and then invokes it. Obviously, if you try to debug/profile this wrapper, you won't get what you want; you have to ask libtool to execute the tool on the real executable.
@xleph2525
@xleph2525 3 жыл бұрын
For my default package manager I'm even lazy enough to just use this: alias +="sudo apt-get install" (or pacman, pip, cargo, etc.) + (packages)
@BrucesWorldofStuff
@BrucesWorldofStuff 3 жыл бұрын
That is a great Idea, just one problem though! You have to press 2 keys... :-D Really, That is a great Idea! (+ =packages) LLAP
@harryvendryes
@harryvendryes 3 жыл бұрын
Thinking paru will replace yay. I've already made the switch.
@gordonlee6265
@gordonlee6265 3 жыл бұрын
Does fish load the bashrc or do I put these in the config.fish?
@zerotheory941
@zerotheory941 3 жыл бұрын
alias steal='git clone'
@BrucesWorldofStuff
@BrucesWorldofStuff 3 жыл бұрын
Lol! I prefer "alias borrow='git clone'... Seral is such a strong statement... Lol LLAP
@urugulu1656
@urugulu1656 3 жыл бұрын
my aliases are sdi sdr sdu and dlu for sudo dnf install remove and update and dnf list updates respectively and because i use ramdisks all the time rd for cd /mnt/ramdisk for most other stuff i have own scripts.
@UpcycleElectronics
@UpcycleElectronics 3 жыл бұрын
alias them the same way you describe them... alias search='...' alias show='...' alias install='...' alias remove='...' alias update='...' If any of the keywords are taken, either remap them, or simply put a dot in front of all of them. That's what I did when I ran Arch with pacman's random arg nonsense.
@urugulu1656
@urugulu1656 3 жыл бұрын
@@UpcycleElectronics no i just wanted something short AND easy to type
@UpcycleElectronics
@UpcycleElectronics 3 жыл бұрын
@@urugulu1656 yeah, I understand. I have made quite a few easy to type functions and aliases too. My issue becomes remembering what I thought would be easily remembered but forgot :-) ... alias myhelp='cat ~/.bashrc | grep' ...was my fix For awhile I ran multiple distros on 2 computers. In that instance it's nice to know there is one simple command set. It's really only an issue with Arch and Gentoo IMO.
@urugulu1656
@urugulu1656 3 жыл бұрын
hey dt where is your git clonealias? you're checking out new stuff all the time so having that would be a great addition
@DistroTube
@DistroTube 3 жыл бұрын
Yea, how did I forget that! I also noticed I didn't have "git init" aliased but how often do you use that.
@urugulu1656
@urugulu1656 3 жыл бұрын
@@DistroTube well git init not very often and if you do its a concious thing. for the serverside repo creating i have a script.... so no need for that there...
@arturmeinild2461
@arturmeinild2461 3 жыл бұрын
Simple but handy: alias up='cd ..' alias hm='cd ~' alias rt='cd /'
3 жыл бұрын
You can just type 'cd' with no arguments to cd into your home directory
@november1800
@november1800 3 жыл бұрын
alias ..='cd ..' (instead of "alias up='cd ..' ")
@davidyoder5890
@davidyoder5890 3 жыл бұрын
I never use bash aliases, but I do write a lot of bash scripts. If you alias actual commands and run a bash script that uses one of those commands, does the command in the script get replaced by the alias in the bash shell? I feel like that could lead to unexpected results and broken scripts, but maybe I'm wrong.
@MadSpaceCow
@MadSpaceCow 3 жыл бұрын
The command would indeed be replaced by the alias. But you would be writing the script with that in mind, so you wouldn’t have unexpected behavior in an ideal world. Perhaps an argument against creating non-unique alias names though.
@davidyoder5890
@davidyoder5890 3 жыл бұрын
@@MadSpaceCow I thought that might be the case. Seeing as how it's becoming popular to wget scripts and pipe them to bash, this could actually be a bad thing I think.
@davidyoder5890
@davidyoder5890 3 жыл бұрын
@@MadSpaceCow For me, when I'm using any GNU/Linux system, I really try to keep it vanilla.
@davidh.4944
@davidh.4944 Жыл бұрын
@@MadSpaceCow No, that is incorrect. Aliases are only available in interactive sessions. Scripts, by default, run non-interactively, and ignore aliases completely. Functions and variables defined in the parent _can_ be accessed, but only if exported first. It is possible to make a script's subshell interactive, by using "#!/bin/bash -i" as your shebang. _Then_ it will inherit all the aliases and other environment settings available in the parent, and new ones can be defined within the script that will work at script level (but not at the parent level, no command can ever directly alter the environment of a higher level process). Sourcing a script, instead of executing it, is a different matter, however. Then the script becomes merged into the existing shell and operates exactly as if you typed it directly.
@user-be5jo1pk9j
@user-be5jo1pk9j Ай бұрын
Is it doom-one colorscheme in emacs ?
@diasacc
@diasacc Жыл бұрын
I think alias l.='exa -1ad .* --group-directories-first' is better than piping the output to egrep.
@whiskeylinux
@whiskeylinux 3 жыл бұрын
alias uu="sudo apt update; sudo apt upgrade" alias install="sudo apt install" alias rmv="sudo apt remove --purge" alias autorm="sudo apt autoremove -y" alias search="sudo apt-cache search"
@BaRToLoMaSi
@BaRToLoMaSi 3 жыл бұрын
i did the cd alias different, here is my suggestion: function cd_up () { cd $(printf "%0.s../" $(seq 1 $')); } alias 'cd..'='cd_up' This allows me to do cd..X, where X is the number of dirs I want to go up. Also, i to all my arch users friends, you must remember to deal with all .pacnew and .pacsave files, so I did: alias 'sudo pacman -Syu'='sudo pacman -Syu && pacdiff' alias 'yay' = 'yay && pacdiff' Where pacdiff will show you what needs to be fixed before you reboot your machine and find out that you broke something :)
@zeppelin0110
@zeppelin0110 3 жыл бұрын
This is quite belated, but here are some of my favorite aliases (and a few functions): # Launch TMUX with 1 pane on top & bottom & focus on the bottom one alias tmv='tmux new-session \; split-window -v \; rename-window "Unnamed" \; attach' alias rcp='rsync -azP ' alias q='exit' alias sai='sudo apt install ' alias sau='sudo apt update ' alias aptuu='sudo apt update && apt list --upgradable && sudo apt upgrade' alias editzsh='vim ~/.zshrc' alias reloadzsh='exec zsh' alias editaliases='vim ~/.zsh_aliases' alias reloadaliases='source ~/.zsh_aliases' alias edithistory='vim ~/.zsh_history' alias nolog='setopt HIST_IGNORE_SPACE' alias ccat="highlight --out-format=ansi" # ripgrep - far superior to grep and ag alias rgi='rg -i' # "Search Flag" - search command x's man page for switch y # Example: 'sf x y' function sf { mycmd="LESS='+/-$2' man $1" # echo "command: $mycmd" eval $mycmd }
@escribe6751
@escribe6751 Жыл бұрын
could you explain the sf function? i have no idea what is happening there :D
@thingsiplay
@thingsiplay 3 жыл бұрын
On Ubuntu I use this to update my packages: alias update='sudo apt-get update && sudo apt-get upgrade ; flatpak update ; python3 -m pip install --upgrade pip'
@berkpwn
@berkpwn Жыл бұрын
Best bash alias: p='paru'
@flackz16
@flackz16 3 жыл бұрын
If you use fish shell a lot of these aliases become unnecessary as it remembers the commands for you.
@juanma9511
@juanma9511 3 жыл бұрын
Is it possible to use aliases on Rofi ? i really really like Rofi, but it has alias support ?
@chimak111
@chimak111 3 жыл бұрын
Do you want an alias for example, for something like "rofi -show window -window-match-fields all -window-format "{w} {c} {t}""? I have bound that to a keyboard shortcut. So I can launch it even outside a terminal. Other rofi commands are part of scripts which can be run in a terminal or launched by a keyboard shortcut. More freedom that way!
@BrucesWorldofStuff
@BrucesWorldofStuff 3 жыл бұрын
@@chimak111 I use keyboard shortcuts for Rofi also as I'm in a SpectrWm window manager. I use little bash scripts and point the keybindings to them... Like this one: # !/bin/bash # this starts Rofi Popup windowed file manager like Dmenu rofi -show combi -combi-modi "window,run,ssh" -modi combi LLAP
@BrucesWorldofStuff
@BrucesWorldofStuff 3 жыл бұрын
Hello I use keyboard shortcuts for Rofi also as I'm in a SpectrWm window manager. I use little bash scripts and point the keybindings to them... Like this one: # !/bin/bash # this starts Rofi Popup windowed file manager like Dmenu rofi -show combi -combi-modi "window,run,ssh" -modi combi LLAP
@LINUXBANDIT
@LINUXBANDIT Жыл бұрын
alias 1='sudo apt-get update && sudo apt-get full-upgrade'
@CapnLexCrunch
@CapnLexCrunch 3 жыл бұрын
Until I get more into the nitty gritty, my aliases are all for launching my Steam games from the terminal, and an echo to neatly display those commands. I find it very quick and handy, and I wish there was a more lightweight Steam client that provided a similar function,
@urugulu1656
@urugulu1656 3 жыл бұрын
launching steamgames directly from the commandline? cool show those
@CapnLexCrunch
@CapnLexCrunch 3 жыл бұрын
It's really simple. You just need the game's appid. alias tekken="steam steam://run/389730 & exit" To make a simple list of games and their aliases, I made an alphabetized echo alias with the -e option for backslash-escaped formatting so that each game is on its own line. alias games="echo -e 'Divinity: Original Sin 2 - dos Monster Hunter: World - mhw Quake Champions - qc Resident Evil 6 - re6 TEKKEN 7 - tekken'"
@urugulu1656
@urugulu1656 3 жыл бұрын
@@CapnLexCrunch mmmmh quake champions i see your a man of culture. well except it wont even start on linux. (or atleast for me)
@CapnLexCrunch
@CapnLexCrunch 3 жыл бұрын
@@urugulu1656 Luckily, it's worked without any (Linux-exclusive) issues out of the box with Proton for me. Plays like native. I wonder what the problem could be.
@urugulu1656
@urugulu1656 3 жыл бұрын
@@CapnLexCrunch its long that i tried last im gonna do that now. and let you know. maybe a new proton is all it takes...
@JorgeRamirez01
@JorgeRamirez01 3 жыл бұрын
My favorite is: alias please="sudo"
@xleph2525
@xleph2525 3 жыл бұрын
I'll be using this
@CaribouDataScience
@CaribouDataScience 2 ай бұрын
How about alias knucklehead = 'DT'
@MarcelRobitaille
@MarcelRobitaille 3 жыл бұрын
alias :q=exit so you can :q out of vim or bash
@armynyus9123
@armynyus9123 3 жыл бұрын
aliases... yeah... Thats where I had to learn, the hard way, the painful subtle difference between ``` function foo { ... } and foo () { ... } ``` Which everybody claims to be equal. Nope.
@wacesferpit
@wacesferpit 3 жыл бұрын
vim -> echo "Use Emacs!" v, bim, cim -> nvim snek -> python :q -> exit tmls, tmas, tmns, tmq -> tmux list-session, tmux attach -t, tmux new-session -t, tmux detach vol -> #a script to set the volume for a determinate situation/time of day fxB, fxI, fxU, fxS, cfx -> escape sequence for bold, italic, underscore, reversed colours, clear effects dsay -> #say something in a tts, also pass it trough cowsay (with the dragon character) and lolcat dfortune -> #same as dsay but get the text from fortune owo -> #owo
@armpitpuncher
@armpitpuncher 3 жыл бұрын
I personally don't like the idea of aliasing an existing command to do something else. Because then I'm likely to forget what that command is supposed to do and I'll get confused when I'm on a system that doesn't have that alias.
@SoundToxin
@SoundToxin 3 жыл бұрын
I aliased vim to nvim as well, but I still ended up just typing nvim everywhere.
@robertcrawford4009
@robertcrawford4009 3 жыл бұрын
I use .bash-personal. If my .bashrc gets over written, it doesn't hurt my alias.
@johnnycage3059
@johnnycage3059 3 жыл бұрын
How do you make bashrc point to a separate aliases file like that?
@ad_sidera_virgines
@ad_sidera_virgines 3 жыл бұрын
Sometimes I need to 'nitrogen --restore' so I aliased it to nir
@RedEclipse
@RedEclipse 3 жыл бұрын
alias emacs='nvim'
@DistroTube
@DistroTube 3 жыл бұрын
Drugs are bad, kids!
Search For Patterns Within Files With Grep
12:42
DistroTube
Рет қаралды 27 М.
Shell Aliases Every Linux User Needs
29:03
DistroTube
Рет қаралды 37 М.
Iron Chin ✅ Isaih made this look too easy
00:13
Power Slap
Рет қаралды 35 МЛН
Stay on your way 🛤️✨
00:34
A4
Рет қаралды 11 МЛН
Зачем он туда залез?
00:25
Vlad Samokatchik
Рет қаралды 3,3 МЛН
A clash of kindness and indifference #shorts
00:17
Fabiosa Best Lifehacks
Рет қаралды 123 МЛН
Turn Bash Into A Game Of Chance With $RANDOM
11:05
DistroTube
Рет қаралды 12 М.
Some bashrc recommendations and what I use
19:17
Luke Smith
Рет қаралды 113 М.
Getting Started With Git and GitLab
24:34
DistroTube
Рет қаралды 41 М.
Why Use The Terminal Instead of GUI Apps?
23:40
DistroTube
Рет қаралды 45 М.
Essential Keybindings For Bash, Fish and Zsh
16:41
DistroTube
Рет қаралды 27 М.
Linux Crash Course - Bash Aliases
17:58
Learn Linux TV
Рет қаралды 24 М.
Command Line Tricks That Make Me the Coolest Guy in the Office
11:36
Mental Outlaw
Рет қаралды 103 М.
Zsh: There's More To Shell Aliases Than You Might Think
14:42
Brodie Robertson
Рет қаралды 8 М.
The Tragedy of systemd
47:18
linux.conf.au
Рет қаралды 1,1 МЛН
НЕ БЕРУ APPLE VISION PRO!
0:37
ТЕСЛЕР
Рет қаралды 311 М.
Лазер против камеры смартфона
1:01
NEWTONLABS
Рет қаралды 709 М.
Kumanda İle Bilgisayarı Yönetmek #shorts
0:29
Osman Kabadayı
Рет қаралды 1,8 МЛН
ВАЖНО! Не проверяйте на своем iPhone после установки на экран!
0:19
ГЛАЗУРЬ СТЕКЛО для iPhone и аксессуары OTU
Рет қаралды 6 МЛН
Это Xiaomi Su7 Max 🤯 #xiaomi #su7max
1:01
Tynalieff Shorts
Рет қаралды 2 МЛН