New to Linux. Have questions about terminal prompt and user accounts and Oracle's Virtualbox.

Hi, (note, I talk a little about other distros, but I’m mainly here for openSUSE)

I’ve used mainly Microsoft DOS and Windows since about 1987. I decided to give Linux a go by running it in a Virtual Machine (using Oracle’s Virtualbox). I tried Linux back in 2007 but gave up on it because I didn’t understand it compared to Microsoft Windows and the MS command prompt. But now in 2015 I’m ready to try it again because of all the free programs I can get, that to me makes it attractive. Free is good! And to see what it’s capable of and what I can do with it. Not because I’m tired of Microsoft Windows or anything, but mainly to learn Linux and its benefits. And just in this past week, I’m starting to see the light when it comes to Linux. I’ve tried all kinds of distros in the last week to find the ones I like. I like 4 distros, openSUSE, Ubuntu, Fedora, and openMandriva. I have to say, I like openSUSE the best. The others are good too, but openSUSE I like the most. openSUSE and Ubuntu are the only ones I’m able to setup shared folders with between my Microsoft Windows 8.1 host and Linux clients. I figured out how to install Virtualbox’s Guest Additions (as you may know, Guest Additions are extra drivers and stuff for Linux) on the Linux clients from within the Linux client. When Guest Additions install, an account group is created on the Linux client called “vboxsf” (for Virtualbox Shared Folders). I couldn’t figure out how to get the host and the clients sharing folders until I found this terminal command on a site that someone posted:

mkdir myshare
sudo mount -t vboxsf ShareFolder ~/myshare/

Thats C:\ShareFolder (on my Microsoft Window’s host drive C:) and “myshare” in my home directory in the Linux client. The terminal command above works for openSUSE and Ubuntu but not for Fedora and openMandriva. I Don’t know why, but thats okay because I’m sticking with openSUSE anyways. As long as openSUSE allows me to pass stuff between the host and client using shared folders instead of making an ISO and mounting I’m good. But that’s not the main reason I chose openSUSE, its just simply that I like it. I’m gonna leave the other 3 Linux distro clients in Virtualbox just to see the difference between them as I learn Linux. That way I can see what makes them common to Linux, and what makes them different by distributor. Since I’m more or less from a Microsoft Windows background, I like the KDE environment more than GNOME because it has a more familiar taskbar at the bottom like MS Windows. Okay enough background (sorry if its overkill). I have mainly 3 questions:

Question 1: What I wanted to know, is how do I go about making myself a part of the “vboxsf” group graphically (using the GUI instead of terminal). Now that I know how to do it with the terminal, I also want to know how I can do it from within the GUI itself.

Question 2: As you may know, in a MS command prompt (terminal), if you type the command “prompt $p$g” it makes the command prompt look like “C:>” Between the 4 distros, heres what my terminal prompts look like,

Fedora: [user@localhost ~]$

openMandriva: [user@localhost ~]$

Ubuntu Unity: user@localhost ~$

openSUSE: user@linux-infq:~>

As you can see, Fedora and openMandriva are the same. Ubuntu is the same too, but without the brackets ]. I’ve learned that the $ sign is an indicator that your not a root user, and the # indicates that you are. I noticed that the openSUSE prompt, like Ubuntu, doesn’t have brackets ] either, but what I don’t understand is why it doesn’t say @localhost instead of @linux-infq like the other 3 prompts. I understand that localhost is my computer, just like MS Windows 127.0.0.1 Since the openSUSE prompt doesn’t say @localhost, is @linux-infq still the localhost or pointing somewhere else? I’m sure it means local. What does the “linux-infq” stand for? Linux Information Que I assume? Is it just unique to openSUSE doing it this way, instead of @localhost which I see is more common between distros. As you can see for a Linux newbie, I’m gonna learn more by studying distro differences so that I can see the common of Linux. How do I change the style or characters that make up the terminal prompt in Linux? Why does Fedora and openMandriva use brackets ] and not openSUSE? Or are the brackets merely for taste in prompt style (look). I noticed that instead of openSUSE using the $ sign for none root, it uses the > instead.

Question 3: How do I change the host name of my computer in openSUSE (not concerned how to do it in the other distros just for openSUSE, my chosen distro). How do I do it with the terminal and GUI?

Thanks for any help!

Secret68…

Sorry about the emoticon faces that appear in my previous post. I don’t know why they appeared in my post because I didn’t use them. They appear to have replaced the characters I typed out from my keyboard. “C:>” testing again… It appears to put a face instead of the colon I typed.

Below the message text box, under Additional Options -> Miscellaneous Options:, put a check next to “Disable smilies in text” and you get C:>

Howard

Ahh, see it! Thanks, it will help in future posts!

A feature that you, being new here, will not have found until now.

Can you please use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.

YaST->Security and Users->User and Group Management.

Question 2: As you may know, in a MS command prompt (terminal), if you type the command “prompt $p$g” it makes the command prompt look like “C:>” Between the 4 distros, heres what my terminal prompts look like,

Fedora: [user@localhost ~]$

openMandriva: [user@localhost ~]$

Ubuntu Unity: user@localhost ~$

openSUSE: user@linux-infq:~>

As you can see, Fedora and openMandriva are the same. Ubuntu is the same too, but without the brackets ]. I’ve learned that the $ sign is an indicator that your not a root user, and the # indicates that you are. I noticed that the openSUSE prompt, like Ubuntu, doesn’t have brackets ] either, but what I don’t understand is why it doesn’t say @localhost instead of @linux-infq like the other 3 prompts. I understand that localhost is my computer, just like MS Windows 127.0.0.1 Since the openSUSE prompt doesn’t say @localhost, is @linux-infq still the localhost or pointing somewhere else? I’m sure it means local. What does the “linux-infq” stand for? Linux Information Que I assume? Is it just unique to openSUSE doing it this way, instead of @localhost which I see is more common between distros. As you can see for a Linux newbie, I’m gonna learn more by studying distro differences so that I can see the common of Linux. How do I change the style or characters that make up the terminal prompt in Linux? Why does Fedora and openMandriva use brackets ] and not openSUSE? Or are the brackets merely for taste in prompt style (look). I noticed that instead of openSUSE using the $ sign for none root, it uses the > instead.

“linux-infq” is your hostname. The default prompt is set to "user@hostname:currentdirectory> " in openSUSE by default.
And the “$” does not mean that you are not root. It is just the standard shell prompt if you (or the distro) doesn’t change it (actually bash’s default is "bash-4.2$ ").
So in the end, this is just something set up by the distributions. And not all of those distributions you mention use the same shell by default (openSUSE uses bash, Ubuntu uses dash, I don’t know about the others)

You are right though that on openSUSE the root prompt shows “#” instead of the normal “>”, to indicate that you are root now.
But this is not necessarily the case.

You can change the prompt to whatever you like by setting the variable “PS1” to some value, e.g.:

PS1="Hello master! What can I do for you? "

Similar to MS (“prompt $p$g”), you can use environment variables as well, e.g.:

PS1="$USER> "

or, what would be the same as your “prompt $p$g” example:

PS1="$CWD> "
or
PS1="\w>"

Question 3: How do I change the host name of my computer in openSUSE (not concerned how to do it in the other distros just for openSUSE, my chosen distro). How do I do it with the terminal and GUI?

YaST->Network Devices->Network Settings->Hostname/DNS.

You can change it in the terminal with the “hostname” command, see “man hostname”.

Hi,

AFAIK if you are root in bash then you will get the # in the prompt regardless of the distro ( Unless of course you change the source code ) :slight_smile:

No. It’s set in /etc/bash.bashrc (in openSUSE at least):

        # Other prompting for root
        if test "$UID" -eq 0  ; then
            if test -n "$TERM" -a -t ; then
                _bred="$(path tput bold 2> /dev/null; path tput setaf 1 2> /dev/null)"
                _sgr0="$(path tput sgr0 2> /dev/null)"
            fi
            # Colored root prompt (see bugzilla #144620)
            if test -n "$_bred" -a -n "$_sgr0" ; then
                _u="\$_bred\]\h"
                _p=" #\$_sgr0\]"
            else
                _u="\h"
                _p=" #"
            fi
            unset _bred _sgr0
       else
            _u="\u@\h"
            _p=">"
        fi

and a few lines below:

            PS1="${_t}${_u}:\w${_p} "

And you can set PS1 to anything you like in /root/.bashrc or /root/.profile anyway, no need to change the source code… :wink:

You’re right though that the default is to change to “#” for root as well (in bash at least).

Hi wolfi323,

I played around with, and found more info on it, the SP1 command. Even SP2. Works well.

Now, onto the terminal command hostname. Okay, I first went into a terminal to test out changing the hostname. I did this in the terminal:


sudo hostname NewNameHere


And it worked, it changed the old host name to the new hostname. I just typed the terminal command hostname by itself in the terminal and it displays the new hostname, and I can see the new hostname. Then, I exited the terminal and started the YaST gui control config program. I navigated through YaST like this:

YaST->Security and Users->Network Services->Hostnames. And a box opens up to display the hostnames, but the new hostname I changed using the terminal is not listed. The only thing listed is other hostnames. Is it suppose to show the new hostname I changed using the terminal at this spot in YaST as well?

Also, as you know I’m using Virtualbox, and I can take a snapshot of the machine state of openSUSE before I go messing with things, configs, other stuff etc…, and then restore the machine state putting openSUSE back to the way it was before I changed anything, in case I screw something up. This is handy for a newbie like me. As for my host, which is running MS Winows 8.1, I can make system restore points before making any changes to the system. If I screw up, or install a bad program, I just fix it by executing the restore point I created before doing anything, and windows goes through the restore point and resets it back to that point, all is normal again. What I was wondering, does openSUSE have an option to save the machine state so you can restore it back to normal if something goes wrong? From within openSUSE itself. I know I can just create a snapshot using Virtualbox, but I was wondering if you can just do it through openSUSE as well.

Thanks!

Hi,

if you have btrfs filesystem which is the default on 13.2 then yes you can go back in time :slight_smile:

