Linux

Play Linux System Distributions Online in a Web Browser

2022-02-16. Category & Tags: System, Linux, Distributions, Online, Web

Note: many with 5 minute inactive limit and 30 minutes per session limit.

CodeAnyWhere container (tested 2022.02, w/ root-sudo & git): py, c/c++, java, php, js, ruby, h5, wordpress, .net, rust, go, node.js. (can skip all payment part). terminal speed good. limitted free trial time.

WebMinal (tested 2022.02, NO root/git) (CN network issue for home page, but ok after): Federo CentOS7 (py2.7), right-sided lessons/tutorials (great for new users): shell, MySQL, Python etc.

...

Find and Kill a Process

2021-10-09. Category & Tags: Windows, Linux, Commands, Networking, Ports

see also: 鸟哥 Linux 私房菜 Basic Linux.

Linux #

find bound PID by port: fuser 8080/tcp
kill by port: fuser -k 8080/tcp
list by port: lsof -i:8080

using netstat: netstat -nlpte |grep :8080
or: ss -nlpt 'sport = :8080'

ref 1 & ref 2

Windows #

CMD find PID by port & kill by PID:

:: find pid first:
netstat -ano | findstr :8080
:: then the pid's task/process
tasklist | findstr "<the_PID>"
taskkill /PID <the_PID> /F

PS find for TCP & UDP:

...

Python GUI Frontend Options Comparison

2021-01-14. Category & Tags: Python, GUI, Desktop, Windows, Linux, Cross-Platfrom

Mainly for the (cross-platform) Python GUI frontend options.

  • CEF (Chromium Embedded Framework). Pro: can use the same way of MVC thinking (modern html5); build-in chromium browser. Con: someone said it may need a little c++.
  • PyQt (v5). Pro: big community, good doc (for c++). Con: c++ way of thinking, just the language is py (the official GUI tutorial lacks GUI screenshots!); pay for commercial usage; still often needs c++.
  • Tkinter. Pro: build-in w/ py, big community. Con: //TODO.
  • electron / nwjs (bad word of mouth) /javafx / swiftui / flutter : Pro: quick to develop. Con: using node.js, too slow to run and to learn. // though it is possible for experts to make VSCode using electron.
  • wxPython: Pro: small-to-middle-size community… Con: too new, few people.

ref: zhihu & youtube

...

GRUB Rescue

2019-01-06. Category & Tags: GRUB, Rescue, Boot, Linux, Ubuntu

When being forced into GRUB rescue mode, run ls and ls <one_partition> to check available partitions and find the one that we should boot from [ref].

Then set prefix & root [ref]:

set root=(hdX,Y)
set prefix=(hdX,Y)/boot/grub
insmod normal
normal

