Results 1 to 10 of 117

Thread: NEW UBUNTU USERS: Becoming friends with the terminal...

Threaded View

  1. #1
    Join Date
    Oct 2005
    Location
    UK
    Beans
    693
    Distro
    Ubuntu 10.04 Lucid Lynx

    NEW UBUNTU USERS: Becoming friends with the terminal...

    For all the new people, just starting out on Ubuntu, if you're wondering why the people here tend to solve your problems using code rather than giving you directions, this short guide is for you.

    PART 1: What's the Terminal?

    A pretty good way of describing the terminal is a window into the core of your PC. What I mean by that is, with the right knowledge, you can modify ANY aspect of Ubuntu. If you're not sure what it looks like, open a terminal window now!

    Head to Applications, then Accessories, then "Terminal".

    Looks scary? Yes, it can be. To anyone but the experienced computer users among us, the terminal can seem way out of your depth. Luckily, when using Ubuntu, you barely need to touch it unless you are having problems and need to ask for help here. In the terminal, you will see your username as text, looking slightly like the format used in an email, for example:

    Code:
    name@name-desktop$
    
    or 
    
    name@name-desktop$
    Now, you're probably thinking this is a bit archaic. In this day and age, with windows, buttons and graphics, who on earth would want to use this?

    The truth is, the terminal is, with the right frame of mind, SIMPLER to use than navigating endless menus and selections. It is simpler because it is simply a faster way of doing things. It does things automatically for you. It is a friend, not an enemy. It wants to help you, as long as you give it respect.

    PART 2: Why does it help me?

    The terminal helps you because it allows people helping you to give you a standardised code to solve your problems. This means that whatever version of Ubuntu you use, this code will, in the vast majority of cases, work fine. So, rather than helpful forum members having to tell you to click "here, here, down here, right there, here, there, where, there", the code will do the whole thing for you.

    In fact, as a normal user who just wants to use his/her computer, you don't need to understand one bit of code. The vast majority of time, it's a simple copy and paste of what may seem like garbled nonsense, but it'll do the trick. Of course, it can help if you understand some of the lingo used, but by and large, you don't necessarily have to do all that much.

    PART 3: How do I add code to the terminal from guides on Ubuntu Forums?

    It's pretty simple. Select the whole of a line of code on the page, select the code (e.g click and drag the mouse), copy it (ctrl + C is fastest, but you can also right-click and copy from there). How do you know what a line of code is like? Most guides put them in quotes or code boxes, like this:

    Code:
    Hello!
    Please note that if you see multiple lines of code at once in a guide, copy and paste them one at a time.

    Once you've copied the line of code, go to your terminal window, and, if you have a middle mouse button, you can press it with the cursor hovering over the terminal window, and it'll appear in the terminal. If you don't, press CTRL + SHIFT + V to paste it. To run that code, simply press enter.

    Okay, let's give this a test drive!

    Here's the code you need for Ubuntu to check for updates to programs.

    Code:
    sudo apt-get update
    Copy this line of code, and paste it into the terminal. Then press enter. You should see something scary. You'll get a response like:

    Code:
    [sudo] password for (your name):
    In the terminal. The terminal is simply asking for your permission to do this. It's asking if you are really you, and not some random person. Enter your password - note that it gives no recognition that you're entering anything in, so if you think you've gone wrong, hold backspace down for a few seconds and re-enter.

    Press enter once you've entered your password.

    Boom... lots of code zooming past you now. What Ubuntu is doing here is going to all the addresses of all the software you use (provided you're connected to the internet) and asking if there's a new version available. If it asks whether you want to update (it'll have a Y/N option, Y being "Yes" and N being "No"), make your choice by typing Y or N. This command actually does exactly the same thing as the Update Manager found in System > Administration, except this method shows more detail. Remember, it's entirely your choice whether you use this method or open the program - you may, in time, find this method more efficient.

    So now you know how to copy, paste and run code from guides...

    PART 4: "Sudo"? Is that a new brand of soap?

    The answer is no. You may see this often in lines of code. It is a literal abbreviation of "SUper-user DO". Still confused?

    SUDO is the way of telling lines of code that this line of code is important, because it wants to do something which modifies the system (e.g install something, remove it). By entering the password for SUDO, you are effectively giving the terminal access to your whole PC for a temporary time. Remember that it is only you who can do this, as long as only you know your password. Why do we need SUDO? Because, unlike Windows XP, which gives you access to your PC all the time, Ubuntu only gives access to those who it can trust - you. You may, from time to time, especially when opening programs in the system menu, see a popup box asking for your password. This is also SUDO but in a popup rather than in the terminal.

    PART 5: Rogue commands

    Now you have some basic knowledge of the terminal, it is very important that you understand a particularly dangerous line of code. It is very powerful (and can be useful in a minority of cases), but as they say, with great power comes great responsibility.

    The name of this infamous and legendary command is:

    SUDO RM -RF /
    Do not run this command, ever.

    I repeat - never, ever run this command, unless you absolutely know what you are doing!

    I know this seems like scaremongering, there have been a few cases in the past of malicious users posting this code for people to copy and paste, especially in "guides" which aren't really that. I'd like to take this opportunity to explain exactly what it is about this command that makes it particularly nasty. Luckily for you, if you enter this code accidentally, it will give you one last safeguard - SUDO. Remember, in this case, SUDO is a guardian. It'll ask for your permission. Make sure that if you see this code, do NOT give your password. SUDO is one of the greatest security features ever added to an OS, but it cannot protect you from your own mistakes.

    One such mistake is if you have run a command using SUDO within 15 minutes previously. Ubuntu will allow commands to be run without you having to enter your password for up to 15 minutes after entering the first SUDO command. This means that if you accidentally enter this code, SUDO won't always be there to save you!

    Okay, here's a breakdown of what this command will do to your PC. You can find this information out for yourself if you want by typing:

    Code:
    man rm
    However, for everyone else, this is what the command will do.

    SUDO: Gives the code the permission to do anything to your PC, but remember, only with your permission first.

    RM: ReMove a file or multiple files (Can you guess where this is going?)

    -R Recursive - this option will remove any subfolders as well. For example, if you did RM -R /home/bob, then any folders contained within "bob" would be deleted too.

    F (part of -RF) - Force. This means that despite any protests by the system, this command has absolute power. It WILL be run, no matter what. It will not ask for any confirmation at all either.

    / By far the most dangerous bit of the command. Whereas

    sudo rm -rf /home/bob/downloads
    ...could be useful if bob wanted to get rid of his downloads folder for whatever reason, the "/" means EVERYTHING. every system file and folder you have. So, in summary, this command will trash Ubuntu, rendering it unusable when you restart. Note that, unbeliveably, you will still be able to use your PC until you restart - this is because everything is already loaded into memory. It is possible to recover files from your home folder by using a LiveCD, but everything else will have to be reinstalled. Not good.

    The best way to describe this nasty command is the 10-character code of death.

    _____________________


    Thanks for reading this guide - it was intended for the newest of new users, as I don't think there's much help given for people who are just starting out.
    Last edited by Mazza558; December 21st, 2008 at 12:22 PM.
    Laptop: Inspiron 1501 - AMD64 (Dual Core), 1GB RAM, 120 GB HDD, ATI 1150. Ubuntu 9.04 Jaunty testing.
    Beginner's Guide to the Terminal! | FutureLooks 3 on GNOME-Look | Follow me on Twitter!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •