Outils pour utilisateurs

Outils du site


issue65:demandez_au_petit_nouveau

Ceci est une ancienne révision du document !


Hi, everyone! Welcome back to Ask the New Guy! If you’re new to Ubuntu, thinking about switching to Linux, or need something explained to you like you’re five, look no further. Send your (simple) questions to me at copil.yanez@gmail.com and I’ll do my best to answer them.

Today I’m going to answer a question a lot of new users, including myself, ask upon boarding the good ship Ubuntu:

Q: What the hell is a command line?!

For many of us, the command line is kinda daunting. Oh, who am I kidding, it’s foreboding and scary.

I mean look at it, just sitting there, staring at you with its one good eye, blinking away. Waiting.

Even so, you can’t swing a penguin around here without hitting someone going on and on about pipe this and chown that. If the command line is so spooky, why do so many seemingly sane people use it? It’s as if the Linux community is populated by cliche horror movie characters, the kind who hear knife-y type sounds in the basement and go investigate in their Pajama Pants instead of calling the police.

I mean, what are command line users getting out of the experience (other than re-living their Matthew Broderick War Games fantasies)? After all, Ubuntu is so user-friendly. Need to open a program? Just click a few menus and you’re there. Better yet, under Unity, just type the program’s name and watch icons appear as if by magic and then click the one you want.

This user-friendliness gives rise to the second most common reaction to the command line besides screaming Bloody Mary and losing bowel control. New users who are not scared of the command line think it’s, well, boooooring.

Try to explain to a reluctant new user how cool the command line is. It’s a little like trying to explain Mutually Assured Destruction to a modern teenager. They can tell it means something to you because your face is all red and that vein on your forehead is about to pop. But as soon as you leave the room, they jump on Twitter:

ZOMG guise, dork parents r dorkz! Dad tried to explain something called Gorbachev & I was all “LAME!” and he was all “M.A.D.!” #who’sMADnow?

You want to shake them and say “We were scared, son! Duck and cover was a thing!” But, of course, it all just seems so quaint to them.

Well, it turns out the command line is not nearly as scary as some think, nor is it the digital equivalent of a Matlock rerun, of interest only to the old timers.

It’s actually useful to new users and even more so for those who spend a little time getting comfortable with it.

But let’s back up and start with a definition. On second thought, forget that. I just looked it up and there was talk about CLIs, old teleprinter machines, something called TTY, shells, and then I noticed the Google Doodle was Star Trek and, well, I got distracted.

Let’s just say the command line is a place where you type commands. Then, when you press ENTER, stuff happens.

Boom. Checkmate, Wikipedia.

Okay, so how do you use it?

In the same way that the best camera for you isn’t the most expensive one – it’s the one you’ll actually use – the best way to use the command line is in a way that encourages you to keep using it.

When I initially looked into using the command line, it was like dating a spider women: lots of anxiety and a very real fear I might die.

Then I decided to try it only on relatively simple or repetitive tasks until I became more comfortable with it.

For example, I use the command line in the same way I use keyboard shortcuts like ctrl-x and ctrl-v. I cut and paste so often, using menus would interrupt my workflow and slow things down.

What’s a common task you can try doing at the command line to get you comfortable using it? My guess is you open the same browser every time you log onto your computer. Let’s start there.

Go to your Ubuntu desktop (or whatever flavor Linux you’re running, this should work on most installs).

Press ctrl-alt-t. You should see something like this.

Remember him, the creeper? Don’t panic, I went back and checked with his exes. Turns out he’s not a creeper, he’s just shy around people.

Okay, so what are we looking at? It’s called a terminal window and blah, blah, blah. Who cares? All you need to know for now is that the flashing cursor is where you type your commands. All the gibberish before the cursor doesn’t really matter either. Time enough to explore that stuff later if you’re still interested. For now let’s keep it super simple.

So you’ve got a window like the one above and that blinking cursor insists you do something or it’s just going to cross its arms and stare at you (his exes says he does that sometimes, too—totally harmless).

Let’s give it something to do. Type:

firefox

and press ENTER.

What happened?

If a Firefox browser window opened, pat yourself on the back and buy yourself that pair of suede peek-a-boo toe Louboutins you’ve always wanted. You’re a command line user now, time to reward yourself!

Okay, so you’re thinking, “Wait, that took longer than double-clicking my browser icon or finding it on a menu.”

Maybe. But now try this. Close the terminal window. Firefox should close with it.

Type ctrl-alt-t again. When the terminal window returns and you get the blinking cursor, press the up arrow key on your keyboard. The word firefox will magically appear! Press ENTER. Firefox is back! You’re a rock star!

The command line remembers what you did last. So, even long strings of commands can be called up instantly and run without ever taking your fingers off the keyboard.

Admittedly, this is a very simplistic example. You can experiment with other commands like ls (lists the contents of the directory you’re in) or cd filename (switches you to the directory you specify). When you decide you want to try something at the command line (like download and install a program), just type what you want to do into a search engine and you’ll typically find a tutorial to help. Or send me an email and I’ll help if I can.

The point is, start with things that are useful to you and that are within your comfort zone, and then move to more complex commands as you gain confidence.

Think of the command line as the $107,000 Nissan GT-R sports car we all get with every Ubuntu install (if you haven’t received your car yet, get in touch with Mark Shuttleworth right away). It’s incredibly powerful, somewhat dangerous if used incorrectly, and it can be a beast to handle. Using the command line to run simple, repetitive tasks is the equivalent of toggling LAUNCH CONTROL on the GT-R to keep you from splattering yourself all over the pavement.

Once you feel more comfortable you can switch the toggle to STUPID FAST and floor the accelerator!

Look, I’m not proselytizing here. I’ll be the first to tell you to stay away from the command line if it just doesn’t add value to your computing experience, or, worse yet, sours you on Ubuntu or Linux. But, sometimes fear or misperception keeps us from learning simple, useful commands. Start with these and you’re more likely to keep using the command line in the future.

I hope this has encouraged you to take a plunge into the command line if you haven’t experienced it already. Very soon you’ll be piping and chowning like a boss!*

* I have no idea what pipe and chown do but they sound mildly pornographic so I’m willing to give them a try.

If you have a simple question and want an answer that doesn’t look like a nuclear reactor schematic, contact me at copil.yanez@gmail.com.

issue65/demandez_au_petit_nouveau.1349558658.txt.gz · Dernière modification : 2012/10/06 23:24 de andre_domenech