2  Week 1 Exercises

2.1 In class code examples

  1. Clone the bash_for_bio repository into your home directory:
git clone https://github.com/fhdsl/bash_for_bio

Change directories:

cd bash_for_bio
  1. Try checking the disk usage using du for the bash_for_bio folder in your /home directory (mine is /home/tladera2/bash_for_bio).
du -d 1 -h /home/tladera2/bash_for_bio/

Try out using du -d -h 2 on your home directory:

du -d 2 ~/
  1. What are the permissions for the GitHub repo (bash_for_bio) that you just downloaded?

  2. Copy the script tell_the_time.sh in the scripts/week1/ directory to the top directory of bash_for_bio. Make the script executable. Run the script.

#put code here
  1. Try making your own file called my_file.txt:
nano my_file.txt

Add some text to it.

Use CTRL-X to exit, and make sure to select “Yes” to save.

  1. Change permissions for the scripts/ folder:
chmod -R 700 scripts/

2.2 Homework Exercises

All exercises are required for the badge.

  1. Use du to check the disk usage of two folders in your /bash_for_bio directory. Set the depth (-d) option to 1. Put your code in the box below
du -d 1 -h -------
  1. Copy a file from the scripts/week1/ directory in bash_for_bio/ to your own home directory.

/home/tladera2/bash_for_bio/scripts/week1/run_this.sh

Check the permissions. If necessary, change the script to read/write/executable for yourself:

chmod --- run_this.sh

Try running it in your home directory - did it work?

./run_this.sh

  1. (pick python or R) Take a look at scripts/week1/rnorm.R or scripts/week1/random_num.py. Load up the fhR or fhPython modules on rhino using module load. Run it on the command line with Rscript or python3.

Did you need to make this script executable before you ran it?

module load _____
--------
module purge