I am trying to create a permanent alias by either inserting it into the .bashrc directly (although it is just called bashrc in Fedora) located in /etc/ to the lowest part of bashrc using gedit. OR, by creating a .bash_aliases file, chmod to 755, and using the code below into bashrc.
if [ -f ~/.bash_aliases ]; then
But nothing is working, because of Set document metadata failed: Setting attribute metadata::gedit-encoding not supported Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported
There is /etc/bashrc which is a system wide bashrc that applies to every user.
There is also /home/USER/.bashrc which provides user specific configurations and would normally be where the user adds their own specific customizations.
Oh ****. I’d edit out the changes I’d made into it (even rm the .bash_aliases), although I think I had messed up. The warning Set document metadata failed::gedit- keep on appearing even when I exit gedit. And an interesting thing I just discovered, my VM’s snapshot (the one before I toy with the bashrc file), doesn’t seem to work properly. Nothing change when I restore it, as I can see the same browser pages and apps.
Should I reinstall gedit? Did that etc/bashrc edit cause this?
I found it, and now I’m trying to find .bashrc.d where I think it kept the aliases. Didn’t find it at home directory using ls -a.
User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
for rc in ~/.bashrc.d/*; do
if [ -f “$rc” ]; then
You don’t have to use the ~/.bashrc.d/ folder, it’s just a different way to organise things. You can also do it the typical way with sourcing your own ~/.bash_aliases.
If you want to use ~/.bashrc.d/, just create the folder, and put any shell scripts in there that you want to be sourced. The included snippet in the default ~/.bashrc loops through every file in ~/.bashrc.d/ and sources it for you.
You can organise the files any way you like. For example you could have 1 file for aliases like ~/.bashrc.d/aliases.sh and 1 file for environment variables ~/.bashrc.d/env.sh. Or you could have separate files for different programs/contexts.
/etc/profile.d is like the system-wide equivalent of this concept. If you manage a multi-user system and want to set things for everyone, you could use it, but for a single user it doesn’t really have any advantages over doing things in your home dir, and is less convenient as you need root permissions to edit. Also, packages may install files in /etc/profile.d so it’s a lot more crowded (you probably already have dozens of files in there).
I don’t know what causes your gedit errors. Were you using it with sudo? Generally you should not use GUI apps with sudo.
I have no idea where I got wrong again. It should be a simple matter of either adding the aliases directly into .bashrc. Or, creating a separate aliases file by including the below code too. But nothing happen.
# My custom aliases
if [ -f ~/.bash_aliases ]; then
alias dnfuu=sudo dnf update -y && sudo dnf upgrade -y
alias ooo=cd ~/XXX
alias kkk=cd ../../..
As for sudo gedit, I did actually. Guess I forgot adding sudo is pointless.