WELCOME FREESURFER COURSE ATTENDEES!

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
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.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
Using Macs and Unix Nancy Griffeth January 6, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis of Complex.
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
Unix Tutorial for FreeSurfer Users Allison Stevens.
1 Day 3 Directories Files Moving & Copying. 2 Case Sensitive First thing to learn about UNIX is that everything is case sensitive. Thus the files: –enda.
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”
© Crown copyright Met Office An Introduction to Linux PRECIS Workshop, University of Reading, 23rd – 27th April 2012.
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.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
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.
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
CPSC 217 T03 Week I Part #1: Unix and HELLO WORLD Hubert (Sathaporn) Hu.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
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.
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Introduction to Programming Using C An Introduction to Operating Systems.
The Genome Analysis Centre Building Excellence in Genomics and Computational Bioscience.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Using the “CLI” Unix / Linux Preparation Course June 9, 2013 Lusaka, Zambia.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop III - Part A Shell Commands Professional Training.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
Learning Unix/Linux Based on slides from: Eric Bishop.
Project 3 File, Document, and Folder Management and Windows XP Explorer.
Review Why do we use protection levels? Why do we use constructors?
UNIX Basics Matt Hayward October 18, 2016 LS560 – Information Technology for information professionals.
Introduction to Unix for FreeSurfer Users
A Basic Introduction to the Linux Commandline
Development Environment
CS1010: Intro Workshop.
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
UNIX The Basics Source:
3.4 User Interfaces This tutorial will give you a first-hand experience of: Navigating the directory structure in a CLI and an unfamiliar GUI Running the.
Some Linux Commands.
The Command Prompt Commands are the way to “do things” in Unix
Part 3 – Remote Connection, File Transfer, Remote Environments
Guide To UNIX Using Linux Third Edition
The Linux Operating System
Shell Environments.
Introduction to Computers
UNIX Basics Internet Technology.
Collaboration with Google Docs
Microsoft Windows 2000 Professional
Intro to UNIX System and Homework 1
WELCOME FREESURFER COURSE ATTENDEES!
Introduction to Linux and Supercomputers
Introduction to Microsoft Windows
LING 408/508: Computational Techniques for Linguists
Operating Systems and Using Linux
Web Programming Essentials:
Introduction Paul Flynn
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
CSE 303 Concepts and Tools for Software Development
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
Presentation transcript:

WELCOME FREESURFER COURSE ATTENDEES! Good morning everyone and welcome to the FreeSurfer course Thank you for attending this optional talk so early in the morning,

Introduction to Unix for FreeSurfer Users changing directories copying files listing file contents Setting up environment variables specific to FreeSurfer *This talk is intended to be a very basic introduction to the Unix Operating System, for those of you who haven’t used it before or are new to using it. *We’ll cover some basic commands that will enable you to interact more confidently with FreeSurfer through the rest of the course -covers only basics: cd, copying files; no scripting -basic understanding of unix necessary to use FreeSurfer -not comprehensive, just to get you through course *At some point during the talk, I will encourage you to open up your own terminals on the laptops in front of you to try the commands along with me *If you have any issues doing this, there will be someone walking around the room who can come over, or if it’s a general question you can ask me.

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? power to write many scripts with many commands to work with lots of data to use computer resources on the network efficiently, such as clusters Use the term Linux interchangeably with Unix sometimes. Why use it? power to write many scripts with many commands to work with lots of data The data that comes off the scanner is lots of data – hundreds of slices per subject and within each slice hundreds to thousands of voxels. - It speeds up data processing, - and enables processing large batches of data simultaneously either by implementing a script that you’ve written or by passing your command to computational resources available to you such as network clusters

Getting Started For course-provided Linux computers: 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 *Instead of using a graphical user interface such as the one you would find on a windows operating system or the way most people probably use their macs, Communicate with operating system through a “shell” or terminal window. *so for example in windowas to run an application you would click on the relevant icon and the app launches. Or if you wanted to copy or delete a file, you would click on a folder icon and select your action from a drop down menu. On a unix platform, we launch apps and copy files through commands we type into the command line. So you could find the terminal icon on your desktop of the course laptops or your mac and click here to launch the terminal. And where your cursor is, is the start of the command line. OLD compare to Windows GUI → hit Start and see icons of programs to choose from. Similar to DOS. -to run programs, must type a command for what you want to do on the command line.

Linux Desktop Most course laptops are set up with the Ubuntu Linux distribution so this is what your screen should look like, your terminals are probably empty for now but we’ll start working with them in a minute

