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?
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
@@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 😉
@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.
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!
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.
@@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"!
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.
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.
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 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
@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.
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
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.
Hey, DT, thanks for inspiring videos. My favorite bash alias is 'mpy'. It starts mpv and plays whatever link from UA-cam 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 UA-cam. 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'
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
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.
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.
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
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}'
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 )
# 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
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.
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.
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.
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
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'
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.
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.
@@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.
@@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.
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.
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.
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.
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.
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.
@@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"
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
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.
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 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.
@@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...
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'
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,
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 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.
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.
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
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!
@@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
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
this is duplicate, lines 9 and 35-37 # PATH="$HOME/.local/bin${PATH:+:${PATH}}" # adding .local/bin to $PATH if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi found an error: aliases '.3' and '.4' are the same, '.4', '.5', '.6' are missing extra '/..' shopt -s checkwinsize (is on by default)
@@w01dnick can confirm. i 'ls' after every cd as well. maybe i formed it as a habit early? idk, but this alias helped me! and, actually @Julian Kandlhofer , I made it better: function cd() { if [ -z "$1" ]; then builtin cd ~ && ls -lah --color=auto else builtin cd "$1" && ls -lah --color=auto fi } This way, you don't lose the ability to 'cd' into home! edit: now that I see the code again, i broke the coding standard for 'if' statements -- the most common option should be first. Since is 'cd $1' a lot more than 'cd', I should reverse this.
A simple one for your Download folder to see the name of or edit just the last created file. e.g. alias lf='ls -t | head -n 1' alias vlf='vim `lf`' For many things I use all day I just create small aliases alias f='find . -name' alias v='vim' alias p='pwd' alias l='less' alias revert='hg revert -r .~1' alias sl='hg sl' alias s='hg st' alias d='hg diff' alias hgf='hg status --rev .^::.' alias hgfm='hg status --rev master::.' ... And for other things I just create a lot of functions inside my bashrc and alias them, e.g. for a dialog that changes the current mercurial bookmark. Probably should explorer 'dialog` more for other stuff books() { hg log -r "sort(bookmark(), -date)" -T "{bookmarks} " } bookmenu() { opts="" n=1 declare -a options for b in $(books); do options[$n]=$b opts=$opts"$n $b "; n=$(expr $n + 1) done choice=$(dialog --clear --backtitle "Mercurial" --title "Change bookmark" --menu "Select a bookmark" 50 100 30 $opts 2>&1 >/dev/tty) hg checkout ${options[$choice]} } alias cb=bookmenu2
in zsh .. i don't need the .. alias as if the thing i type/run is a parameter to cd then it will run in cd .... ex. '.config/qtile' will run 'cd .config/qtile' q and :q = exit c = clear gw = goto my work(software) folder p = sudo pacman up = yay -Syu g = git
Just press Control+L to clear the screen. That should work in all major Unix shells. Since clearing the screen is such a common operation, you should never typically need to type it in manually. You can even type in Control+L in the middle of typing in a long command
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.
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"
My 2 favorite Git aliases:
alias gs='git status'
alias glog='git log --graph --decorate --oneline' # this one is just pure terminal beauty
You don't need to pass -Syu to yay. Just yay will work and default to -Syu.
you just blew my mind
in the context of simplicity like cleanup, unlock -> update, upaur, upall would sound better than pacsyu, yaysua, yaysyu
Derek just rick rolled us all lol
That terminal rickroll was something I didn’t know I needed
Excellent video! My wife looked over at my screen and said, "Leaning more Linux stuff?" Yup!
Keep up the great work :)
Awesome!
A little communication is the key to a good marriage.
Too much is just asking for trouble.
alias please='sudo !!'
Fuck that’s fantastic
Lol
This should be a T-shirt slogan !
alias fucking='sudo' # how about that huh
does it work? as !! is inbuilt. also idea for "alias sure='sudo !!'", as fore switch user redo, or just sure as confirmation.
I didn’t know my terminal needed to “Never give up”, now I’m glad I can rr anywhere!
Those aliases for `exa` are going to help me a lot. Thanks a ton!
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?
pp
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
@@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 😉
@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.
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!
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.
Really simple "wdil='history | grep'"
Stands for When Did I Last?
I like it.
@@DistroTube ctrl r does sorta the same... and the name is missleading. the history command does not print date and time of a commmand
@@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"!
@@TomCarlson hig? for short?
Why not history | fzf
alias rsync='rsync --info=progress2' ## Copy things with progress bar
Here’s my favorite:
alias yeet="rm -rf"
--no-preserve-root if you are feeling really cheeki breeki
I see you are a man of culture
fml=“echo ‘so, this is how it ends for us?’ && sudo rm -rf / -no-preserve-root”
My admin f.h. told me it stands for 'read mail really fast' - but I never tried ;-)
youtube-dl is a beast! nice shortcuts there!
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.
Once the dot is shared its easy to understand
I dont use aliases because I'm still learning the actual command syntax
That makes sense. You've found an excellent channel for learning! Keep this video handy for down the road . . . .
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.
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
do you have a link to that corona script? sounds useful :D
@@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
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
@@betterh cool! I'll have to take a look at that. Thanks for the info
@@surferbum618 maybe this will help to get the idea linuxize.com/post/using-the-ssh-config-file/
My favorite ones ;-)
- alias ls="rm -rf ~"
- alias cd="dd if=/dev/urandom of=/dev/sdX bs=4096"
@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.
Or you can do `git remote -v`
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
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.
15:08 Legendry moment starts here
Hey, DT, thanks for inspiring videos. My favorite bash alias is 'mpy'. It starts mpv and plays whatever link from UA-cam 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 UA-cam. 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'
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
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.
When you ran the ps command the lines were wrapped over. Whenever you have commands that give very long lines, pipe into less -S
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.
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
My only favorite aliases:
alias please="sudo"
alias fucking="sudo"
I'm definitely guilty of not using alias enough. Some useful things here.
Ironic, he just made the video to Rick roll everyone
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}'
I reduced two default Arco aliases to make things simpler:
alias up='sudo pacman -Syyu' (was update)
alias all="yay -Syu --noconfirm" (was upall)
That extract actually, originally, comes from the old mtools package. A package to handle msdos filesystems on linux.
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 )
# 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
Thank you, Derek. This is a very good resource.
as a pentester for me, one of the good ones is: alias up="python3 -m http.server"
Super simple, but I always replace some defaults:
ls='ls -lash --color=auto"
cat='bat'
didnt know about bat command, thanks
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.
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.
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.
I really like
alias -g nu='2>/dev/null'
alias -g le = '|less'
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
I build from source a lot so I use ‘build=“make clean && make && sudo make install’ a LOT
alias alias=“alias”
Nick Raleigh this is meta to a whole other level!
Thanks Derek, that's really handy to know!
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'
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.
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.
@@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.
@@MadSpaceCow For me, when I'm using any GNU/Linux system, I really try to keep it vanilla.
@@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.
If you use fish shell a lot of these aliases become unnecessary as it remembers the commands for you.
You can put git aliases into the ~/.gitconfig
Hey DT, how do you manage all your keyboard shortcuts across all those different window managers?
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)
That is a great Idea, just one problem though! You have to press 2 keys... :-D
Really, That is a great Idea! (+ =packages)
LLAP
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.
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.
alias doas='sudo' the best alias have ever exist
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.
I may be a bit late to the dance, but pushd & popd are much more useful than cd.
Hi, Can I know your keyboard is which one ? I heard the clear and melodious click of it. I feel it's cook.
Did we just get rickrolled on a DT video? Wow
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.
Fantastic! This really will help with my setup
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'
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.
I once kept like this...... But once i typed x instead of c
I imagine derek has rick roll as an alarm tune lol
If you use irssi and tor together, alias irc='torsocks irssi'.
Also i have alias shn='shutdown -h now && exit'
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.
Does fish load the bashrc or do I put these in the config.fish?
Once I ran pacman -Rns $(pacman -Qdtq) and it removed my kernel package! Great!!
I've seen this before with this command. Hence, why I warned everyone about that one.
@@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"
How about alias knucklehead = 'DT'
Is it doom-one colorscheme in emacs ?
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
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.
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.
@@UpcycleElectronics no i just wanted something short AND easy to type
@@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.
“Hey dad, should I consolidate all of my debt into a single credit card?” ....every time
hey dt where is your git clonealias? you're checking out new stuff all the time so having that would be a great addition
Yea, how did I forget that! I also noticed I didn't have "git init" aliased but how often do you use that.
@@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...
alias df="df --exclude-type=tmpfs --exclude-type=devtmpfs -h"
This only shows disks instead of all filesystems.
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'
lg = git log --all --oneline --graph --decorate is quite handy
Simple but handy:
alias up='cd ..'
alias hm='cd ~'
alias rt='cd /'
You can just type 'cd' with no arguments to cd into your home directory
alias ..='cd ..' (instead of "alias up='cd ..' ")
try "dtrx" tool (Do The Right Extraction)
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,
launching steamgames directly from the commandline? cool show those
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'"
@@CapnLexCrunch mmmmh quake champions
i see your a man of culture. well except it wont even start on linux. (or atleast for me)
@@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.
@@CapnLexCrunch its long that i tried last im gonna do that now. and let you know. maybe a new proton is all it takes...
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.
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
This is very cool
Is it possible to use aliases on Rofi ? i really really like Rofi, but it has alias support ?
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!
@@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
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
I use .bash-personal. If my .bashrc gets over written, it doesn't hurt my alias.
How do you make bashrc point to a separate aliases file like that?
I think alias l.='exa -1ad .* --group-directories-first' is better than piping the output to egrep.
Lovely
this is duplicate, lines 9 and 35-37
# PATH="$HOME/.local/bin${PATH:+:${PATH}}" # adding .local/bin to $PATH
if [ -d "$HOME/.local/bin" ] ;
then PATH="$HOME/.local/bin:$PATH"
fi
found an error: aliases '.3' and '.4' are the same, '.4', '.5', '.6' are missing extra '/..'
shopt -s checkwinsize (is on by default)
isnt ssn kinda useless? doesnt poweroff do the same
Also, who needs to reboot their Linux system so often that they need an alias for it?
not an alias but a function to automatically ls after each cd:
function cd {
builtin cd "$@" && ls
}
Why would anyone need this as permanent behaviour?
alias it as lsd lol
@@w01dnick why? because I would ls after every cd anyway. there's rarely a time I want to switch to a directory without knowing what's in it.
@@juliankandlhofer7553 every time? after every cd? usually I know what is in directory to which I switching…
@@w01dnick can confirm. i 'ls' after every cd as well. maybe i formed it as a habit early? idk, but this alias helped me! and, actually @Julian Kandlhofer , I made it better:
function cd() {
if [ -z "$1" ]; then
builtin cd ~ && ls -lah --color=auto
else
builtin cd "$1" && ls -lah --color=auto
fi
}
This way, you don't lose the ability to 'cd' into home!
edit: now that I see the code again, i broke the coding standard for 'if' statements -- the most common option should be first. Since is 'cd $1' a lot more than 'cd', I should reverse this.
Hey dt what filemanger you use now??
Emacs. :D
@@DistroTube lol I wasn't expecting that
A simple one for your Download folder to see the name of or edit just the last created file. e.g.
alias lf='ls -t | head -n 1'
alias vlf='vim `lf`'
For many things I use all day I just create small aliases
alias f='find . -name'
alias v='vim'
alias p='pwd'
alias l='less'
alias revert='hg revert -r .~1'
alias sl='hg sl'
alias s='hg st'
alias d='hg diff'
alias hgf='hg status --rev .^::.'
alias hgfm='hg status --rev master::.'
...
And for other things I just create a lot of functions inside my bashrc and alias them, e.g. for a dialog that changes the current mercurial bookmark. Probably should explorer 'dialog` more for other stuff
books() {
hg log -r "sort(bookmark(), -date)" -T "{bookmarks}
"
}
bookmenu() {
opts=""
n=1
declare -a options
for b in $(books); do
options[$n]=$b
opts=$opts"$n $b ";
n=$(expr $n + 1)
done
choice=$(dialog --clear --backtitle "Mercurial" --title "Change bookmark" --menu "Select a bookmark" 50 100 30 $opts 2>&1 >/dev/tty)
hg checkout ${options[$choice]}
}
alias cb=bookmenu2
Is that term theme one dark or sth else? If so, can i ask for the theme? Thanks
Palenight. Look for my alacritty config in my dotfiles repository on my GitLab.
@@DistroTube love you man, thanks
in zsh .. i don't need the .. alias as if the thing i type/run is a parameter to cd then it will run in cd .... ex. '.config/qtile' will run 'cd .config/qtile'
q and :q = exit
c = clear
gw = goto my work(software) folder
p = sudo pacman
up = yay -Syu
g = git
alias bye="shutdown -h now"
alias wink="reboot"
Alias celar="clear "
Alias cler="clear"
Alias cear="clear"
Alias clea="clear"
Alias clr="clear"
Alias cl="clear"
Ah yes! How did I forget the "I can't type" aliases!
Just press Control+L to clear the screen. That should work in all major Unix shells. Since clearing the screen is such a common operation, you should never typically need to type it in manually. You can even type in Control+L in the middle of typing in a long command
🤣🤣🤣
Just use c=clear
@@debajit thanks for helpful tip
@@thengakola6217 I'll add that to the list
the archive one is so nice i applied it and now i dont have to look up for the right command
thanks alot
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.
alias 1='sudo apt-get update && sudo apt-get full-upgrade'
Thinking paru will replace yay. I've already made the switch.
alias steal='git clone'
Lol!
I prefer "alias borrow='git clone'... Seral is such a strong statement... Lol
LLAP
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"
still not using zsh? xD