Linux Mint: From scratch - Part V
This column's all about the terminal and using command line commands.
If you rush off screaming, it's probably because you've only ever
encountered the (shudder) DOS
terminal terminal in Windows. Let me tell you, the Linux terminal is
way more advanced -- and way easier to use.

Click Applications > System Tools and you'll find Linux Mint has a choice of two terminals: UXTerm and XTerm. Frankly I can't see the difference between them, so start either one and we'll use it to install a much more sexy terminal.
One of the cool things about Linux terminals is what's known as Tab Completion. Enter a few characters, hit the <Tab> key, and the terminal will complete the command for you if those keys are unique.
Try it out. Type hostn in a terminal then press <Tab>. It'll auto-complete to hostname (since there's only one command beginning with hostn.

Now just try host. One <Tab> produces nothing -- an indication it's not a unique command -- but a second <Tab> will produce a list of possibilities and repeat the command so that you can narrow down your selection ...

To see the full power of this, just type h followed by <Tab> <Tab> and you'll get a list of all the possible h commands:

But tab completion isn't just restricted to commands. It's intelligent enough to recognise command parameters and file names too, so you can actually key in what look like long, tricky commands really quickly. Try this:
What you should end up with is a command line that looks like this:
Simple, eh?
If you mess up a command or simply want to repeat a previous command, hitting the <Up Arrow> and <Down Arrow> keys will let you scroll through previous commands.
The mouse can also be used in the terminal to copy and paste text. Select a piece of text -- even outside of the terminal -- then click the middle mouse button anywhere in the terminal window and whatever you've selected will be pasted at the command line cursor. Wow!
As you're probably starting to appreciate, the terminal's a really easy way to do a lot of things in Linux. It's also makes describing how to do things a lot easier. I'm about to get you to install a new software package, and I could do so by saying "Click on Applications / Other, choose Sofware Manager then ..." but that only applies to the Gnome version of Linux Mint. If you're using the KDE flavour, the commands will be different. But not in a terminal! In fact the terminal commands for Mint will work in any flavour of Linux based on Debian -- which includes all versions of Ubuntu, Xandros, Knoppix, BackTrack, Damn Small Linux, etc. And with some slight adjustments, they'll work in pretty much all other Linux distributions too -- even on the Mac (which is actually based on another flavour of Unix called BSD).
So here we go. Time to install a sexier terminal. Enter the command:
Or if you're running the KDE version of Mint:
You can start the program by simply entering guake & (or yakuake &) on the command line. Now hitting <F12> will toggle the program.
Regular Mint users:
KDE Mint users:
We'll look at some more command line fun next time ...

Click Applications > System Tools and you'll find Linux Mint has a choice of two terminals: UXTerm and XTerm. Frankly I can't see the difference between them, so start either one and we'll use it to install a much more sexy terminal.
One of the cool things about Linux terminals is what's known as Tab Completion. Enter a few characters, hit the <Tab> key, and the terminal will complete the command for you if those keys are unique.
Try it out. Type hostn in a terminal then press <Tab>. It'll auto-complete to hostname (since there's only one command beginning with hostn.

Now just try host. One <Tab> produces nothing -- an indication it's not a unique command -- but a second <Tab> will produce a list of possibilities and repeat the command so that you can narrow down your selection ...

To see the full power of this, just type h followed by <Tab> <Tab> and you'll get a list of all the possible h commands:

But tab completion isn't just restricted to commands. It's intelligent enough to recognise command parameters and file names too, so you can actually key in what look like long, tricky commands really quickly. Try this:
| fir <Tab> /u <Tab> /sh <Tab> doc/nan <Tab> f <Tab> |
What you should end up with is a command line that looks like this:
| firefox /usr/share/doc/nano/faq.html |
Simple, eh?
If you mess up a command or simply want to repeat a previous command, hitting the <Up Arrow> and <Down Arrow> keys will let you scroll through previous commands.
The mouse can also be used in the terminal to copy and paste text. Select a piece of text -- even outside of the terminal -- then click the middle mouse button anywhere in the terminal window and whatever you've selected will be pasted at the command line cursor. Wow!
As you're probably starting to appreciate, the terminal's a really easy way to do a lot of things in Linux. It's also makes describing how to do things a lot easier. I'm about to get you to install a new software package, and I could do so by saying "Click on Applications / Other, choose Sofware Manager then ..." but that only applies to the Gnome version of Linux Mint. If you're using the KDE flavour, the commands will be different. But not in a terminal! In fact the terminal commands for Mint will work in any flavour of Linux based on Debian -- which includes all versions of Ubuntu, Xandros, Knoppix, BackTrack, Damn Small Linux, etc. And with some slight adjustments, they'll work in pretty much all other Linux distributions too -- even on the Mac (which is actually based on another flavour of Unix called BSD).
So here we go. Time to install a sexier terminal. Enter the command:
| sudo apt-get install guake |
Or if you're running the KDE version of Mint:
| sudo apt-get install yakuake |
You can start the program by simply entering guake & (or yakuake &) on the command line. Now hitting <F12> will toggle the program.
Regular Mint users:
- Configure Guake under Applications / Other / Guake Preferences. Personally, I like to wind back the transparency a little (under the Appearance tab).
- Now visit Applications / Other / Starup Applications and tick Guake Terminal so it starts every time you boot.
KDE Mint users:
- Configure Yakuake by clicking the Open Menu button in the bottom right-hand corner of the window. I prefer a Width of 80% and a Height of 40%. You'll find sliders for these, and many more settings, under the Configure Yakuake menu item.
- Now click the K-menu button, start System Settings and choose Startup and Shutdown (under System Administration). Ensure Autostart is highlighted, click Add Program and select Yakuake from the System menu item to start it automatically each time you boot.
We'll look at some more command line fun next time ...

PC World is New Zealand’s top selling computing and technology magazine.
Comments
If this is Part 4, could you add a link to the previous articles about Mint ?
Posted by: Josir | July 18, 2012 12:20 AM
FYI, the tab-completion is more of a function of the Bash shell - not of the xterm / terminal itself. Tab completion can also be done from a text console that is running bash.
To verify this, you can install csh and run it with ' exec csh ' from an xterm or other terminal. When you press tab there, it will not do auto completion.
Posted by: Kingneutron | July 17, 2012 10:18 AM