0

Some of my root files like .cache, .config, .ipython, .xsession-errors, .bashrc, .bash_history, etc are dislayed in my home directory.The bash_history file keeps updating itself when i type anything in my terminal. Also when i tried to delete these files, my ubuntu crashes and i have to restart my laptop after which the files again appear in my home directory. When i try to move them in root, it shows that the files aldready exist in root and cannot be moved.I am very confused about what to do. It is not causing any error though but i think this should not be happening.

0

3 Answers 3

3

Those files are not "root" files. They are normal configuration or state files for your user account. Often, if a program does not find its configuration file on start, it will generate one using a unique name. Traditionally, this is a file in the home directory, starting with a . and somehow including the name of the program. Nowadays more and more programs put their configuration into the .config subdirectory.

What is probably confusing you is the fact that root is just a normal user with regard to this. So it has its own set of configuration files in /root/, which look just the same as the ones in your home directory.

The conventional . in front of those file names makes it hidden, so it does not appear in normal directory listings.

You should not delete them in normal operation. Instead, if you are confused by them, try to read the relevant programs manual pages and documentation (e. g. the bash manual page) for more information on what those files are doing and how to change them in a useful way.

1

Are you sure that these files are owned by root? Do a

cd ~
ls -la

to check. These files you mention would be generated by running user applications to save metadata and configuration choices made by the user (e.g. you). So, my guess is that you will find that these files (.cache, .config, . . . ) are owned by you, the user. They are supposed to be there, and all is well.

2
  • Oh ya. But i am able to see these hidden files in my files(not using terminal) like any other normal folder like downlaods or others which i create. How should i make them hidden again? Apr 11, 2018 at 11:20
  • Oh! In the Nautilus file manager, you can toggle the view of hidden files with CTRL-H or ticking/unticking the 'Show hidden files' from the Nautilus menu.
    – Martin W
    Apr 11, 2018 at 11:34
0

Those are configuration directories/files for your user account. They should be owned by you (your user ID). Check at the first level with

cd
ls -la

and deeper in the directory trees with

find ~ -ls | grep " root "

or limit the search to hidden directories

find ~/.[^.]* -ls | grep " root "

If some of these files are owned by root, you may get problems. It may work to change the ownership back to your user ID with the chown command. Maybe it is better to remove the configuration file(s) and let the program create a fresh configuration file for you.


If you run a program with a graphical user interface, GUI, with elevated permissions, with sudo, your own configuration for that program may be overwritten with a file owned by root, and the program may (will probably) fail, when you try to run it with normal permissions (as your user ID).

To run with elevated permissions you can use

sudo -H GUI-program

for example to edit a system file, which is owned by root

sudo -H gedit filename

which makes the system save the configuration in the correct location for the user root.

It is a good idea to perform tasks with elevated permissions with text mode tools (without graphical user interface), for example with the editor nano

sudo nano filename

If you are running Wayland (instead of Xorg), things are more complicated. See this link,

Why don't gksu/gksudo or launching a graphical application with sudo work with Wayland?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .