Mac中终端每次打开一个标签都是一个固定的路径,这点对于从Linux发行版过来的用户来说,简直是很不爽,那么如何实现像Linux发行版一样,新标签的打开路径和启动它的标签路径一直呢?
以下几种方法仅供参考.分别是设置shell脚本, 修改Terminal设置,和修改iTerm设置.
创建文件/usr/local/bin/nt (需要Root权限),内容为
1 2 3 4 5 6 | #!/bin/bash #!/bin/bash osascript -e 'tell application "Terminal"' \ -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \ -e "do script with command \"cd `pwd`;clear\" in selected tab of the front window" \ -e 'end tell' &> /dev/null |
---|
赋予可执行权限
1 | sudo chmod a+x /usr/local/bin/nt |
---|
如不生效,重启终端程序.
选择Preferences—Startup—New tabs open with 或者如下图.
选择Preferences—Profile—General—Working Directory 或者如下图
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有