I am trying to change a value in this read only file (usr/share/X11/xorg.conf.d/40-libinput.conf) in order to switch a touch screen off.

I have have found this question explaining how to disable these touch screen drivers instructing me how to do this using nano. My problem is that I have never used nano before and am not understanding how to change the "on" in line 42 to "off".

enter image description here

enter image description here

Please can you show me how to use nano so that the "on" in line 42 becomes an "off" ?

I know that in order to open the editor I can use:

sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf

but from here I am lost on how to use nano to perform the task.

  • 1
    The file 40-libinput.conf belongs to the xserver-xorg-input-libinput package, would not change the file directly. Changes made will be lost the next time the package updates. Better copying of the file to /etc/X11/xorg.conf.d first, and edit the copy.
    – user986805
    Feb 10, 2021 at 17:23
  • Thanks @bac0n, I will do so.
    – user4933
    Feb 10, 2021 at 18:22
  • To add to all the other answers and comments, it is well worth the time investment to learn how to use nano. It comes in handy for making edits from the terminal and won't take too long to figure out.
    – KGIII
    Feb 10, 2021 at 21:40

3 Answers 3

  • in a terminal window, execute the command you have already demonstrated in your question
    • now you have the file opened in nano
  • navigate within the text content with the arrow keys
    • place the cursor behind the part you want to modify
    • use the backspace key to delete characters
    • type what you want instead
  • type Ctrl+x
    • at the bottom of the window a sort of "confirmation dialog" will appear
      • it will contain the file name (where to save)
      • and prompts for either y (yes, save indeed), or n (this would close nano without modifying the file (hint taken from @matigo's answer))
      • so if all is well then hit that y.
      • but wait, here comes the part with the confirming the filename to save to (seen in @PJ Singh's answer): so hit an Enter too
  • Nano will close and you are back to the terminal window. You are done.

After opening nano, you can use the arrow keys to get to the part of the file you want to change. Then, just like any other text editor, use Backspace to delete the characters you don't want, and any other key on the keyboard to add the ones you want. When you're done, Ctrl+X (for Exit). This will give you a message like this:

Nano Save Prompt

Press Y if you would like to save changes, N if you want to ignore the changes, and Ctrl+C if you want to go back to editing the file.

  1. Use the arrow keys to navigate to the "on" text.

  2. Use the Delete or Backspace key to delete the text "on".

  3. Type "off"

  4. Then press CtrlX keys

  5. You will see a question at the bottom:

    Save modified buffer?
  6. Press the Y key.

  7. Now you will see something like this at the bottom:

    File Name to Write: 40-libinput.conf
  8. Finally press the Enter key and your changes will be saved.

  • 2
    Arrrrghhhh the Enter at the end!
    – Levente
    Feb 10, 2021 at 15:26
  • @Levente, you sir(/ma'am) have a great sense of humour hahaha
    – user4933
    Feb 10, 2021 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.