2

I have a fresh installation of Ubuntu 22.04. When I click on the 'Files' icon in the GUI dock the initial view defaults to showing the default directories my Home directory, i.e. Documents, Downloads and such like. I can understand why some people might want that but I don't. I'm learning about Linux and Ubuntu, and to gain familiarity with the directory hierarchy I would prefer the initial view to be of the root directory - such that I see directories such as bin, boot & dev. I know I can navigate there by clicking on 'Other Locations' and 'Computer' but that gets tedious after a while. Is there anything I can do to set the default location to the root directory? (I found an answer to this that's nearly ten years old now, and I cannot see the Nautilus file that it says must be edited at the location stated).

2
  • The directories you refer to such as bin are not meant to be accessed by the average user. As a regular user you will not be able to do anything with most of the files in the directories you mention.
    – David
    Apr 29, 2023 at 14:57
  • One of the first things to learn along the path to learning about Ubuntu Linux is that Graphical programs (like Files) are horribly limiting (What You See Is All You Get) . Learning how to use the command line is a prerequisite to understanding Linux.
    – waltinator
    Apr 30, 2023 at 1:27

2 Answers 2

2

After a little experimenting I figured out how to do this. In /usr/share/applications create a new text file called 'root-files.desktop' and put the following text in it:

[Desktop Entry]
Version=1.0
Name=Root
Exec=/usr/bin/nautilus /
Terminal=false
Icon=org.gnome.Nautilus
Type=Application

This will create a new entry in 'Show Applications' called 'Root'. Right-click on it and 'Add to Favourites'. A new folder icon just like the existing 'Files' icon will appear in the dock. Clicking on it opens Nautilus with the view that I wanted.

The operation of this icon is slightly different to that of the 'Files' icon because it always opens Nautilus at the '/' folder, whereas the 'Files' icon only opens it at Home if there is no instance already running. If one is already running it will open that instead - and that might not be at Home.

To create an icon that will always open at Home use the same method as for the 'Root' icon above. Name and edit it accordingly and point it to Home.

2
  • I was just about to suggest this :) You can also replace /usr/bin/nautilus / by xdg-open / in your .desktop file. The xdg-open command opens its argument in whatever GUI application it is assigned to be opened, like when you double-click on anything in the file manager.
    – raj
    May 17, 2023 at 19:13
  • 2
    I'd recommend to place personal .desktop-files in ~/.local/share/applications.
    – mook765
    May 20, 2023 at 18:22
1

Please don't do that. For the most part, you only need temporary root access, such as updating/upgrading system software and other applications,whether you do so via a command line in a terminal window or with a graphical user interface. And you're always prompted for your superuser (sudo) password before the OS lets you proceed.

Without a comprehensive understanding of Linux,roaming around root with root access makes it possible - and probable - that you'll unintentionally do irreparable damage to the operating system and any other data stored on your device. If that data is critical, sensitive or important to you and you have no way to restore it . . . Experienced system administrators don't even give themselves root access except when absolutely necessary.

1
  • My question is totally unrelated to the matter of root access as usually obtained by the 'sudo' that you mention. My question is about how to make the GUI 'Files' view open at the root folder. By 'root' I am referring to the top of the directory tree - the place I get to if I type 'cd /' - such that I then see the directories that I explicitly mention in the original post. I am not a normal user. I am studying Linux for its own sake and in doing so I want to become more familiar with the directory structure. Starting out at the top of the tree instead of Home would be a big help.
    – JVX901
    May 16, 2023 at 5:29

You must log in to answer this question.

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