Manjaro Difference between revisions of "Viewing and editing configuration files"

Difference between revisions of "Viewing and editing configuration files"

From Manjaro
imported>Fhdk
m (→‎Editing files requiring privilege escalation: Added Warning template to GUI sudo edit)
m (Template inserted)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
__TOC__
__TOC__


<translate>
= Overview = <!--T:1-->


 
<!--T:2-->
= Overview =
 
In Manjaro, it is common for configuration for the system and applications to reside inside plain text configuration files.  These files can be viewed and edited from both the terminal/tty and from a desktop environment.
In Manjaro, it is common for configuration for the system and applications to reside inside plain text configuration files.  These files can be viewed and edited from both the terminal/tty and from a desktop environment.


= Terminal =
= Terminal = <!--T:3-->


== Viewing configuration files from the terminal/tty ==
== Viewing configuration files from the terminal/tty == <!--T:4-->
There are two primary ways to view files from the command line.
There are two primary ways to view files from the command line.


<!--T:5-->
You can use the command cat to dump the contents of a file to the screen by typing cat <filename>.  For example to view the contents of your fstab you could use:
You can use the command cat to dump the contents of a file to the screen by typing cat <filename>.  For example to view the contents of your fstab you could use:
   cat /etc/fstab
   {{UserCmd|command=cat /etc/fstab}}


<!--T:6-->
For larger files where it would be better to navigate around you can use less.  For example, to view the contents of your pacman.conf you could type:
For larger files where it would be better to navigate around you can use less.  For example, to view the contents of your pacman.conf you could type:
   less /etc/pacman.conf
   {{UserCmd|command=less /etc/pacman.conf}}


== Editing files from the terminal ==
== Editing files from the terminal == <!--T:7-->
There are many editors available to edit files from the command line but the one that is included with every edition of Manjaro is nano.
There are many editors available to edit files from the command line but the one that is included with every edition of Manjaro is nano.


<!--T:8-->
To open a configuration file with nano simply type nano <filename>.  For example, to edit your .profile file you could type:
To open a configuration file with nano simply type nano <filename>.  For example, to edit your .profile file you could type:
   nano ~/.profile
   {{UserCmd|command=nano ~/.profile}}


<!--T:9-->
The keybindings for nano can be seen at the bottom of the screen.  The ^ indicates the ctrl key.  For example to exit nano you could hold ctrl and press 'x'.
The keybindings for nano can be seen at the bottom of the screen.  The ^ indicates the ctrl key.  For example to exit nano you could hold ctrl and press 'x'.


<!--T:10-->
Sometimes, escalated privileges are required to edit a file such as most of the files in the /etc directory.  In these cases there are two ways to acquire rights to edit these files.
Sometimes, escalated privileges are required to edit a file such as most of the files in the /etc directory.  In these cases there are two ways to acquire rights to edit these files.


<!--T:11-->
The first is to use sudo to run the text editor.  For example, to edit your fstab file you could type:
The first is to use sudo to run the text editor.  For example, to edit your fstab file you could type:
   sudo nano /etc/fstab
   {{UserCmd|command=sudo nano /etc/fstab}}


<!--T:12-->
An alternative, and arguably safer method, would be to save a copy of the file somewhere you can write and then use sudo to move it.  For example, if you used nano to edit your fstab and then saved a copy to your home folder, you could then move it to the proper location with sudo:
An alternative, and arguably safer method, would be to save a copy of the file somewhere you can write and then use sudo to move it.  For example, if you used nano to edit your fstab and then saved a copy to your home folder, you could then move it to the proper location with sudo:
   sudo mv ~/fstab /etc/fstab
   {{UserCmd|command=sudo mv ~/fstab /etc/fstab}}


= Desktop Environment =
= Desktop Environment = <!--T:13-->
Each Desktop Environment includes a different graphical text editor.  These can be started from the menu/launcher or from the command line.
Each Desktop Environment includes a different graphical text editor.  These can be started from the menu/launcher or from the command line.


<!--T:14-->
To edit or view a file you can open it directly from the command line.  Reference the list below to find the appropriate editor installed with your edition.  For example to open your pacman.conf from the XFCE edition you could type:
To edit or view a file you can open it directly from the command line.  Reference the list below to find the appropriate editor installed with your edition.  For example to open your pacman.conf from the XFCE edition you could type:
   mousepad /etc/pacman.conf
   {{UserCmd|command=mousepad /etc/pacman.conf}}


<!--T:15-->
Alternatively, you could launch mousepad from the whisker menu and open the file by browsing to it.  Sometimes, the menu item will have the name as found below but it can also simply read 'Text Editor'
Alternatively, you could launch mousepad from the whisker menu and open the file by browsing to it.  Sometimes, the menu item will have the name as found below but it can also simply read 'Text Editor'


