Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki: https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

PacNOG 6: Nadi, Fiji Using Commands in Linux Hervey Allen Network Startup Resource Center.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Unix Basics. Systems Programming: Unix Basics 2 Unix Basics  Unix directories  Important Unix file commands  File and Directory Access Rights through.
Basic Unix Dr Tim Cutts Team Leader Systems Support Group Infrastructure Management Team.
“Linux at the Command Line” Don Johnson of BU IS&T.
Unix Tutorial for FreeSurfer Users
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Unix Tutorial for FreeSurfer Users Allison Stevens.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
UNIX command line. In this module you will learn: What is the computer shell What is the command line interface (or Terminal) What is the filesystem tree.
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Introduction to Shell Script Programming
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Unix Basics Chapter 4.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #4  Unix software architecture  Correcting mistakes  System setups  Useful commands for the beginner.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
Processing Your Own Data With FreeSurfer, certain variables must be set in order to use it correctly: FREESURFER_HOME SUBJECTS_DIR tell Operating System.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
Intro to Programming Environment 1. Today You Will Learn how to connect to a machine remotely with “nomachine NX client” Learn how to create a new “source.
A Genomics View of Unix. General Unix Tips To use the command line start X11 and type commands into the “xterm” window A few things about unix commands:
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Linux and Java Basics. What is Linux? Operating system by Linus Torvalds that was a clone of Unix (thus Linux) Free and open source – this is the reason.
Introduction to Programming Using C An Introduction to Operating Systems.
Linux Commands C151 Multi-User Operating Systems.
EGEE-III INFSO-RI Enabling Grids for E-sciencE Apr. 25, Grid Computing Hands On Training for Users Faculty of Sciences, University.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Linux A practical introduction. 1)Background and Getting Started Linux is an operating system with multiple providers Red Hat/CentOS (our version) Ubuntu.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Learning basic Unix command It 325 operating system.
Learning Unix/Linux Based on slides from: Eric Bishop.
 Prepared by: Eng. Maryam Adel Abdel-Hady
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
CMSC 104, Version 9/011 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None.
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
Introduction to Unix for FreeSurfer Users
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
CIRC Winter Boot Camp 2017 Baowei Liu
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Prepared by: Eng. Maryam Adel Abdel-Hady
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Andy Wang Object Oriented Programming in C++ COP 3330
Some Linux Commands.
The Linux Operating System
Shell Environments.
WELCOME FREESURFER COURSE ATTENDEES!
WELCOME FREESURFER COURSE ATTENDEES!
LING 408/508: Computational Techniques for Linguists
Operating Systems and Using Linux
Web Programming Essentials:
Andy Wang Object Oriented Programming in C++ COP 3330
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
Module 6 Working with Files and Directories
Presentation transcript:

Unix Tutorial for FreeSurfer Users

Helpful To Know FreeSurfer Tutorial Wiki: Questions? Answers: /QuestionAnswers /QuestionAnswers

What is Unix/Linux? An operating system (like Windows and OS X) Linux is the free, modifiable, and redistributable version of Unix Why use it?

What is Unix/Linux? An operating system (like Windows and OS X) Linux is the free, modifiable, and redistributable version of Unix Why use it? –freedom to modify and customize –power to write many scripts with multiple commands to manage data –to use computer resources on the network efficiently, such as clusters

Getting Started Communicate with operating system through a “shell” or terminal window. For course-provided Linux computers: Double click Terminal icon on Desktop For Macs: Applications > Utilities > XQuartz (double click) Applications > Utilities > Terminal

Warm Up Type: and hit enter. date

Warm Up Type: and hit enter. Should see date Mon Apr 6 8:05:24 EDT 2009

Warm Up Type: and hit enter. Should see Type: and hit enter. date Mon Apr 6 8:05:24 EDT 2009 cal

Warm Up Type: and hit enter. Should see Type: and hit enter. Should see date Mon Apr 6 8:05:24 EDT 2009 cal April 2009 Su Mo Tu We Th Fr Sa

Directories Unix uses a hierarchical file system ( think folders in Windows )

