# Using a general linear model to perform z-test

I am trying to perform a z-test with a brain-imaging software. I was told that the best way was to use a general linear model with one subject in one group and the rest in the other group. Using this method gives results that look identical to calculating the average and standard deviation of the control group and performing a specific z-test. Is it accurate to use a general linear model in this way? What statistical test might it be using?

Yes, it is accurate. A t-test comparing means of two groups (assuming equal variances) can be represented as a specific linear regression model (with normal distribution of error term). In R formula language: $$y \sim 1+\text{Group}$$ where $y$ contains the measurements in the two groups stacked, and $\text{Group}$ is an indicator variable (factor in R speak) indicating group membership.
The test of significance of the coefficient of $\text{Group}$ is the usual (equal-variance) t-test.