Page 1 of 1

How to use virtual terminals in Stretch 7.5?

Posted: Thu Dec 24, 2020 12:44 pm
by Texaspilot

Another probably stupid question. I am in the process of trying to teach myself linux from essentially ground zero. I know nothing about computers... My question is about virtual terminals. The source I am reading (guru99.com) has a section on virtual terminals accessed by pressing ctrl-alt F1-6. I try this on my machine and I get with F1 tty1 like I expect, but seemingly cant enter anything. F2 brings up a password request, which I don't know since I never made a password. f3 restores me to the gui. and f4-6 bring up black screens.

I am running dpup stretch 7.5 My question is, what am I seeing here? Anything interesting to learn from it? Thanks!


Re: virtual terminals

Posted: Thu Dec 24, 2020 1:41 pm
by galbi

:thumbup: Yes, a lot to learn...

Have you ever used an old (past century) system? A computer with only D.O.S not with Windows? What do had there?
A terminal with a prompt, right. Well, this is similar, but with more than one. The number of enabled terminals is different as a taste of the developer.

The thing is that in F3 there is a graphical client running that gives you the desktop, (in Linux the graphical system works under a client-server model, in this case, both running in the same computer; but it can be the server in one, and the client in another)

In F2 you can log in as root (like in F3) or as another user. You can try to login as user root with
user: root
passwd: woofwoof (usually in Puppy this is the pre-configured passwd, can be changed, of course)
but.. in that terminal you can't run another gui because it's already running in F3

Saludos


Re: How to use virtual terminals in Stretch 7.5?

Posted: Thu Dec 24, 2020 3:19 pm
by Texaspilot

Thanks for the good info! I remember dos. Actually that is what I used the last time that I really used a computer operating system. I am just curious, if I open a terminal window, is that the same as the ctrl-alt F2 access, except you are still within f3 (graphical client)?
Are the shell commands that you can enter in the F2 the same as in the virtual terminal console?


Re: How to use virtual terminals in Stretch 7.5?

Posted: Thu Dec 24, 2020 3:40 pm
by galbi
Texaspilot wrote: Thu Dec 24, 2020 3:19 pm

if I open a terminal window, is that the same as the ctrl-alt F2 access, except you are still within f3 (graphical client)?
Are the shell commands that you can enter in the F2 the same as in the virtual terminal console?

Cooooo... rrect, sir :thumbup2: :thumbup2:

Is the same, but you can't run a graphical program, (like mtpaint, for example). Try it, it will give you an error.

That's why xterm, lxterm, etc. are called: terminal emulators


Re: How to use virtual terminals in Stretch 7.5?

Posted: Thu Dec 24, 2020 3:56 pm
by user1111

A installed boot loader typically boots vmlinuz, a.k.a kernel. In Puppy like systems that kernel tends to hand over control to init. For frugal type Puppy bootups that init setups up a environment that is like a chroot environment that it switch-roots into. Different systems do things different ways, but again for what you're looking at it will be something like /etc/inittab that is used as part of startup. If you look in that file you'll see various tty's get set up, perhaps tty1, tty2, tty3 ... could be more, could be less. On each of those, again typically - but by no means fixed, it will present a login prompt, where you can ctrl-alt-Fn to and login using root, or spot (or whatever userid the system support). One or more of those could alternatively be set to autologin at startup. Also in /etc/inittab there maybe something like a execution of /etc/rc.d/rc.sysinit - that in turn starts a load of things such as a bunch of scripts to setup wifi, bluetooth, whatever.

When X (gui) is started it also takes up its own ctrl-alt-Fn position, somewhat like a separate login. Which in your case is on ctrl-alt-F3. If in the main desktop/gui system you for instance opened a terminal and ran
startx -- :1
then another X/grahical session (might, not sure in your case) start on ctrl-alt-F4

Whilst the default root password in Puppy is woofwoof, its good practice to change that. i.e. when logged in as root, in a terminal window type 'passwd' and it will prompt you (twice) for the new password. To change the password for userid 'spot' (whatever) you use 'passwd spot'.

