Aliases and local variables: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
Honfi001 (talk | contribs)
Created page with " * motivation for aliases and variables * ===Example ~/.bash_aliases=== ‎<pre> #!/bin/bash #Define editor editor='nano' #or vim # Bash files commands alias ebc="${editor} ${HOME}/.bashrc" alias sbc="source ${HOME}/.bashrc" alias eba="${editor} ${HOME}/.bash_aliases" alias sba="source ${HOME}/.bash_aliases" # ls aliases alias ll="ls -alth" alias sl='ls' #location variables export mySCRATCH=/lustre/scratch/GUESTS/$USER export myBKP=/lustre/backup/GUESTS/$USER expor..."
 
Honfi001 (talk | contribs)
Add APPTAINER_CACHEDIR to the .bash_alises template
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''DRAFT'''


* motivation for aliases and variables
* motivation for aliases and variables
*
* Brief explanation of what aliases are
* Some basic commands


===Example ~/.bash_aliases===
===Example ~/.bash_aliases===
Line 22: Line 24:


#location variables
#location variables
export mySCRATCH=/lustre/scratch/GUESTS/$USER
# Note! that the location for the lustre folders depends on your affiliation
export myBKP=/lustre/backup/GUESTS/$USER
# The <affiliation> field below is a place holder and it will break it not modified
export myNBKP=/lustre/nobackup/GUESTS/$USER
# For WUR researchers in a commitment group it will be
# affiliation=WUR/<group>
for external users belonging to an organization it will be
# affiliation=<nameOfOrganization>
 
# Modify this
affiliation=
 
export mySCRATCH=/lustre/scratch/$affiliation/$USER
export myBKP=/lustre/backup/GUESTS/$affiliation/$USER
export myNBKP=/lustre/nobackup/$affiliation/$USER


#  
#  
alias cds="cd $mySCRATCH"
alias cds="cd $myScratch"
alias cdb="cd $myBKP"
alias cdb="cd $myBkp"
alias cdn="cd $myNBKP"
alias cdn="cd $myNBkp"
‎</pre>
#Apoptainer cache location
export APPTAINER_CACHEDIR=$myScratch/.apptainer-cache</pre>





Latest revision as of 10:33, 23 June 2025

DRAFT

  • motivation for aliases and variables
  • Brief explanation of what aliases are
  • Some basic commands

Example ~/.bash_aliases

#!/bin/bash
#Define editor

editor='nano' #or vim

# Bash files commands
alias ebc="${editor} ${HOME}/.bashrc"
alias sbc="source ${HOME}/.bashrc"
alias eba="${editor} ${HOME}/.bash_aliases"
alias sba="source ${HOME}/.bash_aliases"

# ls aliases
alias ll="ls -alth"
alias sl='ls'

#location variables
# Note! that the location for the lustre folders depends on your affiliation
# The <affiliation> field below is a place holder and it will break it not modified
# For WUR researchers in a commitment group it will be 
# affiliation=WUR/<group>
for external users belonging to an organization it will be
# affiliation=<nameOfOrganization>

# Modify this
affiliation=

export mySCRATCH=/lustre/scratch/$affiliation/$USER
export myBKP=/lustre/backup/GUESTS/$affiliation/$USER
export myNBKP=/lustre/nobackup/$affiliation/$USER

# 
alias cds="cd $myScratch"
alias cdb="cd $myBkp"
alias cdn="cd $myNBkp"
‎
#Apoptainer cache location
export APPTAINER_CACHEDIR=$myScratch/.apptainer-cache


In order to make this effective, make sure that the following lines are in your ~/.bashrc

if [ -f ~/.bash_aliases ]; then
        . ~/.bash_aliases
fi