m Ubuntu Linux basics

Key Points


References

Reference_description_with_linked_URLs_______________________Notes______________________________________________________________
Concepts

https://ubuntu.com/download/desktop/thank-you?version=20.04.1&architecture
=amd64
Ubuntu 20.04.1  LTS download
https://ubuntu.com/tutorials/install-ubuntu-desktop#1-overviewUbuntu docs 
https://ubuntu.com/tutorialsUbuntu Tutorials


http://manpages.ubuntu.com/manpages/bionic/man7/file-hierarchy.7.html

Ubuntu file system summary pdf

Ubuntu file system summary

https://help.ubuntu.com/lts/installation-guide/armhf/apcs02.html

Ubuntu file overview pdf

Ubuntu file overview pdf

https://thevalleyofcode.com/linux/ online

linux-handbook.pdf file

linux handbook - Flavio **




Administration
https://superuser.com/questions/108704/how-to-shutdown-a-computer-instantly-1-
to-5-secs-without-using-a-physical-swit/108705
How to shutdown Linux




Ubuntu on Android


https://www.how2shout.com/how-to/how-to-install-ubuntu-linux-on-android-without-root.html

android-ubuntu-how2shout-How to install Ubuntu Linux on Android without root.pdf

install Ubuntu Linux on Android without root
UserLand, we can install Kali, Ubuntu, Arch Linux, Debian distros on Android in a minimal form. It provides built-in Shell and VNC sessions for a graphical experience

runs Ubuntu and Android in concurrent sessions



MACOSX CLI for Linux


m Apple Macosx


Operations
















Admin basics

sudo Syn

tab out to host OS

  • To return ownership of keyboard and mouse to your host OS, Oracle VM VirtualBox reserves a special key on your keyboard: the Host key. By default, this is the right Ctrl key on your keyboard. On a Mac host, the default Host key is the left Command key.
  • For Ubuntu to return to a host OS window - press 
    • first  RCTL , then ALT + TAB

find file then grep



Key Concepts


linux-for-dummies-v7.pdf file




Potential Value Opportunities



Potential Challenges




Redhat study by IDC showing supported RHEL delivers higher value than unsupported EOS Linux - 2023

rhel-vs-linux-vcrs-benefit-summary-2023.pdf   link





Redhat subscriptions vs Linux EOS unsupported has same ROI



Candidate Solutions




How to Shutdown Linux

https://superuser.com/questions/108704/how-to-shutdown-a-computer-instantly-1-to-5-secs-without-using-a-physical-swit/108705


sudo shutdown -h now


Last Resort Shutdown

don't suggest to do the following if you are not forced by really special reasons:

kill -SEGV 1   # should generate a core dumps and kernel panic
kill -ABRT 1   # should generate a core dumps and kernel panic
kill -9 1      # On old systems worked nowadays not

It is rough, brutal and it can be considered a close equivalent of unplugging the power cord...

The correct way is shutdown -h now with sudo before when needed.
Maybe I should say the lawful way; see below or better tl;dr.


Some words more, aka The story, Chapter I
In the beginning was the init and it will be till the very end.

The whole Linux depends from the loving care of init [1] [2]. Nonetheless and not without a certain amount of ungratefulness, there was a time in which the good Lord root user can betray this love and suddenly kill init with an incontrovertible (-9) order.
(The Book of Etiquette prescribes for counts, dukes and marquises users to invoke before a sudo).

Then some wizards made a charm to protect init (from the Book of man 2 init)

The only signals that can be sent to process ID 1, the init process, are those for which init has explicitly installed signal handlers. This is done to assure the system is not brought down accidentally.

(Our spies report [U1] that init will handle 1 HUP 6 ABRT 11 SEGV 15 TERM 30 PWR 2 INT 10 USR1 14 ALRM 17 CHLD 32)
So the good Lord root user learn the news and change the command in kill -ABRT 1 or kill -SEGV 1 that usually generate a kernel panic and a core dump.

It works because init is the first process to run and takes the PID number 1 [2b].

