Tuesday, August 2, 2016

Fun with the alias command

While researching ways to maintain Pacman on my Arch Linux installation, I stumbled across someone's suggestion to create an alias to shorten an otherwise lengthy and hard to remember command. I gave this a shot but when I ran the command, I was getting an error. I double checked that the alias package was indeed installed in my system and after some research, found that I needed to edit my ~/.bashrc profile by adding the following text:


if [ -e ~/.bash_aliases ]
then
. ~/.bash_aliases
fi


From here, I needed to create the ~/.bash_aliases file:


touch ~/.bash_aliases


Finally, I set up as many random custom aliases I could think of to improve my workflow. Here is the output of the aliases I set up:


##Custom aliases##

#Auto-clean Pacman
alias pacclean='sudo pacman -R $(pacman -Qdtq)'

#Chdir to Downloads
alias cdd='cd ~/Downloads/'


#chdir up 2
alias up2='cd .. && cd ..'

#chdir up 3
alias up3='cd .. && cd .. && cd ..'

#cdhir home
alias cdhome='cd ~'

#Pacman Upgrade
alias pacgrade='sudo pacman -Syyu'

#Watching Netflix
alias netflixon='gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 7200 && gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 7200'

#Done with Netflix
alias netflixoff='gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 2700 && gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 900'

 

The Netflix aliases are due to the fact that I never seem to be able to get the Caffeine plugin to work and I would rather address this from the terminal anyways. netflixon sets auto-suspend to two hours for both A/C and battery. netflixoff sets it back to my preferred settings, 15 minutes on battery and 45 minutes on A/C. Note: the Netflix aliases will only work for GNOME.

Let me know what you think! Or if you see any errors or have other any useful aliases!

StumbleUpon

No comments :

Post a Comment