Unix Handout 2017
Unix Handout 2017
command description
ls lists the files in the working directory
ls blah lists the files in directory blah
cd blah changes to a new directory (blah)
pwd show name of present working directory (where am I?)
cp file1 file2 copy files (file2 = copy of file1)
cp file dir copy files into a destination directory
cp -r dir1 dir2 copy directory & sub-directories (dir2 = copy of dir1)
mv blah1 blah2 move (or rename) files or directories (blah2 = new name)
mkdir blah make a new (empty) directory
rm blah removes (deletes) file(s). Caution! There is no “undelete”
rmdir blah removes (deletes) an empty directory
less blah show contents of a text file - one screen at a time (type “q” to exit)
cat blah show contents of a text file - all at once
history see a list of previous commands (can rerun one with !N - e.g. !55)
rm -rf DON’T DO IT! Removes LOTS of files...
command description
ls -la blah list files (+hidden ones) with extra info
chmod flags blah changes permissions for files/directories
nano blah simple text-only editor (for file blah)
emacs blah more powerful/complicated, text-only editor (for file blah)
control c kill current running job and give back a prompt
command & run this command in background (gives new prompt)
control z suspend current stop and give back a prompt (job not killed)
bg after control z, will make last job run in background (like &)
tab key fill in end of filename (press twice for all possibilities)
up/down arrow keys scroll through history of commands
fsl start the main FSL GUI (can start all other GUIs from this)
fsleyes imagefile view 3D or 4D images (specifying imagefile is optional)
diff file1 file2 show differences between the two text files
wc blah character/word/line count of file blah (not a water closet)