This is unsafe, unwise and you feel it is herald of bad omen and a curse but if you cannot materially put the hands on and unplug it...

The curse: it will not write on the log, it will not kill all the processes & wait for their ending, it will not write on the HDD properly updating the inodes neither will it unmount the filesystems; don't even mind it will save the options of the graphical windows and the shell histories, and many other beyond our imagination... as we said a close equivalent of unplugging the power chord, or the battery if a laptop.


The correct way
"Non nobis, Domine, non nobis, sed nomini tuo da gloriam.", Templar knights motto.
The lawful (correct) way is to use shutdown[3]

sudo shutdown -h now

shutdown arranges for the system to be brought down in a safe way. All logged-in users are notified that the system is going down and...

but with -h now they will have no enough time to do so much...


Some words more, aka The story, Chapter II
Once upon a time some logic steps felt from the sky over the unix people:

Once system processes have been killed and filesystems have been unmounted, the system halts/powers off or reboots automatically. This is done using the halt or reboot command, which syncs changes to disks and then performs the actual halt/power off or reboot. [4]

Indeed, nowadays, we do not trust any more in the existence of the three Moirai [5] of the Linux world, reboot,poweroff and halt[6]: the modern science of ls -l $(which poweroff halt reboot) and the one of man reboot, spreads new light on this dark age and reveal us that it exists only one true command that parses all their options so that we are finally free to ask for actions contradicting their commands names! (halt -p or reboot -p for poweroff, shutdown -r for reboot...)

Now that all seemed to be clear and cosy for all, rumours claim [7] that in the underworld of systemd toolset [8] a revolution was performed leaving unaware the whole overworld. Thanks to an army of backwards compatibility shims we didn't notice at all that reboot, poweroff, halt [6] and even telinit [9] and shutdown [3] are all already bounded to the new king systemctl [10]. Please listen the whole story from the original voice of JdeBP The Bard [9] because I have no more breath.

If you are a followers of the Ubuntu cult you may still remain aware for a while of all those claims [11].


The middle Earth of halt -f, init, telinit, systemctl
Searching for solution faster than the correct one but likewise wise.

systemctl --force --force poweroff  # the most close to kill -9 1 
systemctl --force poweroff          # rough but still safe
sudo halt -f                                       # rough
sudo telinit 0        # or 6                       # safe
kill -SIGINT 1        # cause reboot   as the reboot command
kill -SIGRTMIN+4 1    # cause shutdown as the halt command

That you are under systemd or not you should be able to stop the computer without invoking all the correct shudown procedures (and so more fast):

  1. halt -f: specifying the option -f (note that you need -f to avoid the shutdown procedure) with the above command, with sudo poweroff -f or maybe even with sudo reboot -f -h. Indeed we can read from man reboot (and equivalents) about the need to specify the option -f to avoid to call the shutdown:

    When called with --force or when in runlevel 0 or 6, this tool invokes the reboot(2) system call itself (with REBOOTCOMMAND argument passed) and directly reboots the system.

    Otherwise this simply invokes the shutdown(8) tool with the appropriate arguments without passing REBOOTCOMMAND argument.

    -f, --force
    Does not invoke shutdown(8) and instead performs the actual action you would expect from the name.

  2. Moreover you can use telinit [2b] (or init directly)

    sudo telinit 0    # or 6
    

    to tell init to change runlevel... but if so why do not kill it directly?

  3. Under systemd you can use the unwise double option --force --force

    systemctl --force --force poweroff  
    

    Reading from the systemctl manual [10]

    -f, --force
    When used with enable, overwrite any existing conflicting symlinks.
    When used with halt, poweroff, reboot or kexec, execute the selected operation without shutting down all units. However, all processes will be killed forcibly and all file systems are unmounted or remounted read-only. This is hence a drastic but relatively safe option to request an immediate reboot. If --force is specified twice for these operations, they will be executed immediately without terminating any processes or unmounting any file systems. Warning: specifying --force twice with any of these operations might result in data loss.





Step-by-step guide for Example



sample code block

sample code block
 



Recommended Next Steps