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 Answers
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.
-
I was just about to suggest this :) You can also replace
/usr/bin/nautilus /
byxdg-open /
in your.desktop
file. Thexdg-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.– rajMay 17 at 19:13 -
1I'd recommend to place personal .desktop-files in
~/.local/share/applications
.– mook765May 20 at 18:22
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.
-
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.– JVX901May 16 at 5:29
Files
) are horribly limiting (What You See Is All You Get) . Learning how to use the command line is a prerequisite to understanding Linux.