Directories Unix uses a hierarchical file system ( think folders in Windows ) Home is like “My Computer”

Directories Unix uses a hierarchical file system ( think folders in Windows ) Home is like “My Computer” Like “My Documents”

Directories Unix uses a hierarchical file system ( think folders in Windows ) Home is like “My Computer” Like “My Documents” Like “My Photos”

Directories Unix uses a hierarchical file system ( think folders in Windows ) Home is like “My Computer” Like “My Documents” Like “My Photos” picture.jpg

Location path: /MyComputer/MyDocuments/MyPhotos Type: and hit enter. Should see shows “present working directory” or current location as a path pwd /home/nmrclass /Users/YourName OR

Opening a Directory Not double clicking Type command to “open” Commands to open files will differ

Navigating Directories “change directory”: move into a folder “list”: see contents of directory ls cd __ ls __

Navigating Directories “change directory”: move into a folder “list”: see contents of directory ls cd __ ls __ Desktop matlab tmp TUTORIAL_DATA

Anatomy of a Command command -option1 –option2 file command - -help man __ For Mac :

Anatomy of a Command command -option1 –option2 file command - -help ls --help Try: or man ls

Directory Contents List contents of directory you are in lists names of directories/files ls ls -lrt ls -l ls -a

Directory Contents List contents of directory you are in lists names of directories/files lists hidden files too.cshrc.bashrc.alias ls ls -lrt ls -l ls -a

Directory Contents List contents of directory you are in lists names of directories/files lists hidden files too lists file details drwxrwx--- user group others ls ls -lrt ls -l ls -a

Directory Contents List contents of directory you are in lists names of directories/files lists hidden files too lists file details lists recent files last ls ls -lrt ls -l ls -a

Save Some Time Filename Completion hit Tab key should see hit enter History hit keyshould see ls Des ls Desktop

Changing Directories makes a new directory “practice” changes to directory “practice” mkdir practice cd practice ls -lrt pwd ls pwd /home/nmrclass /home/nmrclass/practice should see Nothing!

Changing Directories

mkdir stuff ls makes folder “stuff” inside practice should see “stuff”

Using an Editor If using a Mac: Type: I could write a script. File > Save (Buffer) File > Exit emacs should see “mynotes.txt” emacs mynotes.txtopen -e ls Format > Make plain text File > Save

Using an Editor If using a Mac: Type: I could write a script. File > Save (Buffer) File > Exit gedit should see “mynotes.txt” Other Editors: pico gedit mynotes.txt ls Format > Make plain text File > Save open -e

Using an Editor Ctrl+C Returns prompt & Runs program in background gedit error.log &

Copying Files ls cp --help cp mynotes.txt stuff cd stuff more mynotes.txt learn all the options or “arguments” is the copy command cp

Copying Files ls cp --help cp mynotes.txt stuff cd stuff less mynotes.txt learn all the options or “arguments” is the copy command cp

Changing Directories shows one directory up ls.. pwd /home/nmrclass/practice/stuff ls../.. goes up two! cd.. should see cd../.. can also do (but don’t right now)

Copying / Moving Files cp mynotes.txt myothernotes.txt Could also use/do: mv myothernotes.txt hernotes.txt mv hernotes.txt..

Removing Files rm mynotes.txt ls pwd should be in “stuff” ls

Using FreeSurfer With FreeSurfer, certain variables must be set in order to use it correctly: FREESURFER_HOME SUBJECTS_DIR tell Operating System where FreeSurfer is tell FreeSurfer where data is

What is a Variable? Character string that is assigned a value Way of passing information from the shell to programs Assign a value to a variable Programs look “in the environment” for variables Easy to change values/manipulate

What is a Variable? How ‘echo’ works: To set a variable: To check what a variable is set to: echo $TEST_VARIABLE export TEST_VARIABLE= yourfirstname echo Freesurfer Rocks!

Using FreeSurfer With FreeSurfer, certain variables must be set in order to use it correctly: FREESURFER_HOME SUBJECTS_DIR tell Operating System where FreeSurfer is tell FreeSurfer where data is

