linux 中 创建环境变量若干方法
001、直接修改PATH环境变量
[root@PC1 plink]# ls ## 软件目录 LICENSE plink plink_linux_x86_64_20230116.zip prettify toy.map toy.ped [root@PC1 plink]# pwd ## 路径 /home/software/plink [root@PC1 plink]# echo "export PATH=$PATH:/home/software/plink" >> ~/.bashrc ## 修改配置文件 [root@PC1 plink]# source ~/.bashrc ## 刷新 (base) [root@PC1 plink]# conda deactivate [root@PC1 plink]# plink | head -n 2 ## 调用测试 PLINK v1.90b7 64-bit (16 Jan 2023) www.cog-genomics.org/plink/1.9/ (C) 2005-2023 Shaun Purcell, Christopher Chang GNU General Public License v3
002、软连接实现
[root@PC1 plink]# ls LICENSE plink plink_linux_x86_64_20230116.zip prettify toy.map toy.ped [root@PC1 plink]# plink bash: plink: command not found... Similar command is: 'link' [root@PC1 plink]# readlink -f plink /home/software/plink/plink [root@PC1 plink]# ln -s /home/software/plink/plink /bin/ [root@PC1 plink]# plink | head -n 2 PLINK v1.90b7 64-bit (16 Jan 2023) www.cog-genomics.org/plink/1.9/ (C) 2005-2023 Shaun Purcell, Christopher Chang GNU General Public License v3
003、直接复制
[root@PC1 plink]# ls LICENSE plink plink_linux_x86_64_20230116.zip prettify toy.map toy.ped [root@PC1 plink]# plink bash: plink: command not found... Similar command is: 'link' [root@PC1 plink]# cp plink /bin/ [root@PC1 plink]# plink | head -n 3 PLINK v1.90b7 64-bit (16 Jan 2023) www.cog-genomics.org/plink/1.9/ (C) 2005-2023 Shaun Purcell, Christopher Chang GNU General Public License v3
004、命令别名实现
[root@PC1 plink]# ls LICENSE plink plink_linux_x86_64_20230116.zip prettify toy.map toy.ped [root@PC1 plink]# plink bash: plink: command not found... Similar command is: 'link' [root@PC1 plink]# readlink -f plink /home/software/plink/plink [root@PC1 plink]# echo "alias plink=\"/home/software/plink/plink\"" >> ~/.bashrc [root@PC1 plink]# source ~/.bashrc (base) [root@PC1 plink]# conda deactivate [root@PC1 plink]# plink | head -n 3 PLINK v1.90b7 64-bit (16 Jan 2023) www.cog-genomics.org/plink/1.9/ (C) 2005-2023 Shaun Purcell, Christopher Chang GNU General Public License v3