
Shell Aliases Every Linux User Needs - DistroTube
video description
Hardware device variants I have to swap out frequently change their -xrandr- name and their -xinput- id number.
To get them to work properly, I have to manually run the command...
xinput map-to-output
Anyone know how I can automate the process via an alias triggered by a user alias, say, -gset-
which runs xrandr, reads the name of the HDMI device, then runs the xinput command and reads the relevant id number
then proceeds to run the command xinput map-to-output
Date: 2022-03-30
Related videos
Comments and reviews: 9
gwgux
An alias I recommend all new Linux users use while they are learning the terminal:
empdir='rm -ir ./-'
To empty out the current directory of any files and sub directories, but don't ever run it while you're at root (/). It's a safeguard to make sure you put the leading . before the / under a different name so you avoid running rm -rf /- when you're tired late at night working on something and not seeing straight. At work it can be a resume generating event. At home, all your precious -educational videos- will be done with your PC. ;)
I personally mostly use aliases for some safeguards, customizing the format of command output (like the ls='ls-lah' example), and for calling scripts with some of the required arguments filled in from my dedicated script directory on the system (I generally try to avoid updating the PATH variable when I can).
reply
An alias I recommend all new Linux users use while they are learning the terminal:
empdir='rm -ir ./-'
To empty out the current directory of any files and sub directories, but don't ever run it while you're at root (/). It's a safeguard to make sure you put the leading . before the / under a different name so you avoid running rm -rf /- when you're tired late at night working on something and not seeing straight. At work it can be a resume generating event. At home, all your precious -educational videos- will be done with your PC. ;)
I personally mostly use aliases for some safeguards, customizing the format of command output (like the ls='ls-lah' example), and for calling scripts with some of the required arguments filled in from my dedicated script directory on the system (I generally try to avoid updating the PATH variable when I can).
reply
Kenny
My favorite has got to be -alias pacman=-sudo pacman --noconfirm- - - yes, I actually have an alias to A, force the Arch/EndeavourOS package manager to run as root all the time, and B, make it always install stuff without confirmation, because, well, many times when you-re installing software you just want to get it over with.
Making a video about systemd timers would be helpful as far as updates go, because that makes even the aliases for updating the system that you mentioned unnecessary by automatically running update commands in the background at specified intervals.
reply
My favorite has got to be -alias pacman=-sudo pacman --noconfirm- - - yes, I actually have an alias to A, force the Arch/EndeavourOS package manager to run as root all the time, and B, make it always install stuff without confirmation, because, well, many times when you-re installing software you just want to get it over with.
Making a video about systemd timers would be helpful as far as updates go, because that makes even the aliases for updating the system that you mentioned unnecessary by automatically running update commands in the background at specified intervals.
reply
Keith
While watching I opened up my .bashrc file and discovered this if statement
# if [ -f -/.bash_aliases ]; then
# . -/.bash_aliases
# fi
# I added the comment hashtags
So I created a .bash_aliases file. The advantages are I don't modify the original, and my aliases are portable and if necessary temporarily.
While playing with this I discovered the double quote >-< does not always work. when I changed it to a single quote >'< the syntax error was fixed so I would recommend using the single quote.
reply
While watching I opened up my .bashrc file and discovered this if statement
# if [ -f -/.bash_aliases ]; then
# . -/.bash_aliases
# fi
# I added the comment hashtags
So I created a .bash_aliases file. The advantages are I don't modify the original, and my aliases are portable and if necessary temporarily.
While playing with this I discovered the double quote >-< does not always work. when I changed it to a single quote >'< the syntax error was fixed so I would recommend using the single quote.
reply
Garry
How To Create An Alias That Only Type The Command But Not Execute The Command ???
Example -
Let Say I Create Following Alias
alias custominstall='sudo apt install'
When I Use This alias custominstall It Will Try To Execute The Command sudo apt install
But I Don't Want That To Happen - All I Want That It Only Type The Command In The Prompt But Not Execute The Command Because I Want To Use For Different Stuff All The Time ???
reply
How To Create An Alias That Only Type The Command But Not Execute The Command ???
Example -
Let Say I Create Following Alias
alias custominstall='sudo apt install'
When I Use This alias custominstall It Will Try To Execute The Command sudo apt install
But I Don't Want That To Happen - All I Want That It Only Type The Command In The Prompt But Not Execute The Command Because I Want To Use For Different Stuff All The Time ???
reply
cptmc
War story time. The cringe is real. Please sudo -k at the end of an alias with sudo. At some point in your career you'll run into code where a sysadmin only used bash and thought they'd save time with some elaborate .profile and .bash_aliases and some cron job. Then they'll retire and the poor FNG will get blindly tossed in by a dude bro manager who never took a CS course... And it'll be a sad day XD
reply
War story time. The cringe is real. Please sudo -k at the end of an alias with sudo. At some point in your career you'll run into code where a sysadmin only used bash and thought they'd save time with some elaborate .profile and .bash_aliases and some cron job. Then they'll retire and the poor FNG will get blindly tossed in by a dude bro manager who never took a CS course... And it'll be a sad day XD
reply
Christian
Okay, I have to comment, 'cause this is driving me crazy. You're the second person I've seen describe GNU Nano as confusing... which confuses me because literally all the important keybinds and what they do are listed at the bottom, including one for the help menu. How is Nano more confusing than VIM?
Disclaimer: I personally prefer vim and am only asking out of genuine curiosity.
reply
Okay, I have to comment, 'cause this is driving me crazy. You're the second person I've seen describe GNU Nano as confusing... which confuses me because literally all the important keybinds and what they do are listed at the bottom, including one for the help menu. How is Nano more confusing than VIM?
Disclaimer: I personally prefer vim and am only asking out of genuine curiosity.
reply
FalcoGer
You think of commands you often run in the terminal and you come up with -using the package manager-? I do that once a day to do an update. Do you know how often I run -ls-, -cd-, -rm-, -mkdir- or -vim-? Besides that I just write -sudo apt- and my shell proposes autocomplete -sudo apt update && sudo apt upgrade-
reply
You think of commands you often run in the terminal and you come up with -using the package manager-? I do that once a day to do an update. Do you know how often I run -ls-, -cd-, -rm-, -mkdir- or -vim-? Besides that I just write -sudo apt- and my shell proposes autocomplete -sudo apt update && sudo apt upgrade-
reply
jan
I think autocomplete is more important than aliases. 99% of commands I type is the commands I already typed before. With zsh or fish shell I could easily pull any long commands from history by just typing beginning of line + couple -UP- presses.
reply
I think autocomplete is more important than aliases. 99% of commands I type is the commands I already typed before. With zsh or fish shell I could easily pull any long commands from history by just typing beginning of line + couple -UP- presses.
reply
Alexander
The most commonly used:
alias ls='ls --color=auto'
alias ll='ls -alFX --group-directories-first --time-style=long-iso'
alias saulu='sudo apt update && apt list --upgradable && sudo apt upgrade'
alias untar='tar xvf'
reply
The most commonly used:
alias ls='ls --color=auto'
alias ll='ls -alFX --group-directories-first --time-style=long-iso'
alias saulu='sudo apt update && apt list --upgradable && sudo apt upgrade'
alias untar='tar xvf'
reply
Add a review, comment
Other channel videos















