User avatar
RPi_Mike
Posts: 91
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 4:09 am

I originally developed these instructions as a sidebar for my gigantic tutorial: Play or Encode High-Quality Video and Audio – with FFmpeg and mpv.

However, customizing Terminal is broadly useful for many applications, which is why I'm posting this in the general discussion.

Raspbian's default Terminal behavior is lacking in two significant ways:

1: Terminal's default window size is much too small on higher-resolution displays. This is especially true on a 1080p monitor.

2: Terminal does not recognize the "standard" keyboard shortcuts for copy and paste: CTRL + C and CTRL + V. Instead, it uses the obscure and cumbersome combination of CTRL + SHIFT + C and CTRL + SHIFT + V. This is especially frustrating because all the other major programs on the Raspberry recognize the standard shortcuts. For example, in order to copy and paste the nearly 100 command lines in my tutorial, you would have to constantly switch your keyboard shortcut method back and forth for every single line. Or, you would have to constantly right-click in Terminal to access paste. Both of these mistake-prone methods are begging for a slip of the mouse or keyboard.

My attitude toward computers is quite simple: They're not here to train me – I'm here to train them! Sometimes you have no choice but to allow them to "train" you – that's an inevitable part of the learning process. But having to constantly alter your behavior for an extremely common task is pretty insane.

Some of you may be thinking: "Why not simply go to Edit | Preferences in Terminal and change the settings?" Although that will work for the default window size, there's a bug in Terminal that replaces the keyboard shortcut code with gibberish if you change it in the preferences. That method will therefore not work. Here's a screenshot to prove what I'm talking about (I will submit a bug report on this in the next few days):
Terminal_Bug.png
Terminal_Bug.png (64.32 KiB) Viewed 1386 times


Fortunately, you can sidestep that bug by directly editing the "lxterminal.conf" file. It's very simple:


STEP 1: Open File Manager; copy and paste the following path directly into the address bar; hit Enter:

/home/pi/.config/lxterminal


STEP 2: Right-click the file named "lxterminal.conf" and click Text Editor.


STEP 3: There are 4 lines that need minor editing – make the simple changes illustrated below in my graphic and you're all set! Save the file when you're done.



