https://drive.google.com/file/d/1MsQyG9i_7IV_GmpuONwPb1bTnmAs1BeG/view?usp=share_link - introduction recording presented via Google Meet’s (in Polish)
tmux
(Terminal Multiplexer)tmux
allows you to create, manage, and navigate between multiple terminal sessions from a single window. Here are the steps to attach, detach, and exit a tmux
session without naming the sessions.
Start a New tmux
Session
tmux
tmux
session.Detach from the tmux
Session
Ctrl+b
followed by d
.Reattach to the tmux
Session
tmux attach
or
tmux a
tmux
session.Exit the tmux
Session
exit
and press Enter.tmux
will terminate.cat & tail
to display a CSV FileThe tail
command is used to display the end of a file. In the context of CSV files, it can be used to skip the header row.
Create a Sample CSV File
echo -e "xnat_id,date,project,subject,session,\\nfc9d9ac6-e50c-4d,2024-04-11,MW24a,S2WIO304,,\\nfda17c32-2e88-45,2024-06-23,MW24a,S2WIO158,TP2,\\nfe8f99be-d955-4f,2024-06-23,MW24a,S2WIO870,TP2,\\nff7543be-c3a8-46,2024-06-17,MW24A,S2WIO68,TP2," > sample.csv
cat sample.csv
sample.csv
with a header and two rows of data. “cat” will display its content in Terminal window.Display the CSV File Skipping the Header
tail -n +2 sample.csv
gnu parallel
and tail
to Display Specified Columns of a CSV Filegnu parallel
is a shell tool for executing jobs in parallel. You can use it with tail
to process and display specific columns from a CSV file.
Display Specified Columns
xnat_id
and subject
columns.tail -n +2 sample.csv | parallel --colsep ',' echo {1} {4}
tail -n +2 data.csv
skips the header.parallel --colsep ','
specifies that the columns are separated by commas.echo {1} {4}
prints the first and third columns (Name and Occupation).Fake fmriprep analysis
echo 'echo fmriprep /project \\
/project/derivatives \\
participant \\
--fs-license-file /home/user/freesurfer.txt \\
--participant-label $2 \\
--nprocs 6 --mem 10000' \\
> run_fake.sh
chmod a+x ./run_fake.sh
chmod a+x
makes the script executable.Feed the subjects’ list into fake fmriprep script
tail -n +2 sample.csv | parallel --colsep ',' ./run_fake.sh {1} {4}
This is how we run mriqc, fmriprep, hcp and many others pipelines. It takes just a few commands to glue it together and run efficiently in parallel on a HCP.