欢迎光临散文网 会员登陆 & 注册

虚拟机中通过终端的新建标签页的快捷方式,每次都打开的~/目录的解决办法

2023-07-13 01:27 作者:i种花家的兔子  | 我要投稿

这个问题似乎只在虚拟机中出现,如果物理运行的centos7 系统,在终端中打开的新的标签页的时候,默认就是当前文件夹目录下的。具体的解决办法如下:

1、在终端打开用户目录


cd ~


2、编辑.bashrc文件


 vim .bashrc


3、在合适的位置加上对应的代码:


3.1 如果想修改的是ctrl + T快捷键的话 :


# Open new terminal tab in current directory


if [[ $TERM = xterm* ]]; then


    bind -x '"\C-t": "gnome-terminal && cd $PWD"';


fi


3.2 如果想修改的是 ctrl + shift + t的话:


# Open new terminal tab in current directory with Ctrl + Shift + T


if [[ $TERM = xterm* ]]; then


    bind -x '"\e[1;6C": "gnome-terminal && cd $PWD"';


fi

4、重载 bashrc 文件

source .bashrc

虚拟机中通过终端的新建标签页的快捷方式,每次都打开的~/目录的解决办法的评论 (共 条)

分享到微博请遵守国家法律