Linux TIPS collect (神奇的知识集合)

  1. http_proxy environment in sudo command: http_proxy=xxx:xxx sudo yourcommand doesn't work, you should sudo http_proxy=xxx:yyy yourcommand instead.
  2. ssh running local script: ssh username@hostname 'bash -s' < your.local.script.sh
  3. ssh running local script with paraemters: ssh username@hostname < your.local.script.sh 'bash -s' yourparam1 yourparam2 doesn't work, you should runssh username@hostname < your.local.script.sh 'bash -s' -- yourparam1 yourparam2
  4. make your fonts configuration work without a reboot: sudo fc-cache -fv

Can't boot VMs after host kernel upgrade (CentOS8)

I followed this article to upgrade the kernel of one of our Linux server runs CentOS8. According to that article, upgrade the kernel of a CentOS system is rather simple, you just need to run the following command as root:

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
dnf -y install https://www.elrepo.org/elrepo-release-8.0-2.el8.elrepo.noarch.rpm
dnf -y --enablerepo=elrepo-kernel install kernel-ml

Everything goes fine before I try to boot up one of the VM in Virtualbox 6.

Boot failure, "The system is currently not set up to build kernel modules, please install the Linux kernel header files matching the current kernel.", it says.

Obviously, we need the correct header file, after digging a while on Google, I didn't get an answer. Then I review the steps I have done to upgrade the kernel. Oh, I got the solution below:

dnf -y --enablerepo=elrepo-kernel install kernel-ml-devel
/sbin/rcvboxdrv setup

Problem resolved.

Making bootable usb stick by dd command

You are already using Linux, so you have dd already, you don't need any other tools to make a bootable USB disk!

sudo dd bs=1M if=galliumos-3.1-baytrail.iso of=/dev/sda ; sync

Notice:

You should use your iso file name and replace /dev/sda to your own USB disk device.

Reference

ubuntu 20.04 upgrade axel to 2.17.9

try to download something but axel said "SSL error: (null)", so

axel https://github.com/axel-download-accelerator/axel/releases/download/v2.17.9/axel-2.17.9.tar.gz
tar xvfz axel-2.17.9.tar.gz 
cd axel-2.17.9
sudo apt install pkg-config -y
./configure && make && sudo make install
sudo apt remove axel
cd ..
rm -rf axel-2.17.9

vim 向上删除 n 行

我们都知道从当前行往下删除 n 行很容易, ndd 就好了。但往上删除呢? 我以前是不知道的,最近搜索了一下,找到了答案,而且额外学到了其他的技巧,你想听吗(不想听我也会写,哈哈

8dd其实是dd重复8次,容易记忆,但效率很低。正确的姿势是 7dj 或者 d7j。我想你看到这里已经猜到应该怎么向上删除了。如果打算从当前行往上删除n行,你需要 {n-1}dk 或者 d{n-1}k

故事到这里应该结束了,然而.... 试试 V3kd, V4jd,注意是大写的V。你会对vim的强大有更多的理解。

By the way, 如果你要从当前行删除到你知道行号的某一行,举例来说,你要从当前行一直删到第434行,无所谓是向上删还是向下删,用 d434G 就可以了。