How to edit text files in qubes

When following guides, it is often asked to edit files, most often in template but sometimes in qubes themselves.

This is a guide that explain on a template by template basis, how to edit a file. The audience are beginners who do not know how to edit files from a terminal or very little experience with Linux.

Graphical text editor

debian-13 or fedora-43 based templates / qubes (not xfce!)

  • edit the qube settings
  • open tab “Applications”
  • click on “Text editor” on the left panel to highlight it
  • click on :arrow_right: to move “Text editor” to the list on the right
  • click on button “Ok”

Now you can start the editor in that qube from the Qubes OS menu. In the Text Editor program, click on the top left button “Open”, then click on the “Icon” in the small popup and browse the file system to find the file you want to edit. If you need to create a new file, write the content then save to the location you want.

Note that if you edit a file that should be edited as root (the admin user), Text Editor will automatically escalate privileges to have the permissions to edit the file, this is possible without password because qubes do not have a root password by default.

You can start the program from the terminal using gnome-text-editor and you can add a parameter to it for a file location if you want. This does not work if you add sudo to this command.

debian-13-xfce or fedora-43-xfce or fedora-42-xfce based templates / qubes

  • edit the qube settings
  • open tab “Applications”
  • click on “Mousepad” on the left panel to highlight it
  • click on :arrow_right: to move “Mousepad” to the list on the right
  • click on button “Ok”

Now you can start the editor in that qube from the Qubes OS menu. In the program Mousepad, click on the menu “File”, then click on “Open” browse the file system to find the file you want to edit. If you need to create a new file, write the content then save to the location you want.

Note that if you edit a file that should be edited as root (the admin user), you need to start Mousepad from the terminal to run it as root:

  • open a terminal in the qube
  • type sudo mousepad
  • you can close the terminal once you finished with Mousepad

Command line

If you are not afraid of typing commands in a terminal to edit a file, here is what you need to look for. It is a valuable skill to know how to use a terminal text editor.

All Qubes OS templates

All templates in Qubes OS feature two editors by default: nano and vi. You might want to do an internet search to figure how to use them, as they have no buttons to click to achieve actions, nor they have the usual shortcuts (like ctrl+s to save):

Some links to get started:

3 Likes

Although a simple internet search might be enough for some people to figure how to edit a file in Linux, I’m convinced a more tailored guide will be valuable because there are so many corner cases that people might be overwhelmed when trying to edit a file.

I’m also thinking about people trying to close vi.

1 Like

This might have been a joke, but I cant let this pass. vi is almost
universally available in Linux installs. It’s one of the simplest editors
there is, but has huge capabilities.
I have trained people in using vi, and after a few minutes they are capable
of basic editing. The rest can follow. Some people learn many features - some dont.

I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.

2 Likes

Great guide.

Perhaps you could mention Geany since that is the editor that comes with fedora xfce. Back when I was a newbie, one of the confusing parts of qubes was when fedora template moved to a new version and I had to figure out the name of the new text editor (from gedit to geany, for example)

Also perhaps nano, since that is a reliable option across the templates ?

For a lot of the basic stuff, I’d vehemently advocate for only explaining Qubes-specific things, and just linking to external (reliable*) docs for Linux-generic things. This is a good example where that’s really not necessary since a vast majority of the guide is Qubes-specific, but I’d hate to see hard work unnecessarily duplicated.

*

Maybe instead of linking directly, we could copy/paste with reference? Some things we would want to be static, and some updated. Food for thought.

1 Like

I found mousepad that is installed in xfce templates, I’ll check if geany is installed in both fedora and Debian templates and if it’s better than mousepad.

1 Like

The vi line was a reference to a popular joke about the fact that people can’t figure how to close vi.

It’s true both vi and nano are both installed in the templates, I’ll add about it, it make sense.

But if we want to reduce Qubes OS learning curve, I think it’s important to give new users the tools they might be the most comfortable with: GUI editors. And they are even installed by default! Of course, they can learn about whatever terminal UI text editor later.

I’ll add a pointer to vi and nano if they want to go further, so at least they can figure where to start.

1 Like

This is Qubes OS specific to me:

  • Qube settings to add a menu entry
  • Availability of default software depending on the template you installed
  • Different software available depending which Qube you want to open an editor inside

This is of course not a masterclass guide, but it’s specific enough to be useful for some. At worse, it’ll silently go forgotten in the forum and we can move on.

1 Like

I agree with @shantyspruce but… let’s try! :slight_smile: especially because:

  • the process of adding applications in itself is not well documented in the official docs
  • which external docs are we talking about? I frequently say like a robot “that’s not Qubes specific” but I must admit that I sometimes find myself lost on the internet while searching for a good and simple resource about basic Linux tasks…
  • I just have a comment: if this guide is for beginners, wouldn’t it be more useful for them to add the “Application Finder” (xfce) or the Gnome equivalent to their app menu instead? That’s an extra step but I suppose that they will not use the text editor frequently. Maybe that’s off topic. Another possibility is to guide them through the File Manager.

I was misunderstood. This guide is Qubes-specific, like @solene said. I’m saying it would be good to link to other very well-fleshed docs, like the Arch Wiki, whenever possible.

2 Likes

This could be a good idea, but I can’t find anything that sounds similar in Gnome templates.

Basically we are used to reply “use the template’s package manager”, which isn’t great IMO. And then people want to add 3rd party repositories and can’t figure why the provided command does not work (because of the proxy), so they just plug their templates to sys-firewall :confused:

I added a reference to vi and nano, and found some links that looks good to get started with them.