Download presentation
Presentation is loading. Please wait.
1
Introduction to Unix for FreeSurfer Users
2
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?
3
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
4
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
5
Linux Desktop
6
Directories (think folders in Windows)
Unix uses a hierarchical file system (think folders in Windows)
7
Directories (think folders in Windows)
Unix uses a hierarchical file system (think folders in Windows) Home is like “My Computer”
8
Directories (think folders in Windows)
Unix uses a hierarchical file system (think folders in Windows) Home is like “My Computer” Like “My Documents”
9
Directories Unix uses a hierarchical file system (think folders in Windows) Home is like “My Computer” Like “My Documents” Like “My Photos”
10
Directories Unix uses a hierarchical file system (think folders in Windows) Home is like “My Computer” Like “My Documents” Like “My Photos” picture.jpg
11
command -option1 –option2 file
Anatomy of a Command command -option1 –option2 file command - -help
12
command -option1 –option2 file
Anatomy of a Command command -option1 –option2 file command help Try: ls --help
13
shows “present working directory” or current location as a path
Type: and hit enter. Should see shows “present working directory” or current location as a path /Users/YourName OR pwd /home/nmrclass
14
Navigating Directories
“change directory”: move into a folder “list”: see contents of directory cd __ ls ls __
15
Navigating Directories
“change directory”: move into a folder “list”: see contents of directory cd __ ls ls __ Desktop matlab tmp TUTORIAL_DATA
16
Directory Contents List contents of directory you are in lists names of directories/files ls ls -a ls -l ls -lrt
17
Directory Contents List contents of directory you are in lists names of directories/files lists hidden files too ls ls -a ls -l ls -lrt .cshrc .bashrc .alias
18
Directory Contents List contents of directory you are in lists names of directories/files lists hidden files too lists file details drwxrwx--- ls ls -a ls -l ls -lrt user group others
19
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
20
Save Some Time Filename Completion hit Tab key should see hit enter History hit key should see ls Des ls Desktop ls Desktop
21
/home/nmrclass/practice
Changing Directories makes a new directory “practice” changes to directory “practice” mkdir practice ls -lrt /home/nmrclass pwd should see cd practice pwd /home/nmrclass/practice should see ls should see Nothing!
22
Changing Directories
23
Changing Directories makes folder “stuff” inside practice
mkdir stuff makes folder “stuff” inside practice ls should see “stuff”
24
/home/nmrclass/practice/stuff
Changing Directories shows one directory up ls .. can also do (but don’t right now): cd .. cd ../.. ls ../.. goes up two! pwd /home/nmrclass/practice/stuff should see
25
Format > Make plain text
Using an Editor emacs mynotes.txt open -e mynotes.txt If using a Mac: Type: I could write a script. File > Save (Buffer) File > Exit emacs should see “mynotes.txt” Format > Make plain text File > Save ls
26
Format > Make plain text
Using an Editor gedit mynotes.txt open -e mynotes.txt If using a Mac: Type: I could write a script. File > Save (Buffer) File > Exit emacs should see “mynotes.txt” Format > Make plain text File > Save ls
27
Using an Editor
28
Copying files is the copy command learn all the options or “arguments”
cp cp --help learn all the options or “arguments” cp mynotes.txt stuff cd stuff ls more mynotes.txt
29
Copying files is the copy command learn all the options or “arguments”
cp cp --help learn all the options or “arguments” cp mynotes.txt stuff cd stuff ls less mynotes.txt
30
Copying / Moving files Could also use do:
cp mynotes.txt myothernotes.txt mv myothernotes.txt hernotes.txt mv hernotes.txt
31
Removing Files pwd should be in “stuff” ls rm mynotes.txt ls
32
Things to know 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 2nd program if do not have a command prompt
33
Review no double clicking mkdir ls cd pwd emacs, gedit, vi, pico cp rm
34
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
35
To use FreeSurfer you’ll have to do:
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 source this script to get your computer ready to use FreeSurfer (sources other scripts & sets other variables) setenv SUBJECTS_DIR /path/to/data
36
To use FreeSurfer you’ll have to do:
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 source this script to get your computer ready to use FreeSurfer (sources other scripts & sets other variables) export SUBJECTS_DIR=/path/to/data
37
setenv SUBJECTS_DIR /path/to/data
Required Variables To go to location of your data: $ means take the value of the variable setenv SUBJECTS_DIR /path/to/data cd $SUBJECTS_DIR
38
setenv SUBJECTS_DIR /path/to/data
Required Variables To go to location of your data: $ means take the value of the variable setenv SUBJECTS_DIR /path/to/data cd $SUBJECTS_DIR aka cd /path/to/data
39
setenv TEST_VARIABLE yourname
$ How ‘echo’ works: To set a variable: To check what a variable is set to: echo anything setenv TEST_VARIABLE yourname echo $TEST_VARIABLE
40
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 To check variables echo $FREESURFER_HOME echo $SUBJECTS_DIR
41
More Help LineNavigation Homework packet Links on Wiki under “Unix Tutorial” Glossary of Unix commands
42
The End Good Luck!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.