Skip to content

Instantly share code, notes, and snippets.

@Phillip-a-richmond
Last active November 2, 2020 02:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Phillip-a-richmond/8b36d58fb2f03d4760869b0676d50692 to your computer and use it in GitHub Desktop.
Save Phillip-a-richmond/8b36d58fb2f03d4760869b0676d50692 to your computer and use it in GitHub Desktop.
# Actual commands from Session1 (green text)
ssh prichmond@gpcc-node01.bcricwh.lan
pwd
cd /mnt/scratch/Public/TRAINING/
ls /mnt/scratch/Public/TRAINING/
cd /mnt/scratch/Public/TRAINING/GenomeAnalysisModule/
ls ./
mkdir /mnt/scratch/Public/TRAINING/GenomeAnalysisModule/StudentSpaces/Sherlock/
cd ./StudentSpaces/Sherlock
cd /mnt/scratch/Public/TRAINING/GenomeAnalysisModule/StudentSpaces/Sherlock/
pwd
cd ../
pwd
ls
cd ./Sherlock
pwd
cp /mnt/scratch/Public/TRAINING/GenomeAnalysisModule/Files/Homo_sapiens.GRCh38.100.chr.gff3.gz /mnt/scratch/Public/TRAINING/GenomeAnalysisModule/StudentSpaces/Sherlock/
cd /mnt/scratch/Public/TRAINING/GenomeAnalysisModule/StudentSpaces/Sherlock/
ls -l -h Homo_sapiens.GRCh38.100.chr.gff3.gz
gunzip Homo_sapiens.GRCh38.100.chr.gff3.gz
chmod ugo=rwx /mnt/scratch/Public/TRAINING/GenomeAnalysisModule/StudentSpaces/Sherlock/Homo_sapiens.GRCh38.100.chr.gff3.gz
ls -lhtr /mnt/scratch/Public/TRAINING/GenomeAnalysisModule/StudentSpaces/Sherlock/Homo_sapiens.GRCh38.100.chr.gff3
more Homo_sapiens.GRCh38.100.chr.gff3
less Homo_sapiens.GRCh38.100.chr.gff3
head Homo_sapiens.GRCh38.100.chr.gff3
tail Homo_sapiens.GRCh38.100.chr.gff3
cat Homo_sapiens.GRCh38.100.chr.gff3
head Homo_sapiens.GRCh38.100.chr.gff3
head Homo_sapiens.GRCh38.100.chr.gff3 > SomeLines.gff3
rm SomeLines.gff3
grep “PAX6” Homo_sapiens.GRCh38.100.chr.gff3
grep “PAX6” Homo_sapiens.GRCh38.100.chr.gff3 > PAX6.gff3
wc PAX6.gff3
man wc
wget ftp://ftp.ncbi.nlm.nih.gov/pub/clinvar/tab_delimited/variant_summary.txt.gz
gunzip variant_summary.txt.gz
ls /global/scratch/ARC_Training/Session1/
cp PAX6.gtf PAX6_hg19.gtf
more genes.gtf
chmod ugo=rwx PAX6.gtf
grep “CDS” PAX6.gtf
# Detail on the commands
# Print Working Directory (pwd)
pwd
# Change Directory (cd)
## Basic
cd <filepath>
cd /global/scratch/ARC_Training/Session1/
## Up a directory in the filesystem
cd ../
## To a relative directory
cd ./Session1/
## To your home directory
cd ~
# or just type cd alone
cd
# Make a directory (mkdir)
mkdir /global/scratch/ARC_Training/Session1/RICHMOND/
# Move File (mv)
## Basic
### mv <filepath1> <filepath2>
mv /home/richmonp/test.txt /global/scratch/ARC_Training/Session1/Files/test.txt
## Rename file
### mv <filepath1> <filepath2>
mv /home/richmonp/test.txt /home/richmonp/ABetterName.txt
# Copy File (cp)
## Basic
### cp <filepath1> <filepath2>
cp /global/scratch/ARC_Training/Session1/Files/genes.gtf /global/scratch/ARC_Training/Session1/RICHMOND/
## Copy and rename
### cp <filepath1> <filepath2>
cp /global/scratch/ARC_Training/Session1/Files/genes.gtf /global/scratch/ARC_Training/Session1/RICHMOND/genes_hg38.gtf
## Copy a Directory
### cp -r <filepath1> <filepath2>
cp -r /global/scratch/ARC_Training/Session1/RICHMOND/ /global/scratch/ARC_Training/Session1/Problemset/
# List (ls)
## Basic
### ls <filepath>
ls /global/scratch/ARC_Training/Session1/
## Add options for -h (human readable), -l (long listing), -t (sort by time), -r (reverse order)
ls -lhtr /global/scratch/ARC_Training/Session1/genes.gtf
# Change permissions (chmod)
## Basic
### chmod ugo=rwx <filepath>
chmod ugo=rwx /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
## On everything in a directory
### chmod ugo=rwx -R <filepath>
chmod ugo=rwx -R /global/scratch/ARC_Training/Session1/RICHMOND/
## Only give yourself access, let the world read it though
### chmod u=rwx,go=r <filepath>
chmod u=rwx,go=r /global/scratch/ARC_Training/Session1/
## Only give yourself access, let them have nothing
### chmod u=rwx,go=- <filepath>
chmod u=rwx,go=- /global/scratch/ARC_Training/Session1/
# Exploring File Contents (more)
# more <filepath>
more /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
# Exploring File Contents (less)
### less <filepath>
less /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
# Print top of file to stdout (head)
## Basic
### head <filepath>
head /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
## Specify number of lines
### head -n 100 <filepath>
head -n 100 /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
# Print bottom of file to stdout (tail)
### tail <filepath>
$ tail /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
# Print whole file to stdout (cat)
### cat <filepath>
$ cat /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
# Capture Standard Out
## Basic (head example)
### <command> > <filepath>
head /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf > /global/scratch/ARC_Training/Session1/RICHMOND/SomeLines.gtf
# Remove/Delete a file
## Basic
### rm <file>
rm /global/scratch/ARC_Training/Session1/RICHMOND/SomeLines.gtf
## Everything in a directory (CAREFUL)
### rm -r <filepath>
rm -r /global/scratch/ARC_Training/Session1/BeCarefulWithThisCommand/
# Grab regular expression (grep)
## Basic
### grep <pattern> <filepath>
grep "PAX6" /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
## Basic with capture
### grep <pattern> <filepath> > <filepath>
grep "PAX6" /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf > /global/scratch/ARC_Training/Session1/RICHMOND/PAX6.gtf
## Matching just the word
grep -w "PAX6" /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
## Inverted matching, return all non-matches
grep -v "PAX6" /global/scratch/ARC_Training/Session1/RICHMOND/genes.gtf
# Word Count (wc)
## Basic
### wc <filepath>
wc /global/scratch/ARC_Training/Session1/RICHMOND/PAX6.gtf
## Just lines
### wc -l <filepath>
wc -l /global/scratch/ARC_Training/Session1/RICHMOND/PAX6.gtf
# Manual (man)
## Basic
### man <command>
man wc
# Web Get (wget)
## Basic
### wget <URL>
wget ftp://ftp.ncbi.nlm.nih.gov/pub/clinvar/tab_delimited/variant_summary.txt.gz
# G-unzip (gunzip)
## Basic
### gunzip <filepath>
gunzip ftp://ftp.ncbi.nlm.nih.gov/pub/clinvar/tab_delimited/variant_summary.txt.gz
## Keep compressed file
### gunzip -c <filepath> > <outfilepath>
gunzip -c /global/scratch/ARC_Training/Session1/RICHMOND/variant_summary.txt.gz > /global/scratch/ARC_Training/Session1/RICHMOND/variant_summary.txt
# Cut/Extract columns from a delimited file
## Basic
### cut -f#,# <filename>
cut -f 1,4,5 GRN.gtf > GRN.bed
# Echo (echo)
echo "Just a test file, made with the echo command" > /home/richmonp/test.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment