Doubt On Linux Commands

Just tells it what shell to use to exec…

Nearly all the shell scripts I used to write were ksh - so “#!/bin/ksh” used to be my default - even if bash was available - I’d target ksh - and used ksh in preference to bash - I’d have “set -o vi” in my .kshrc and .profile (I can never remember which one to use so put it in both) so I could use vi navigation to scroll up through my shell history… You can still do that in zsh (set -o vi and use “k” and “j” instead of arrow keys to scroll shell history - haven’t tried this in bash but it probably works there too) - in KSH you had to press esc+esc (i.e. twice) to scroll shell history with vi - in ZSH it works immediately after typing “set -o vi”

Bash and zsh are vastly more sophisticated than ksh… I haven’t tried “fish” 'cause I’m quite happy with zsh - but - even so - I always use bash for shell scripts as there are somethings (internals) that work very differently in zsh than bash…

2 Likes

Ksh is a bit like csh.
I still work in csh occasionslly, but not for scripts.
Zsh is an Apple choice. I can see where it fits with you.

1 Like

Yes, it is the default shell on later versions of MacOS - but - I was using it some time (circa 2015) before I became a Mac user (2021) - on Linux and FreeBSD (FreeNAS / TrueNAS).
It’s the default shell on my current TrueNAS for all users - including root.
From : Z shell - Wikipedia

Zsh was created by Paul Falstad in 1990 while he was a student at Princeton University. It combines features from both ksh and tcsh, offering functionality such as programmable command-line completion, extended file globbing, improved variable/array handling, and themeable prompts.

I have used tsch in the past, and I recall it USED to be the default shell on FreeBSD and FreeNAS… I think tsch might have been the default on some versions of AIX too…

I had some logic in my ~/.profile on a whole bunch of Linux and Solaris servers at one customer that had $HOME as an NFS mount - that detected ZSH and used that shell if it found it (with a ~/.zshrc I copied from my local computer) - I should hunt it down again and take a note of it…

export OPSYS=$(uname)
[ $OPSYS == "SunOS" ] && stty erase ^H
[ -x /usr/bin/zsh ] && exec /usr/bin/zsh || [ -x /usr/bin/bash ] && exec /usr/bin/bash

bash as a last resort instead of ksh (default) or csh or sh… But ZSH is widely available and usually installed by default on RHEL, OEL and Ubuntu and even Solaris 11 (I seem to recall I had to install it separately on CentOS 7).

I wish more of my customers had NAS $HOME mount on their Linux fleet… But no… and unlikely to ever happen - it’s bizarre - some of my customers are actually downsizing their Linux fleet for cloud solutions (e.g. “serverless” things in AWS and Azure [yeah there’s still a server somewhere, or several, but you don’t get that level of granularity]).

2 Likes

Yep,
In original BSD, you only had sh or csh.
The in thing was to work in csh and write scripts in sh.
So maybe I try working in zsh, and leave my scripts in sh?
That might feel familiar.

Chimera defaults to Almquist shell (ash)

1 Like

Correction “tcsh” not “tsch”…

2 Likes

I can remember a guy running around the lab saying
" Hey there is this beaut new shell tcsh that does autocomplete on the command line"
I thought
" I dont want that nonsense interfering with my typing"

Now browsers are doing it… annoys the hell out of me… can you turn it off?
Try doing file://somefile in a browser… it will interfere and you can never get to the file.

1 Like

I am very impressed with your levels of knowledge of the linux systems, far outstretches my level of knowledge.

Thanks for sharing this, learning so much trying to follow the story line.

1 Like

It is really about shells, which are the CLI user interface to Linux and BSD systems.
Shells have evolved over the years, and there are now several shells in common use and they vary a bit , which can cause confusion.

There was a time when operating systems did not have shells… because they could not multi-process. They only had a queue of batch jobs, and ran them one job at a time. Single process computer. the only time sharing was between the OS and the current job.
Then interactive OS’s began to appear… both as subsystems of the batch OS, and as a whole interactive OS where the one user controlled the whole computer like in a mini-computer or in a CP/M or DOS PC.
Unix was the first system I knew that had genuine multi-processing and multi-user, and it had a shell for each user, and each background job.
I dont know. Is Windows multi-user ? It must surely be multi-processing because its microkernel runs in several processes. Can you run a background job? Can several users login? I have no idea. It looks on the surface like a single user computer.
The original DOS/Win was single user, single process. When did Win acquire multiprocessing?

MacOS must be multiuser, because it is BSD under the bonnet.

There is more to shells than the UI they provide.
@callpaul.eu should note. You started a topic on command line, but that really means shells + the command set.

1 Like

It is. They cripple the Home version so only one person can login interactively at a time. The server version has the ability to have several users logged in at the same time. All with their own user interface.

For Linux I use NoMachine for remote control, but only I only use one session at a time.

2 Likes

So when did Windows change from being an addon Window System for DOS to a multi-user operating system?
It must have been around XP or before?

So Windows is a window system that became an OS later on… Linux is an OS that acquired a widow system later on.

2 Likes

It was Windows NT 3.1 released around 1993 - it was a complete O/S - unlike the hybrid of DOS + Windows - even Windows 95 and 98 could boot to 16 bit DOS instead of loading Windows straight off (MS-DOS 7 was the DOS under Windows 95).

A company called Citrix developed a method of running muliptle GUI user sessions in Windows NT (3.5 I think) - they also did something similar with OS/2 (for banks I believe). Microsoft loved it so much they bought it and incorporated as a variation on Windows NT 4 “Windows NT4 for Terminal Services”. And Windows 2000… I can’t remember if Windows 2000 “workstation” could be accessed via RDP - but certainly it was available in Windows XP.