== List of graphical text editors for each edition ==
== List of graphical text editors for each edition == <!--T:16-->


<!--T:17-->
* XFCE: mousepad
* XFCE: mousepad
* Gnome: gedit
* Gnome: gedit
Line 58: Line 69:
* Openbox: xed
* Openbox: xed


== Editing files requiring privilege escalation ==
== Editing files requiring privilege escalation == <!--T:18-->
 
<!--T:19-->
{{Warning|Never use sudo to run a graphical text editor.  This can have unintended consequences or break the permission to configuration files that should not be owned by root.}}
 
<!--T:20-->
Many of the graphical text editors will automatically ask for privilege escalation when they detect that you cannot write to a file.
Many of the graphical text editors will automatically ask for privilege escalation when they detect that you cannot write to a file.


<!--T:21-->
If they don't, you can save a copy of the file to your home folder and move it into place using sudo.  For example, if you edit your fstab and then saved a copy to your home folder, you could then move it to the proper location with sudo:
If they don't, you can save a copy of the file to your home folder and move it into place using sudo.  For example, if you edit your fstab and then saved a copy to your home folder, you could then move it to the proper location with sudo:
   sudo mv ~/fstab /etc/fstab
   {{UserCmd|command=sudo mv ~/fstab /etc/fstab}}
 
</translate>
{{Warning|Never use sudo to run a graphical text editor.  This can have unintended consequences or break the permission to configuration files that should not be owned by root.}}


[[Category:Contents Page]]
[[Category:Contents Page{{#translation:}}]]

Latest revision as of 13:53, 11 September 2021

Other languages:
English • ‎Türkçe • ‎русский

Overview

In Manjaro, it is common for configuration for the system and applications to reside inside plain text configuration files. These files can be viewed and edited from both the terminal/tty and from a desktop environment.

Terminal

Viewing configuration files from the terminal/tty

There are two primary ways to view files from the command line.

You can use the command cat to dump the contents of a file to the screen by typing cat <filename>. For example to view the contents of your fstab you could use:

user $ cat /etc/fstab COPY TO CLIPBOARD


For larger files where it would be better to navigate around you can use less. For example, to view the contents of your pacman.conf you could type:

user $ less /etc/pacman.conf COPY TO CLIPBOARD


Editing files from the terminal

There are many editors available to edit files from the command line but the one that is included with every edition of Manjaro is nano.

To open a configuration file with nano simply type nano <filename>. For example, to edit your .profile file you could type:

user $ nano ~/.profile COPY TO CLIPBOARD


The keybindings for nano can be seen at the bottom of the screen. The ^ indicates the ctrl key. For example to exit nano you could hold ctrl and press 'x'.

Sometimes, escalated privileges are required to edit a file such as most of the files in the /etc directory. In these cases there are two ways to acquire rights to edit these files.

The first is to use sudo to run the text editor. For example, to edit your fstab file you could type:

user $ sudo nano /etc/fstab COPY TO CLIPBOARD


An alternative, and arguably safer method, would be to save a copy of the file somewhere you can write and then use sudo to move it. For example, if you used nano to edit your fstab and then saved a copy to your home folder, you could then move it to the proper location with sudo:

user $ sudo mv ~/fstab /etc/fstab COPY TO CLIPBOARD


Desktop Environment

Each Desktop Environment includes a different graphical text editor. These can be started from the menu/launcher or from the command line.

To edit or view a file you can open it directly from the command line. Reference the list below to find the appropriate editor installed with your edition. For example to open your pacman.conf from the XFCE edition you could type:

user $ mousepad /etc/pacman.conf COPY TO CLIPBOARD


Alternatively, you could launch mousepad from the whisker menu and open the file by browsing to it. Sometimes, the menu item will have the name as found below but it can also simply read 'Text Editor'

List of graphical text editors for each edition

  • XFCE: mousepad
  • Gnome: gedit
  • KDE/plasma: kate
  • Awesome: mousepad
  • bspwn: gedit
  • Budgie: gedit
  • Cinnamon: xed
  • Deepin: gedit
  • i3: mousepad
  • LXDE: leafpad
  • LXQT: juffed-qt5
  • MATE: pluma
  • Openbox: xed

Editing files requiring privilege escalation

Warning
Never use sudo to run a graphical text editor. This can have unintended consequences or break the permission to configuration files that should not be owned by root.

Many of the graphical text editors will automatically ask for privilege escalation when they detect that you cannot write to a file.

If they don't, you can save a copy of the file to your home folder and move it into place using sudo. For example, if you edit your fstab and then saved a copy to your home folder, you could then move it to the proper location with sudo:

user $ sudo mv ~/fstab /etc/fstab COPY TO CLIPBOARD


Cookies help us deliver our services. By using our services, you agree to our use of cookies.