3  Linux Essentials

This chapter is designed for researchers who would prefer to do as much of their computing as possible in a familiar Windows or MacOS environment while taking full advantage of the computing power of the SSCC’s Linux servers. The SSCC’s computing environment is designed for this: for example if you log into Winstat your Linux project and home directories are available as V: and Z: respectively (you can also map them on your own computer) so you can manage your files, write your code, review your results, etc. using tools you’re familiar with.

This chapter will teach you how to specify file locations in Linux (essential for anyone running jobs in Linux, but skip it if you’re already familiar with Linux paths), and how to log into the SSCC’s Linux servers (essential unless you’ll only use RStudio Server or SAS Studio).

3.1 Specifying File Locations

The Linux file system is functionally the same as Windows or MacOS: a hierarchical structure of directories, subdirectories, and files. (Linux calls them directories and subdirectories rather than folders and subfolders, but they are the same thing.) However, there are some minor but essential changes in how you specify a location in the file system compared to Windows.

3.1.1 Use Forward Slashes (/) as Separators Instead of Backslashes (\)

In Linux (like MacOS) you say directory/subdirectory/file rather than directory\subdirectory\file.

3.1.2 Do Not Use Drive Letters

Linux does not use drive letters like Windows: everything is part of a single “tree” underneath the “root” directory (just /).

The Windows V: drive is /project in Linux. Thus V:\my_project becomes /project/my_project.

The Windows Z: drive is your Linux home directory, which can be referred to as just ~. Thus Z:\my_dissertation becomes ~/my_dissertation. (If you ever need the full path for your home directory it’s under /home and a subdirectory for the first letter of your username, so /home/b/bbadger.)

The WinSilo S: drive is /smph in Linux (only available in Silo).

3.1.3 Case Matters

Linux is case-sensitive, so file, File, and FILE refer to three different files. To avoid confusion we suggest using all lower case letters.

3.1.4 Avoid Spaces

Linux commands use spaces to separate entities, as does most statistical software. While there are ways to tell Linux my dissertation is the name of one directory and not two different entities, it’s easier to just call it my_dissertation instead.

3.1.5 Set Your Working Directory with cd

The cd (change directory) command lets you set the working directory: the place where programs will look for files by default. The commands for running various programs in the previous chapter assume your script/do file/program are in the working directory.

This is where you’ll put what you just learned to work:

cd /project/my_project

cd ~/my_dissertation

You can also set the working directory after you start an interactive program. For example, in R you use the setwd() function; in Stata the command is just called cd. However, JupyterLab cannot set a working directory that is above the directory it started in.

If you only plan to use RStudio Server or SAS Studio, you can stop reading here.

3.2 Logging Into Linstat or LinSilo

How you’ll log in to Linstat depends on what kind of computer you are connecting from. To log into LinSilo you must first log into WinSilo.

3.2.1 Winstat/WinSilo

Logging into Winstat or WinSilo makes it easy to use Linstat or LinSilo because the terminal you need is already configured and you also have access to both your Linux drives (V: and Z:) and a variety of software through Windows.

Once you’re on Winstat or WinSilo, log into Linstat or LinSilo by going to the programs menu, finding Linstat or LinSilo, and clicking on the terminal icon you’ll inside it (on WinSilo you can choose between LinSilo and LinSiloBig). You’ll also find shortcuts there for starting RStudio Server and SAS Studio on Linstat or LinSilo.

When you click on the terminal icon you’ll immediately log in to the appropriate server. If you’re asked to allow the connection click Always.

3.2.2 Other Windows Computers

To connect to Linstat from your own computer you’ll need to install X-Win32. If you have have an SSCC-managed Windows computer you can install it using Software Center. On other Windows computers you can download and install it yourself:

Download X-Win32 from the SSCC

To use X-Win32 from your own computer you’ll need to first connect to the SSCC network using VPN.

When you first start X-Win32 you’ll get a launcher. Click on Linstat and then the Launch button. If you’re asked to allow the connection click Always.

For more details, including how to set up your own connections, see Connecting to SSCC Linux Computers using X-Win32.

3.2.3 MacOS or Linux

Macs and Linux computers have client programs for connecting to Linux servers installed by default. To log into Linstat, simply start a Terminal program (on a Mac it will be found under Applications, Utilities) and then type:

ssh -Y username@linstat.ssc.wisc.edu

where username should be replaced by your SSCC username.

In order to display Linux graphics, like the graphical user interfaces for Stata and Matlab, Macs need to have an X windows program like XQuartz installed.