NOTE 1: The values of 115 and 50 for the column and row sizes are only optimal on a 1080p monitor. If your display has a lower resolution, you'll have to use lower values. To determine the best size for your screen, hover your mouse over the side and bottom edges of your Terminal window. When it turns into a double-arrow, click and hold – then drag the window's border in and out until you find the most desirable size (an overlay will appear that displays the window's current dimensions).

NOTE 2: When editing the file, use a capital "C" in <CTRL>C and a capital "V" in <CTRL>V. My testing indicated it's not case-sensitive, but you might as well use Terminal's existing convention for key assignments.

NOTE 3: If you make a mistake at any time – or simply wish to restore Terminal's default settings – there's a simple trick: Delete the "lxterminal.conf" file! The next time you open Terminal, the Raspbian operating system will automatically reconstitute the file with its original default settings! Caution: I have verified that Raspbian Stretch behaves in this manner – but if you still have an older operating system, such as Raspbian Jessie, I can't guarantee how it might behave. So play it safe and make a backup copy of the file before you delete it!
Terminal_Customized.png
Terminal_Customized.png (192.95 KiB) Viewed 1386 times



Finally, for the benefit of my tutorial users, here's what the optimal layout should look like once you've gotten Terminal properly customized. To view this image at full resolution, right-click and select "open image in new tab":
Tutorial_Layout.jpg
Tutorial_Layout.jpg (247.37 KiB) Viewed 1346 times
Last edited by RPi_Mike on Wed Feb 21, 2018 6:19 am, edited 3 times in total.

User avatar
Imperf3kt
Posts: 1314
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 5:11 am

CTRL+C / CTRL+V doesn't work on _any_ terminal I use, not even on Windows.

Thanks for posting this, looks useful. I sure look forward to copy/pasta working via keyboard again instead of right-click menu or CTRL+SHIFT+C / CTRL+SHIFT+V
User experiencing technical difficulties.

n67
Posts: 800
Joined: Mon Oct 30, 2017 4:55 pm

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 9:13 am

I assume you realize that making Ctrl/C be Copy is pretty silly, given that Ctrl/C is used to send the interrupt signal. There's a reason they added the Shift key into the cut/paste keys.

Yes, you can reconfigure your interrupt signal (it may have been mentioned in the OP, which was clearly TL;DR), but nobody is going to do that.

Note, BTW, that earlier versions of LXterminal-on-Raspbian had a bug where even with the shift key pressed, sending the Copy keysequence still sent an interrupt to the window as well (*). I think this is fixed now.

(*) And not only that, but sending the Paste sequence also send a ^V to the window, putting you into "literal next" mode. This also is a little disconcerting when it happens.
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

User avatar
rados-dataplicity
Posts: 40
Joined: Wed Aug 03, 2016 11:56 am
Location: UK
Contact: Website Facebook Twitter

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 9:51 am

I'd recommend installing terminator for even more customizations and features like splitting the terminal window
I tinker around with Raspberry Pis daily and make sure that people can easily access theirs remotely.

Community outreach @ dataplicity.com

Heater
Posts: 9838
Joined: Tue Jul 17, 2012 3:02 pm

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 10:09 am

Please use Ctrl-C for its intended purpose. Sending a signal to the running program.

I can understand using it for copy in GUI apps but it's a no-no for command line programs.

jahboater
Posts: 2928
Joined: Wed Feb 04, 2015 6:38 pm

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 11:52 am

If stuck you can do "kill -SIGINT <pid>" from another terminal which sends a ^C signal.

kaksi
Posts: 68
Joined: Tue Mar 10, 2015 6:19 am

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 1:02 pm

A very good idea to resize the window (and move it somewhere to the top) - just it does not seem to work under Jessie. Even after reboot.

User avatar
RPi_Mike
Posts: 91
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 3:13 pm

Imperf3kt wrote:
Wed Feb 21, 2018 5:11 am
Thanks for posting this, looks useful.

I appreciate that! As for a few of the other commenters: As I explained in "NOTE 3" of my original post, Terminal's default behavior can be restored instantly at any time!

User avatar
bensimmo
Posts: 3222
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 3:28 pm

n67 wrote:
Wed Feb 21, 2018 9:13 am
I assume you realize that making Ctrl/C be Copy is pretty silly, given that Ctrl/C is used to send the interrupt signal. There's a reason they added the Shift key into the cut/paste keys.

Yes, you can reconfigure your interrupt signal (it may have been mentioned in the OP, which was clearly TL;DR), but nobody is going to do that.

Note, BTW, that earlier versions of LXterminal-on-Raspbian had a bug where even with the shift key pressed, sending the Copy keysequence still sent an interrupt to the window as well (*). I think this is fixed now.

(*) And not only that, but sending the Paste sequence also send a ^V to the window, putting you into "literal next" mode. This also is a little disconcerting when it happens.
I've never put two and two together on why they didn't use CTRL-C, same on windows.
While at the same time always using it to stop the program etc.
One of the things you just use, but just don't think about.
:)
Last edited by bensimmo on Wed Feb 21, 2018 4:49 pm, edited 1 time in total.

n67
Posts: 800
Joined: Mon Oct 30, 2017 4:55 pm

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 3:35 pm

I'd never put two and two together on why they didn't use CTRL-C, same on windows.
Note that ^C does *NOT* mean "Copy" in the Windows Command Prompt (which is where I do most of my work on Windows).

And for the same reason as in Linux: Because it would conflict with the normal usage of Ctrl/C.
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

User avatar
bensimmo
Posts: 3222
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 4:54 pm

That's what I was meaning. I'd never put two and two together on Windows either.
Even over many many years grumbling why CTRL-C wouldn't paste and then later on use it to terminate something. :lol:

n67
Posts: 800
Joined: Mon Oct 30, 2017 4:55 pm

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 5:25 pm

Oh, OK.

Now, after a few rescans, I think I've got your meaning.
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

hippy
Posts: 3786
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: TERMINAL: The Two Most Useful Customizations

Wed Feb 21, 2018 6:50 pm

What would make sense to me is to have an option to enable Ctrl-C as a Copy shortcut when text to copy has been selected, have it function as normal when there isn't. The best of both worlds.

The windows Telnet client I use drives me up the wall because it allows text to be selected for copying, then prevents Ctrl-C passing down the link, but doesn't do an actual Copy. I suppose I should be grateful it doesn't terminate the Telnet client nor what's executing.

Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 29 guests