linux
vim打开文件保持上次的位置
打开/etc/vim/vimrc 添加
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
需root权限。
Codeblock更换运行终端
gnome-terminal --title=$TITLE –x
ssh反向登录
在服务端用
ssh -f -N -R 10000:localhost:22 username@ip
在另一端
ssh username@localhost -p 10000
10000为端口号,可以改成别的。
autossh反向登录
在内网机器上安装autossh,并产生公钥和私钥。
$ ssh-keygen
...(一直按Enter,最后在~/.ssh/下生成密钥)
$ ls ~/.ssh/
id_rsa id_rsa.pub known_hosts
复制B主机上生成的id_rsa.pub公钥到外网A主机上,并将内容加入到~/.ssh/authorized_keys中
$ cat id_rsa.pub >> ~/.ssh/authorized_keys
据说可以用ssh-copy-id,但是不会用。
在内网主机上:
autossh -M 5678 -NR 10022:localhost:22 [email protected] -p 22
file命令
可以查看一个文件是什么平台的。
apt,pacman等
search可以查找包。
类似,pacman用-Ss查找包,在msys2中,大部分包是以mingw-w64-i686或者mingw-w64-x86_64开头的。
mingw-get因为mingw32这个项目基本已经挂了,还是不用了吧。
指针问题
linux下一般已经是纯64位环境了,所以不能用32位整型强制转换指针。
图形界面死掉
ps -t tty7
查询屏幕进程的PID,
kill -9 PID
杀死屏幕后,屏幕自动重启。
Libreoffice不能输入中文
有可能是要补充这两个包:libreoffice-gtk3,libreoffice-gnome。
因为经常不是立刻生效,所以还不十分确定。