That's all complicated by variations. Different systems might run the same/similar or completely different approaches to bootup.

Fundamentally the kernel can't do much once loaded in respect to user interaction, it hands over to userland (such as init) for such interaction. As part of that Puppy uses a program called busybox ... which contains a wide range of 'commands' that can be run. If you type 'busybox' in a terminal window the it will reveal all of the commands supported. If 'whoami' for instance is included then running 'busybox whoami' ... will show your userid. In *nix type systems such commands tend to be individual programs, busybox in effect merges many commands into a single program (called busybox). In /bin and elsewhere ls -l will reveal how individual commands link to that busybox program. ls -l /bin/whoami will typically be a symbolic link to busybox. In other *nix systems that instead would be a actual individual binary (executable) file.

So basically Ctrl-Alt-Fn will switch to other terminals, or into a running gui desktop, or to nothing if not that many tty's have been defined/configured.

*nix systems provide a very broad range of choices in many areas. Different choices of boot methods such as SysV, runit, systemD ...etc. that do their 'initialisation' different ways; A range of shells (command line commands) such as sh, bash, ash, dash, csh, zsh ...etc. All similar in some ways, but different in other ways. If for instance a system uses standard/basic sh then running a bash script on that may very well not work as intended, even though much of the syntax/content of the script may look very familiar to either someone who prefers sh or bash. Same for 'distros' ... all different, but similar in functionality. Way too much divergence some might say - as fundamentally a gui desktop is pretty much just a program launcher. Some might click a desktop icon to launch firefox, others might use a menu type layout, or a choice of either to launch firefox ... etc. If for instance a gui is running and you ctrl-alt-F2 and login as root and then run DISPLAY=:0 firefox ... then that equally might have firefox start within the gui desktop (i.e. started from the command line interface).


Re: How to use virtual terminals in Stretch 7.5?

Posted: Thu Dec 24, 2020 4:10 pm
by Texaspilot

Thanks Rufwoof! great info. I think I am going to at this point try to familiarize myself with all of the commands within busybox. Seems like a good place to start.


Re: How to use virtual terminals in Stretch 7.5?

Posted: Thu Dec 24, 2020 8:17 pm
by williwaw

Are the shell commands that you can enter in the F2 the same as in the virtual terminal console?

yes, but you are not limited to bash as your shell. If for instance, you were more familiar with a different OS that used the c shell, you could install csh and either set it as your default shell or spawn a subshell from bash for in session use.

quite a few mature apps are still maintained that work well in terminal emulators or the virtual terminal. try alsamixer or top at the prompt or look at some other favorites
viewtopic.php?f=4&t=1213


Re: How to use virtual terminals in Stretch 7.5?

Posted: Thu Dec 24, 2020 10:48 pm
by Texaspilot

Thanks Williwaw. That's good info. Unfortunately, at this point I am barely familiar with the shell I am using, but will hopefully get there eventually ;) That is a great flexibility option as I learn more.


Re: How to use virtual terminals in Stretch 7.5?

Posted: Fri Dec 25, 2020 12:03 am
by williwaw
Texaspilot wrote: Thu Dec 24, 2020 10:48 pm

Unfortunately, at this point I am barely familiar with the shell I am using

Tex, I am afraid I didn't answer your question well. I am not suggesting you use a different shell, in fact you will rarely find a reason to use anything other than bash, at least with linux. Whether you are in a virtual terminal or on the desktop in a terminal emulator, if your login shell is bash, your terminal(s) will default to bash. Commands and their syntax vary between different shells. Should you find your self at the terminal of a machine with a different OS, or where the default shell is not bash, you could bring up bash, (or rather change shells), to be able to work in an environment of your choice. That said, many of the commands are the same.

An example would be if you were to log in remotely to your web site, that was being served on a bsd machine, you could easily work in your preferred linux shell regardless of the OS being used.


Re: How to use virtual terminals in Stretch 7.5?

Posted: Sat Dec 26, 2020 3:51 pm
by Texaspilot

Thanks, all the more reason to become as proficient as I can with my existing BASH. It is as if I can bring it to other systems. Seems ideal.