Practice

Environment variable in Linux

Ref:

https://www.cnblogs.com/youyoui/p/10680329.html

https://www.jianshu.com/p/888b75667281

Files for Env

files for env:

1
2
3
4
5
6
/etc/profile
/etc/environment
/etc/bash.bahsrc
~/.profile
~/.bashrc
~/.bash_logout

The sequence of loading env:

img

Display Env

  1. echo $PATH for a single env
  2. env or export for all the env

Set Env

  1. Modify .bashrc or .profile for a single user
1
2
echo 'PATH=$PATH:~/biosoft/ncbi-blast-2.8.1+/bin/' >> ~/.bashrc
source ~/.bashrc

or

1
2
vim ~/.bashrc #在文件其末尾加上下面一句
export PATH="~/biosoft/ncbi-blast-2.8.1+/bin/:$PATH"
  1. Modify /etc/profile for every user
1
echo 'PATH=$PATH:~/biosoft/ncbi-blast-2.8.1+/bin/' >> /etc/profile (root用户或者sudo权限用户)
  1. export only for current shell
1
2
export <var>=<value>
export PATH=~/biosoft/ncbi-blast-2.8.1+/bin/:$PATH #echo在第一个

curl for testing

Ref:

http://www.ruanyifeng.com/blog/2011/09/curl.html

https://www.ruanyifeng.com/blog/2019/09/curl-reference.html

When we are in the Linux server, we may not be able to use postman or web tool. So we may use curl to make request