Module 3 Linux commandline concepts - HRGV/Marmics_Metagenomics GitHub Wiki

The Linux commandline is superpowerful

REMEMBER CAPITAL letters indicate names, variables etc. that you can set. Consider clarity over brevity!

add the conda path to be able to use conda

Please add the following line to your '.bashrc'

export PATH=/software/ANACONDA/anaconda3/bin:$PATH

sync folders across servers

We want the databases directory available on all servers, so we need to sync them using

 rsync -avz /scratch/databases/ bigmem-2:/scratch/databases/

create soft links to files

A softlink is very helpful to avoid having the same data copied all over the file system. You can e.g. link all read files in the raw_files into the current directory with

 ln -s ../SOURCEFOLDER/*.gz .

ln -s creates a softlink ../SOURCEFOLDER/*.gz

append additions to your $PATH variable to your commandline configuration

Your command prompt and environment is largely defined in a file ~/.bashrc We have quite a few paths that you want to add to conveniently run software tools. The necessary paths are in file /bioinf/transfer/Marmics_SPMG2019/data/lecture_3_linux/addtobashrc.txt

 cat /bioinf/transfer/Marmics_SPMG2021/lecture_3_linux/addtobashrc.txt >> ~/.bashrc

adds this information to your .bashrc

To be able to use conda, please add the following using nano: export PATH=/software/ANACONDA/anaconda3/bin:$PATH

 nano ~/.bashrc

then save with CTRL+X and run

 source ~/.bashrc

loads the new .bashrc

You can then test the setting using e.g. \

     env 
     echo $PATH

make a folder and its contents accessible for everyone

to change the permissions on a given folder you can always

 chmod 777 FOLDERNAME -R

check what is running on the current computer

top -c

kill a running program

 STRG+c

pimp your history

You can pimp your settings for the history to avoid duplication and to save and reload after every command. Simply add the following section to your .bashrc file

##HIST
# avoid duplicates..
export HISTCONTROL=ignoredups:erasedups
# append history entries..
shopt -s histappend
# After each command, save and reload history
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"