配置Mac/Linux终端启动执行脚本

查看当前系统终端使用的脚本

在macOS终端中,您可以通过执行以下命令来查看当前使用的shell类型:

bash 复制代码
echo $SHELL

这条命令会输出当前用户默认使用的shell路径,例如 <font style="color:rgb(51, 51, 51);background-color:rgb(237, 238, 240);">/bin/bash</font> 或 <font style="color:rgb(51, 51, 51);background-color:rgb(237, 238, 240);">/bin/zsh</font>。如果您想查看当前运行的shell,可以使用以下命令:

bash 复制代码
ps -p $$

这将显示当前shell进程的信息,包括使用的shell路径。

配置终端启动执行脚本

如果系统是mac,默认的终端脚本都是zsh。因此需要在home目录下配置**.zshrc**文件

bash 复制代码
export JAVA_HOME=$(/usr/libexec/java_home -v 21)

alias cdmysql='cd $MYSQL_HOME'
alias ll='ls -l'

如果系统是Linux,默认的终端脚本都是bash。因此需要在home目录下配置**.bashrc**文件

bash 复制代码
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific environment
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
相关推荐
未济5 天前
linux 配置环境变量
linux
傲世仙尊5 天前
目录即文件-Ext文件系统收尾篇
linux·c语言
虎头金猫5 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
_艾伦 耶格尔.5 天前
进程间通信
linux
AI职业加油站5 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
Liuqy-055 天前
Linux IO编程——静态库、动态库
linux
此冬歌咏5 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
彧azz5 天前
Linux 环境下 Redis 学习总结:数据类型、持久化、锁、事务、主从与缓存问题
linux·redis·笔记·学习·面试
-梅5 天前
linux(8) 软硬链接
linux·运维·服务器
AIgorithmGEEK5 天前
[Linux]线程三部曲(上):一个执行流的诞生——从操作系统一路拆到 pthread_create
linux·线程·pid