Language selector

Some GNOME terminal goodies

After using Linux for quite a few years now, I’ve accidentally embarrassed myself. I spend a lot of time using terminal in various forms. I’m not sure I know all Vim quirks (not to mention Emacs, but let’s not talk about this operating system now), therefore I was pretty confident I know how to use the terminal emulator… Today I’ve found a nice new feature, really low-hanging-fruit, so I’ve decided to share it with you, along with some other goodies (maybe not some obvious to Linux neophytes) I’m being asked about after my talks.

Without further ado, what I’ve discovered today is that if you right click a number in GNOME terminal app (and I don’t mean the exact shell running inside), the number will get converted to the HEX representation and also the human friendly file size. Now checking ls -lh or overriding alias ll=ls -lah is not so much needed.

GNOME terminal emulator and right click on a number
Say, you’ve listed files in the current directory with ls -l, and the file size is printed in exact number of bytes. Sure, maybe we should have ls -lh, to be more human (that is us) friendly. However, if (due to whatever reason) you need to make sure the Windows™ image you downloaded some time ago will fit in size to your medium (because you need to repair the installation for one of your relatives again), you can simply right click on 4941438976 and the GNOME terminal will friendly show it you as 4.60 Gi. As you see, the friendliness of GNU/Linux manifests itself not only with screen, grep, awk, and so on, but here as well!

(A brief reminder, that k stands for kilo which is one thousand in Latin. Ki stands for 1024, so drive manufacturers seem to hate the little i. Read more about kibibytes and friends.)

Need to know how 4941438976 converts to HEX? No issue, just right click, and you have it as 0x1 2688 6000. As simple as that.

Okay, so we’ve used the mouse. Maybe you use the mouse to switch the tabs? No need for that… By default, you should be able to switch tabs by hitting Ctrl+PgUp and Ctrl+PgDn. (That’s why I hate most laptop keyboard layouts, because I need to press that pesky Fn too.) BTW. that trick might work in other Linux apps too. If not, try Ctrl+Tab and Ctrl+Shift+Tab.

Okay, but to switch the tabs, one needs to open them first. Again, no need to touch the mouse. Ctrl+Shift+T, and the new tab is spawned. Don’t like it anymore? When using Bash, you should be able to quit by hitting Ctrl+D. What you can do with your mouse, is drag-n-drop your tabs to reorder them, move them between terminal windows or even create new windows.

By default, at least in Ubuntu, you should also be able to copy and paste using keyboard too. ‘But how, it doesn’t work, I’ve tried Ctrl+C!’. Well, that’s because Ctrl + C most probably sends SIGINT, so you’re telling the current programme to C-ancel. To copy the current selection (created with mouse first), hit Ctrl+Shift+C. To paste, hit Ctrl+Shift+V.

However, since you’re selecting with your mouse anyway, why not paste with the mouse? No, I don’t mean right click, selecting ‘Copy’, then right click again to choose ‘Paste’. In many environments you can simply select some text (usually left button) and then paste it directly, by clicking… the wheel. By this I don’t mean just the terminal emulator, but your IDE, word processor, Excel-like stuff, browser, etc.

Speaking of terminal, if you need to make the font bigger (because you’ve found tail -f /var/log/... really immersing), no need to point-n-click. You should be able to do that with Ctrl++. That is, Control plus plus, which in my layout actually ends up with Ctrl+Shift+=. To reverse, just Ctrl+-.

That’s it for today. I hope the terminal will be a bit friendlier for you now.

Language selector