Required Variables To use FreeSurfer you’ll have to do: export FREESURFER_HOME=/home/apps/freesurfer source $FREESURFER_HOME/SetUpFreeSurfer.sh tell Operating System where FreeSurfer is source this script to get your computer ready to use FreeSurfer (sources other scripts & sets other variables) export SUBJECTS_DIR= /path/to/data

Required Variables To use FreeSurfer you’ll have to do: export FREESURFER_HOME=/home/apps/freesurfer source $FREESURFER_HOME/SetUpFreeSurfer.sh aka source /home/apps/freesurfer/SetUpFreeSurfer.sh tell Operating System where FreeSurfer is source this script to get your computer ready to use FreeSurfer (sources other scripts & sets other variables) export SUBJECTS_DIR= /path/to/data

Required Variables To use FreeSurfer you’ll have to do: setenv FREESURFER_HOME /home/apps/freesurfer source $FREESURFER_HOME/SetUpFreeSurfer.csh tell Operating System where FreeSurfer is source this script to get your computer ready to use FreeSurfer (sources other scripts & sets other variables) setenv SUBJECTS_DIR /path/to/data

Required Variables To use FreeSurfer you’ll have to do: setenv FREESURFER_HOME /home/apps/freesurfer source $FREESURFER_HOME/SetUpFreeSurfer.csh aka source /home/apps/freesurfer/SetUpFreeSurfer.csh tell Operating System where FreeSurfer is source this script to get your computer ready to use FreeSurfer (sources other scripts & sets other variables) setenv SUBJECTS_DIR /path/to/data

Required Variables With FreeSurfer, certain variables must be set in order to use it correctly: FREESURFER_HOME SUBJECTS_DIR tell Operating System where FreeSurfer is tell FreeSurfer where data is echo $FREESURFER_HOME echo $SUBJECTS_DIR To check variables

Required Variables To go to location of your data: $ means take the value of the variable cd $SUBJECTS_DIR export SUBJECTS_DIR= /path/to/data

Required Variables To go to location of your data: $ means take the value of the variable cd $SUBJECTS_DIR aka cd /path/to/data export SUBJECTS_DIR= /path/to/data

Review Case sensitive Does not like spaces in file names (e.g. filename.txt vs. file name.txt) Ctrl+c kills a process & brings back command prompt Type ‘q’ to quit the program ‘less’ Highlight & middle click to copy & paste Use ‘&’ to open a program in the background Cannot open a 2 nd program if do not have a command prompt

Review no double clicking mkdir ls cd pwd emacs, gedit, pico cp rm

More Help UNIX Tutorial For Beginners: Linux in a Nutshell: UNIX Cheat Sheet: Command Line Tutorial: ineNavigation ineNavigation

The End Good Luck!

Writing Scripts Putting multiple commands together. Automatically running a sequence of commands Example: create a file named my_first_script.csh with the contents: #!/bin/csh setenv name FreeSurfer echo I love $name ! % chmod u+x my_first_script.csh %./my_first_script.csh

Loops in Scripts You can create loops, if statements, … Example: create a file named my_first_loop.csh with the contents: #!/bin/csh foreach name (‘Bill Murray’ ‘Wes Anderson’) echo I love $name ! end

Inputs to Scripts You can create take inputs from the command line Example: create a file named my_first_IO.csh with the contents: #!/bin/csh echo The $0 command is called with $#argv parameters echo parameter 1 is $1 echo parameter 2 is $2

Required Variables To use FreeSurfer you’ll have to do: setenv FREESURFER_HOME /home/apps/freesurfer source $FREESURFER_HOME/SetUpFreeSurfer.csh tell Operating System where FreeSurfer is source this script to get your computer ready to use FreeSurfer (sources other scripts & sets other variables) setenv SUBJECTS_DIR /path/to/data

Registration -align subjects -common space -reference points b/w subjects will be same transforms template deform morph warp compute resample

More Help alias e emacs man alias ls file*  lists file1, file2, file3 ls file[12]  lists file1 and file2 but not file3 command >>& file.txt  save output to screen and errors in text file