Directories (think folders in Windows) Unix uses a hierarchical file system (think folders in Windows) So again if you think of a windows user interface, you need to double click on each folder level before you can get to a file that you’re trying to open, like passing through multiple doors to get to the fridge. With your terminal though, you have access to all directory locations and levels at once on the command line so this makes accessing and performing actions on data comparatively much more efficient.

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

Directories (think folders in Windows) 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 “ Documents” *add a screen shot here for the windows terminal 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

command -option1 –option2 file Anatomy of a Command command -option1 –option2 file command - -help So for whichever action you want to perform or application you want to open, there will be a relevant command that you need to type. You’ll grow familiar with those commands as you practice more. So in your command line, you would type a command and then that command may offer you options which you can select using a flag (-) before your selection -option often called flag -this format is true for Unix and FreeSurfer commands -two dashes before the word “help” If you know a command but can’t remember which order to make your selections in, you can always type the command name followed by –help in the command window for a sort of menu telling you about the command, what it does, what input it requires and the different flag options that you can type in

command -option1 –option2 file Anatomy of a Command command -option1 –option2 file command - -help So we’ll try one now, in your terminal window type pwd -- help on the command line and then hit enter So it tells you a little about the command, ls is used to list the contents of whichever directory you specify or the current directory that you’re in if nothing has been specified -two dashes before help -argument could be a file or volume Try: pwd - - help

shows “present working directory” or current location as a path /home/nmrclass Type: and hit enter. Should see shows “present working directory” or current location as a path OR pwd /Users/YourName Next try the command pwd which prints the path of your current working directory. It’s basically like a trail of breadcrumbs from the root or home directory to where you are now. Same as the address bar that you would get in windows -notice there are no spaces in between the names. Unix does not like spaces so please avoid them -the path shows, at the end, the current directory you are in and all the directories you need to go through to get to it.

Navigating Directories “list”: see contents of directory “change directory”: move into a folder Type: pwd Type: cd /home/nmrclass/ ls cd <directory_name> Type ls to show directories in current folder Type cd and then let’s type documents Type pwd to see new path, ls again and then enter to show the contents of your current directory. Type cd /home/nmrclass/ (home/leah for you), pwd If your present working directory is this Typing ls will print these names to your terminal

Directory Contents List contents of directory you are in lists names of directories/files ls ls -a ls -l ls -lrt The ls command has different options for flags which you’ll remember from when we typed ls –help. ls just by itself lists the names of the files within the current directory

Directory Contents lists hidden files too List contents of directory you are in lists names of directories/files lists hidden files too ls ls -a ls -l ls -lrt -a “list –all” Hidden files have a dot in front of them, environment set up files user preferences, specify custom shortcut commands that you want or set it up to source FreeSurfer automatically for you , this is a little more advanced than I’ll go into now but someone can explain how you can do this later on in the course if you’re using your won laptop .cshrc .bashrc .alias

Directory Contents lists hidden files too lists file details List contents of directory you are in lists names of directories/files lists hidden files too lists file details d{rwx}{rwx}{---} # owner group ls ls -a ls -l ls -lrt “list the long version” so it tells you information on the date created, who created the file, the size and the file permissions File permissiong are contained in the first few letters so d stands for directory and then the next three letters apply to the user/owner of the file so in this example the user has read, write and execute permissions on the file which is like all access, the next three spaces apply to group permissions and then the last three spaces are for all others. if a permission does not apply to the user, a dash would be in the space in place of the letters, OLD -ownership of file as well as date it was created and size user group others

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 -a ls -l ls -lrt r could mean recursive or reverse, most recent files last

Save Some Time Filename Completion Type hit Tab key and you should see hit enter **Without changing directories, you can list what is under the directory Desktop History hit key and you should see ls Des ls Desktop SLIDE this is a good example actually of when I said you have access to many levels at once because here you can list the contents of the desktop without having to move into that folder, without having to go through that door, its like having x-ray vision into the fridge without having to go through the kitchen. ls Desktop history

/home/nmrclass/practice Changing Directories mkdir practice makes a new directory “practice” changes to directory “practice” ls -lrt /home/nmrclass pwd should see cd practice Always do ls and pwd afterwards to see what changed. pwd /home/nmrclass/practice should see ls should see Nothing – Folder is empty

Changing Directories

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