Cool, I didn’t even know about what file system it uses, and yep, its the B tree (btrfs) file system.

Thanks jetchisel!

There is no YaST->Security and Users->Network Services->Hostnames.
But if you mean YaST->Network Services->Hostnames, then no, this is something completely different. This displays and let’s you modify /etc/hosts, i.e. it allows you to set up hostname<->IP-address mappings that work even without DNS.

You can see/change the host name in YaST->Network Devices->Network Settings->Hostname/DNS.

The B tree file system?
btrfs is not the only file system that uses B trees. The much older reiserfs and xfs use B trees as well… :wink:

Ahh, yes, I did mean YaST->Network Services->Hostnames. I see how it works now. That area doesn’t display my computer’s hostname. My hostname uses the default for openSUSE which is @linux-infq.site. When I tried to change it, I opened a terminal window and typed this:


sudo hostname SKYNET
hostname
SKYNET

Then I check with YaST->Network Devices->Network Settings->Hostname/DNS. But it doesn’t show SKYNET. It still shows the default linux-infq. But the terminal shows SKYNET. If I reboot, then go into a terminal and type hostname again, it reverts back to linux-infq. But, if I open YaST, put in my password, and navigate to YaST->Network Settings->Hostname/DNS and change it there to SKYNET, it stays as SKYNET, even after a reboot. I don’t know why.

That is because Yast keeps it’s own data and using hostname only changes the network files so you need to really do the change in yast unless you are running a headless server or something

No it doesn’t.
YaST just reads/writes the standard config file that the rest of the system uses (/etc/hostname).
But I suppose “hostname” only sets the hostname, but doesn’t save the change. I thought it would, sorry.

So, to change the hostname in text mode, either use YaST (it has a text mode interface as well), or edit /etc/hostname with a text editor.
Or use the new systemd way:

hostnamectl set-hostname *myhost*

This writes it into /etc/hostname as well.
You can even run that as user, you’ll get asked for the root password if necessary (according to the polkit rules).

Cool! I tried it all ways just to see it all in action. If I use YaST, I can enter the host name in uppercase and the same thing as well by editing /etc/hostname. If I do it using a terminal, it will make the new host name lowercase even if I typed it in uppercase by default. Also, when I use the terminal command:

hostnamectl set-hostname *myhost*

I noticed that it removes DNS name. If I go look in YaST->Network Services->Network Settings->Hostname/DNS

The DNS part is blanked out from setting it in the terminal. As you know, the default after installing openSUSE, the Hostname/DNS are set to, at least for me, linux-infq.site
So in a terminal, I type this so that it keeps the DNS name as well, by adding .site (dot site):

hostnamectl set-hostname *myhost.site*

And it works! Cool deal, I’m starting to like this linux stuff, but, still a good ways to go before I get better with it! :slight_smile:

Thanks wolfi323!

That “.site” is not the “DNS name”, it’s the domain. If you just set myhost, the domain is empty of course, that’s why it gets emptied in YaST as well.

Btw, if you just call “hostnamectl” it will display information about your host (like the hostname e.g.).
See also “man hostnamectl” for more information. You can get the “manual page” of most command line commands by calling “man command”.

You are right that hostnamectl converts the hostname to lower case by default (the “pretty name” keeps the uppercase). You can prevent that by telling hostnamectl explicitely that you want to change the static/transient hostname:

hostnamectl set-hostname --static --transient MyHost

See also the man page for more explanation:

      This tool distinguishes three different hostnames: the high-level
       "pretty" hostname which might include all kinds of special characters
       (e.g. "Lennart's Laptop"), the static hostname which is used to
       initialize the kernel hostname at boot (e.g. "lennarts-laptop"), and the
       transient hostname which might be assigned temporarily due to network
       configuration and might revert back to the static hostname if network
       connectivity is lost and is only temporarily written to the kernel
       hostname (e.g. "dhcp-47-11").

       Note that the pretty hostname has little restrictions on the characters
       used, while the static and transient hostnames are limited to the
       usually accepted characters of Internet domain names.

...

       **set-hostname [NAME]**
           Set the system hostname. By default, this will alter the pretty, the
           static, and the transient hostname alike; however, if one or more of
           **--static**, **--transient**, **--pretty** are used, only the selected
           hostnames are changed. If the pretty hostname is being set, and
           static or transient are being set as well, the specified hostname
           will be simplified in regards to the character set used before the
           latter are updated. This is done by replacing spaces with "-" and
           removing special characters. This ensures that the pretty and the
           static hostname are always closely related while still following the
           validity rules of the specific name. This simplification of the
           hostname string is not done if only the transient and/or static host
           names are set, and the pretty host name is left untouched.


It doesn’t explicitely mention lowercase, but apparently that’s one of the “simplifications”…
Internet Domain Names are usually all lowercase, but are in fact case-insensitive (so MyHost is the same as myhost).

And to get some kind of relation: “hostname” changes/displays what hostnamectl calls “transient hostname”. This is not saved anywhere, but just assigned/used temporarily.

Secret68: Cool deal!

Thanks for your help! I’ve been saving text files of all the commands and stuff for future reference.

Secret68