I think Citrix had other “irons” in the fire - i.e. VDI (virtual desktop infrastructure) before it was such a thing as it is today (e.g. AWS have something, there’s Azure AVD, there’s VMware Horizon) - I vastly prefer Citrix to other AVD / VDI solutions - it’s mostly bulletproof - I can keep a Citrix session open for days at a time - Azure AVD? It crashes out several times a day when I’m working, one of them about 6-8 times a day! It’s so frustrating I don’t use it - that Azure AVD replaced a Citrix “farm” - and it’s flaky to the point of unusability!

There was a simple registry hack you could do on Windows XP to make it fully multiuser (i.e. multiple simultaneous users accessing via RDP - i.e. port 3389) - i.e. you could easily make Windows XP into a multi-user system - I never looked into this on Windows 7 or later. Thus demonstrating - multiple user blocking on XP, Vista, 7, 8, 10 and 11, is probably just something “hardcoded” into the registry. By default - Windows server allows TWO simultaneous RDP sessions - to get more you have to activate a license for terminal services.

As for “multi-processing” - I think Windows 95/98/ME had some features - but for things like SMP you needed Windows NT (e.g. NT 3.x, 4.x Windows 2000, and Windows XP on) and the NT kernel was vastly superior to the Windows 95 system, in so many ways. It was POSIX compliant from the start too (NT kernel).

On a Windows machine (e.g. Server 2016, 2019 etc) - each user has their own “space” and if you look in task manager you can see a whole bunch of other users processes - here’s a session - the bottom user is mine :

2 Likes

So really NT was a fresh new OS… not related to DOS/Win except its GUI design looked the same… and all subsequent Win versions derived from that.
and
its multiprocessing came from third party addons… Citrix, Azure

Is there any part of Win that Microsoft actually programmed themselves?
or
is it a collection of purchased components, in the same way that GNU/Linux is a collection of free components.?

1 Like

No - the NT operating system was always multiprocessing, and supported SMP out of the box - you could run a dual CPU system on Windows NT 3.1 workstation - but you had to enable SMP during the install - it wasn’t easy to add post-install… And I don’t think it supported more than 2 physical CPU - if you wanted more you had to buy some other product variation of Windows NT.

What they got from buy the Citrix product was multi-user GUI sessions (remote desktop protocol) from Windows NT 4.0 onwards… NT Server could always run multi-user stuff - like filesharing, or e.g. SQL Server, or IIS, or Proxy Server…

Azure IS Microsoft… it’s their cloud solution (i.e. competes with Amazon Web Services).

I quite liked Windows NT - but hated “domains” for users, Novell Netware NDS was vastly superior - and - I still reckon Novell NDS was better than AD (Active Directory).

I used Windows NT 4 and 2000 as my main desktop machine at home (alongside other systems running Linux, or Solaris).

2 Likes

Microsoft hired a group of developers from Digital Equipment Corporation led by Dave Cutler to build Windows NT, and many elements of the design reflect earlier DEC experience with Cutler’s VMS, VAXELN and RSX-11, "

So yes , it inherited multiprocessing from VMS, etc.
Microsoft did not write NT, … they effectively purcased it by hiring a DEC team.
Thats how it ended up on DEC Alpha.
Have you ever used VMS? It was clunky and expensive compared to BSD.
We had a cleanout on my worksite, and rejected all the old Dec/VMS gear in favour of Sun/BSD. It changed the workplace.
"

1 Like

No - that’s not how it ended up on Alpha… It was ported to three RISC architectures, not just Alpha.

I agree - yeah - they hired a bunch of DEC employees to write Windows NT - and observers have noticed some similarites between NT and VMS, but - it was already on the cards when they gave up on OS/2 and presentation manager (Windows NT was what they focussed on - i.e. similar goals as OS/2).

The first version of Windows NT (3.1) was only i386… I think… Pretty sure there weren’t RISC versions of Windows NT before 3.5 - but I could be wrong.

Windows NT 3.5 was available on :
i386
Dec Alpha
PowerPC
MIPS

I only ever used VMS through a menuing system (mostly for a backup system) on a MicroVAX (and yeah - it was Alpha CPU).

I did use BOTH Windows NT 4.0, and Digital UNIX (later "Tru64) on DEC Alpha (actually installed Digital UNIX on Alpha)… That was a great CPU arch - I’ve love one to play with at home… It was also pretty good at running Windows NT (4) - we did some benchmark comparisons on SQL Server 6.5 running on RISC vs CISC (i386) and the RISC Alpha ate the CISC i386 (Pentium Pro? Pentium II?).

3 Likes

We had a heap of Fortran image processing software running on VMS and BSD , and we converted it to C so it would run on NT on i386, because it needed to be on PC in a machine they were building to image wool.
NT was the first Windows that would have been up to that job.
Compilers on DOS/Win were dreadful and the memory limitations killed any serious work.

1 Like

Thanks Neville I had not thought to seperate them, when using I personally put them together as one idea, having never really known the difference. But feel better educated now.

1 Like

Yeah, we all do that. Tend to forget the working shell exists… think you are talking directly to Linux kernel.
It is a good topic Paul, … look at the number of replies… people want to talk about CLI issues.

1 Like

I still have nightmares about NDS. For my purposes Netware 3.11 was the best. :slight_smile:

3 Likes

Often I install apps with the cmd line and update/upgrade the entire system accordingly.

To update complete distro : sudo apt dist-upgrade .
When a repository for any app can not be accessed : sudo apt update --fix-missing.
Then try to upgrade either sudo apt upgrade or sudo apt dist-upgrade .

“apt get” I no longer use , just “apt”

Frank in County Wicklow Ireland

5 Likes