/home/nmrclass/practice/ Using Dots … shows one directory up Another time saver is using full stops to indicate directory level so a single dot ‘.’ represents the current directory level therefore ”ls .” is equivalent to ls in that it specifies the command to list contents of the current directory level. “ls ..” lists the contents of one directory up Ls ../.. Lists the contents of two directories up ls .. can also do (but don’t right now): cd .. cd ../.. ls ../.. goes up two! pwd /home/nmrclass/practice/ should see

Type: “I could write a script” Using an Editor If using Linux type: If using a Mac type: Type: “I could write a script” File > Save Close gedit Or Ctrl+q to quit Type Ctrl+x (save) and Ctrl+c (exit) should see “mynotes.txt” gedit mynotes.txt emacs mynotes.txt You can write a text file or open up a simple text editor In linux type gedit mynotes.txt and this will open gedit and name a blank text file mynotes.txt. type i could write a script Save that, - file save in gedit or on a mac ctrl-x close gedit or ctrl-c on a max to close and return to terminal Then type ls and you should see a new file there called mynotes.txt ls

Using an Editor

Copying files is the copy command cp cp --help cp mynotes.txt stuff Copy command - type help and read through the different options Copy mynotes.txt that we just created into stuff subdirectory Cd stuff and you should see it there now too To read the contents of a file without opening it in a text editor, you can use the more or less commands to print it to the terminal window. cd stuff ls more mynotes.txt

Copying files is the copy command cp cp --help cp mynotes.txt stuff “less” is similar to more, however it lets you scroll up and down pages. Must enter ‘q’ to get out of less command. cd stuff ls less mynotes.txt

Copying / Moving files Could also use dots: cp mynotes.txt myothernotes.txt mv myothernotes.txt hernotes.txt mv is like cut and paste, you can use it to move a file completely between directories or you’ll also use it to rename a file Could also use dots: mv hernotes.txt ..

Removing Files should be in “stuff” pwd ls rm mynotes.txt ls should be in pwd directory and if you type ls, you should see mynotes.txt so now to delete it, type rm mynotes.txt type ls again and it should be done now. A note of caution, the same feature that makes the unix command line so powerful is also dangerous when it comes to deleting items. When you delete something it’s gone forever; no trash can and often here is no are you sure step before deleting something so it’s good practice to get used to making copies of your original data before moving it around and working with it.

Things to know Case sensitive – Ls vs ls Does not like spaces in file names (e.g. filename.txt vs. file name.txt – use 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 Ctrl+a on mac goes to home; ctrl+e goes to end Ctrl+u clears the command line Ls or Cd will return an error Does NOT like spaces in file names. you’ll remember that the path is a string of words with forwards slashes to indicate directories and spaces tend to mess the path names up -keep hitting up arrow key to see other commands you typed in the past Ctrl+a on mac goes to home; ctrl+e goes to end Option + left right arrows jumps to spaces

Using FreeSurfer tell Operating System where FreeSurfer is 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 -for the tutorials today, FREESURFER_HOME will already be set for you. But when you go home and use FreeSurfer on your own machine, you will need to make sure you have these variables set before you can begin working with FreeSurfer. -during the course SUBJECTS_DIR will change often, so pay attention to instructions at top of tutorial and change it accordingly

Required Variables To use FreeSurfer you’ll have to do: export FREESURFER_HOME=/home/apps/freesurfer tell Operating System where FreeSurfer is source $FREESURFER_HOME/SetUpFreeSurfer.csh -use ‘export’ for bash shells – standard terminal language for linux and macs Can set up .profile or .cshrc (if you’re using a c shell) to always run these commands for you for every terminal window opened 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 tell Operating System where FreeSurfer is source $FREESURFER_HOME/SetUpFreeSurfer.csh -Set up environment or initialize freesurfer (see setenv a lot) 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 go to location of your data: $ means take the value of the variable cd $SUBJECTS_DIR once youve set up your subject directory, you can then use this command to navigate into this directory without having to type out the full path. -cd SUJBECTS_DIR is shortcut to cd /path/to/data -in tutorial will often have to cd $SUBJECTS_DIR

echo $<any_variable> Required Variables To go to location of your data: $ means take the value of the variable cd $SUBJECTS_DIR aka cd /path/to/data How ‘echo’ works echo $<any_variable>

echo $FREESURFER_HOME 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 after doing that, since the freesurfer required variables are already set up for you, you could try echo ... To check variables echo $FREESURFER_HOME echo $SUBJECTS_DIR

More Help http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/CommandLineNavigation Homework packet CoursePrep on wiki has helpful links

The End Good Luck!