ls -l
vs ls -la
/etc/bashrc
)ls
--> ls -h --color=auto
)Did you know GEO/SCC file system keeps snapshots of your work?
ls -l .snapshots/
System Commands
alias ls='ls -h --color=auto'
alias topu='top -u $(id -un)'
rm
Sun Grid Engine
alias qstatu='qstat -u $(id -un)'
alias qshv='qsh -V -l h_rt=24:00:00'
Movement
alias chris='cd /projectnb/landsat/users/ceholden'
alias landsat='cd /projectnb/landsat'
alias cms='cd /projectnb/landsat/projects/CMS/'
Not necessarily recommended (why?), but...
host=$(hostname)
if [[ "$host" == "geo" || "$host" == "scc1" || "$host" == "scc2" ]]; then
. /usr/local/Modules/default/init/bash
source ~/.module
fi
And ~/.module
:
module load python/2.7.5
module load gdal/1.10.0
module load R_earth/3.1.0
module load CCDCTools/_beta
Call your own scripts or programs:
if [ -d "$HOME/bin" ]; then
PATH="$PATH:$HOME/bin"
fi
Current prompt:
ceholden@ceholden-lhome:~/Documents/ceholden.github.io/present/tips$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
export PS1="\[$(tput setaf 2)\]\u@\h:\W\\$ \[$(tput sgr0)\]"
See http://bashrcgenerator.com/ or https://www.kirsle.net/wizards/ps1.html for generators.
"abusers"
function abusers() {
qstat | awk 'NR > 2 { if ($5 == "r") print $4 " " $9 }' | sort | \
awk '{ sums[$1] += $2} END \
{ for (i in sums) printf("%s %s\n", i, sums[i])}' | \
sort -k2 -n -r
}
export -f abusers
Cluster job ID matching pattern...
function jidof() {
pattern=$1
jid=""
for j in $(qstat -u $USER | grep $pattern | awk '{ print $1 }'); do
jid="$jid $j"
done
echo "$jid"
}
export -f jidof
GDAL - from https://github.com/dwtkns/gdal-cheat-sheet
function gdal_extent() {
if [ -z "$1" ]; then
echo "Missing arguments. Syntax:"
echo " gdal_extent <input_raster>"
return
fi
EXTENT=$(gdalinfo $1 |\
grep "Upper Left\|Lower Right" |\
sed "s/Upper Left //g;s/Lower Right //g;s/).*//g" |\
tr "\n" " " |\
sed 's/ *$//g' |\
tr -d "[(]" | tr "," " ")
echo -n "$EXTENT"
}
export -f gdal_extent
After doing so much work, why not back up your dotfiles?
Very popular practice - http://dotfiles.github.io/
In general,
ln -s
) the files to previous locations"Homeshick" - makes symbolic linking of dotfiles easy!
If you think of any neat dotfile tricks for GEO, please let me know.