Bash is the most standard shell on Unix systems (Linux, MacOS, ...). A shell is a basic programming language to interact with the computer and launch commands.
There are standard commands (corresponding to programs) to do many basic tasks. You can read this short document https://files.fosswire.com/2007/08/fwunixref.pdf.
For example to get the current working directory, one can use:
pwd
/home/pierre/Output/Teach/intro-python/ipynb
We see that we ask pwd
and we get an answer (as a string).
There are also commands that do something but does not returb anything, for example cd (for "change directory"):
cd ..
ls
check_env.py ipynb Makefile README.md install.md LICENSE.txt pyfiles requirements.txt
ls -l
total 32 -rw-r--r-- 1 pierre pierre 641 Sep 25 14:40 check_env.py -rw-r--r-- 1 pierre pierre 3715 Sep 25 15:31 install.md drwxrwxr-x 4 pierre pierre 4096 Sep 25 15:42 ipynb -rw-rw-r-- 1 pierre pierre 1499 Sep 25 14:40 LICENSE.txt -rw-r--r-- 1 pierre pierre 938 Sep 25 15:10 Makefile drwxr-xr-x 4 pierre pierre 4096 Sep 25 14:44 pyfiles -rw-rw-r-- 1 pierre pierre 1655 Sep 25 15:35 README.md -rw-r--r-- 1 pierre pierre 196 Sep 25 14:52 requirements.txt
ls -a
. check_env.py .hg ipynb Makefile README.md .vscode .. .gitignore install.md LICENSE.txt pyfiles requirements.txt
ls -la
total 52 drwxrwxr-x 6 pierre pierre 4096 Sep 25 14:59 . drwxr-xr-x 7 pierre pierre 4096 Sep 25 13:50 .. -rw-r--r-- 1 pierre pierre 641 Sep 25 14:40 check_env.py -rw-r--r-- 1 pierre pierre 190 Sep 25 14:44 .gitignore drwxrwxr-x 6 pierre pierre 4096 Sep 25 15:40 .hg -rw-r--r-- 1 pierre pierre 3715 Sep 25 15:31 install.md drwxrwxr-x 4 pierre pierre 4096 Sep 25 15:42 ipynb -rw-rw-r-- 1 pierre pierre 1499 Sep 25 14:40 LICENSE.txt -rw-r--r-- 1 pierre pierre 938 Sep 25 15:10 Makefile drwxr-xr-x 4 pierre pierre 4096 Sep 25 14:44 pyfiles -rw-rw-r-- 1 pierre pierre 1655 Sep 25 15:35 README.md -rw-r--r-- 1 pierre pierre 196 Sep 25 14:52 requirements.txt drwxrwxr-x 2 pierre pierre 4096 Sep 25 14:59 .vscode
cd ipynb
pwd
/home/pierre/Output/Teach/intro-python/ipynb
cd ..
ls
check_env.py ipynb Makefile README.md install.md LICENSE.txt pyfiles requirements.txt
mkdir toto
ls
check_env.py ipynb Makefile README.md toto install.md LICENSE.txt pyfiles requirements.txt
rm -rf toto
which ls
/bin/ls
echo "toto"
toto
echo $PATH
/data0/opt/miniconda3/condabin/app:/home/pierre/.pyenv/shims:/home/pierre/.pyenv/bin:/home/pierre/.pyenv/versions/3.8.2/bin:/home/pierre/.pyenv/libexec:/home/pierre/.pyenv/plugins/python-build/bin:/data0/opt/miniconda3/condabin/app:/home/pierre/.pyenv/shims:/home/pierre/.pyenv/bin:/home/pierre/.cargo/bin:/data0/opt/miniconda3/condabin/app:/data0/opt/miniconda3/condabin:/home/pierre/.pyenv/shims:/home/pierre/.pyenv/bin:/home/pierre/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/pierre/opt/env_xonsh/bin/
echo $HOME
/home/pierre
ls
check_env.py ipynb Makefile README.md install.md LICENSE.txt pyfiles requirements.txt
echo "toto" > tmp.txt
ls
check_env.py ipynb Makefile README.md tmp.txt install.md LICENSE.txt pyfiles requirements.txt
cat tmp.txt
toto
echo "titi" >> tmp.txt
cat tmp.txt
toto titi
mv tmp.txt tmp2.txt
ls
check_env.py ipynb Makefile README.md tmp2.txt install.md LICENSE.txt pyfiles requirements.txt
mv tmp2.txt ..
ls ..
coursem1_pa_instabilities_turbulence py-training-2017 tmp2.txt intro-python intro-python training-hpc
rm -f ../tmp2.txt
ls ..
coursem1_pa_instabilities_turbulence py-training-2017 training-hpc intro-python intro-python