To avoid doing this every time, it is recommened to use a live-USB/ISO to repair GRUB (usually only Desktop version can be in live-USB and easy to setup WIFI). (// it should be also ok to do this without USB if there is a nix system working on current HDD).
Then use boot-repair to repair the grub.

...

Install & Use R & RStudio

2017-05-08. Category & Tags: R, Install, Ubuntu, Linux, Rstudio

R IN WINDOWS #

Download here and install.

R IN UBUNTU 18.04 #

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 && \
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/' && \
sudo apt update && \
sudo apt install -y r-base r-base-dev libcurl4-openssl-dev libssl-dev build-essential && \
sudo -i R # install packages as root, so all users can use.

Commonly used packages:

install.packages(c('devtools', 'digest', 'repr', 'IRdisplay', 'crayon', 'pbdZMQ', 'ggplot2', 'IRkernel', 'ggpubr'))

DigitalOcean

Optional: sudo chmod 777 /usr/local/lib/R/site-library so anyone can install packages.

R IN UBUNTU 16.04 #

Option 1:

...

Linux init after installation

2016-12-19. Category & Tags: Linux, Must-Have

PROBLEMS #

sudo takes a long time (when network having issues) #

Reason: distros should have added new host name to /etc/hosts, if the name is changed/added during installation ref.

echo -n '127.0.0.1 ' >> /etc/hosts && cat /proc/sys/kernel/hostname >> /etc/hosts

or:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 <ADD_YOUR_HOST_NAME>
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 <ADD_YOURS_HERE>

annoying “software updater” #

sudo sed -i 's/1/0/' /etc/apt/apt.conf.d/20auto-upgrades ; cat /etc/apt/apt.conf.d/20auto-upgrades
sudo apt-get remove --auto-remove gnome-software

empty/black screen #

If screen blacked out after 1st reboot, the problem is gfxmode $linux_gfx_mode in grub.
Solutions: (for many servers, see solution 3 directly.)

...

Force Ubuntu desktop Boot into Text Console Mode

2016-12-15. Category & Tags: Linux, Ubuntu, Console, X

Tested in ubuntu deskop 16.

short url: s_force-text

SOLUTION #

sudo cp /etc/default/grub /etc/default/grub.bak && \
sudo sed -ie 's/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="text"/g' /etc/default/grub && \
sudo sed -ie 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="text"/g' /etc/default/grub && \
sudo sed -ie 's/#GRUB_TERMINAL/GRUB_TERMINAL/g' /etc/default/grub && \
sudo update-grub && \
sudo systemctl enable multi-user.target --force && \
sudo systemctl set-default multi-user.target && \
sudo reboot

OBS: sometimes, by changing “multi-user.target” is enough, but sometimes we have to update grub. Have not dug into the reason.

RESULTS #

Echo-ed results:

START X TEMPORARILY #

To run desktop from pure terminal (on physical monitor): run service lightdm start directly.
Note:

...

Completely Automatic Unattended Install of Ubuntu

2016-12-14. Category & Tags: Linux, Automatic, Ubuntu, Installation

OBS 1: this works only for ubuntu server edition, not desktop version. tested in ubuntu 16 x64.
OBS 2: remember to change some parts to real values, near: # modify to real value !!!
OBS 3: my version need some files in .iso file: “10_linux” & “sources.list”.
Warn: the default ks.cfg partition settings will erase the entire disk, and use LVM.

See also:
Boot Partitions, Install Multi-OS
easy2boot

PREPARE, AS ROOT #

sudo -s

...

Setup Remote Access (VNC) of Linux Servers

2016-12-02. Category & Tags: VNC, Server, Linux, XServer

Tested in Ubuntu 16.04 desktop Gnome+Unity in Vmware.
OBS: pure server will automatically start X in reboot and will lack of something, e.g. Default Terminal etc.

FIREWALL #

TCP port 5900+N (N is monitorId, starts from 1.)

TIGHT.VNC AS SERVER #

TightVnc allows us to start from a server without X11 and do everything in command line, remotely.

install (either already with or w/o desktop) #

sudo su: use root can avoid weird problems, see “ps”.

...

Nix Linux Distribution Comparison, Timeline and Relationship

2016-07-13. Category & Tags: Nix, Linux, Distro, Distributions

Main branches directly from linux kernels:

  1. Debian, (K)Ubuntu/Deepin …
  2. RedHat, CentOS, Fedora …
  3. Slackware, Suse, OpenSuse (Leap vs. Tumbleweed) …
  4. Arch, Manjaro …
  5. Android …

RHEL = Red Hat (Inc.) Enterprise Linux
SLE = SUSE Linux Enterprise
openSUSE Leap <–> CentOS(Rocky Linux)
openSUSE Tumbleweed <–> Fedora

Sizes Just After Installation (Disk & RAM) #

OS Installation
DISK size en (GB)
Installation
DISK size cn (GB)
RAM
(GB)
Notes
Deepin 20.4 ? 6.5 .75 深度. Debian + DDE, the Deepin Desktop Environment based on QT.
Kubuntu 1804 ? 8.3 .81
Kylin 1804 6.9 6.7 1.0
Xubuntu 1804 5.4 6.1 .62
Lubuntu 1804 5.3 5.6 .55 LXDE/LXQT, min GUI: Pentium 4 1.3G CPU + 512MB RAM.
Ubuntu 1804 ? 8.1 1.0
Ubuntu 2004 ? 8.6 .88
Kylin 2004 ? 13 1.9 Ready to go in CN, default Sogou IM
Manjaro 21.2.4 ? 5.9 .67 Arch based. Easy to use + LTS. Fast installation.
ReactOS Not nix, but like open source windows, mimicing windows server 2003.

Choosing a Distribution #


Big Picture Here (3000*2116)
ref 2015, src (2015)

...