The Linux Clues Cheat Sheet

  • Linux Prompt Basics
  • Linux Command-Line Nomenclature
  • Logging in and out as Root

    Linux Prompt Basics
    The Linux command-line prompt is more complex and more useful than, for example, the DOS prompt. It shows the name of the user who is logged in, and whether that user is logged in as a standard user, or as "root," which is loosely equivalent to a Windows NT/2000/XP "administrator."

    Most Linux prompts follow this basic structure:

    [localhost@localdomain:~]$

    The localhost and localdomain in the above example are placeholders for the names specific to your Linux login and directory location. The prompt varies slightly with different distros and settings, but this actual prompt (from Linux Mandrake) is representative:

    [bruno@jupiter bruno]$

    The prompt ends with the $ symbol when you're logged in as a standard user. When you're logged in a root (or "administrator"), the prompt ends with the # symbol. (Note: In SuSE, when you're logged in as a standard user, the Bash prompt ends with a > symbol, like DOS.)


    Linux Command-Line Nomenclature
    When they're shown in printed instructions, Linux command-line commands entered from a terminal or console window start with the Linux prompt, which is represented as $ or #. The $ prompt tells you you're logged in as a standard user and the # prompt tells you that you're logged in as root. (See Linux Prompt Basics.)

    The following command printed in instructions tells you to ensure that you're logged in as a standard user and then type "man help" and press Enter:

    $ man help

    The key point is: This nomenclature does not tell you to type "$ man help" and press Enter. Again, the $ prompt tells you where to start. You type what's after the $ prompt. Long-time DOS and Windows users are often confused by this way of explaining Linux commands, so it's important to get clear on it early on.


    Logging in and out as Root
    In Linux, you should not be logged in as "root," the all-powerful administrator to the operating system all the time. It's far too easy to accidentally damage your Linux installation. The prudent way to operate is to log in as Linux root when you need to for something specific and then log back out. This is easy to do. To log in, open a terminal or console window. Execute this command (remember, you don't type the "$"):

    $ su

    Linux will respond with this request to enter your root password:

    Password:

    Simply type your root password and press Enter. The prompt will now change so that it looks something like this:

    [root@localhost scot]#

    If you've lost or forgotten your root password, please see Lost Password! for a tip on how to get it back.

    To log out of root, either type "exit" on the command line and press Enter, or just press the Ctrl-D keyboard combination.


    Back to Linux Clues Home