Linux 点滴
1. 如何用在xargs 调用cd ?
The pipe runs xargs in a subprocess, and xargs runs cd in a subprocess. Changes in a subprocess do not get propagated to the parent process.
There are two problems with your code:
a. xargs cannot run cd because cd is a built-in command and xargs can run only executable files.
b. Even if you run cd in a sub-process called from xargs, it will not have any effect on the parent process as explained above.
The solution is to run a sub-shell, inside it run cd and then you can execute commands in the new current directory.
ls | xargs -L 1 bash -c 'cd "$0" && pwd && ls'
2. 将linux用户添加到指定用户组中
sudo usermod -a -G groupName userName
3. virtualenv
离开virtualenv环境
deactivate
进入virtualenv环境
source <path to env>/bin/active
4. opensuse 运行virtualbox出现”Kernel driver not installed (rc=-1908) “错误
在opensuse上一般需要同时安装virtualbox、virtualbox-host-kmp-default 、virtualbox-qt 三个包,并且virtualbox-host-kmp-default 版本号k后面的数字要与linuxkernel一致。比如笔者用的opensuse的kernel是4.10.1,所需virtualbox版本>=5.1.14,如下图示: