4  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).

4.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.

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

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

4.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.)

To access ResearchDrive space from Linstat or Slurm, run rdmount. It is then mounted as /researchdrive/username, e.g. /researchdrive/bbadger. See Using ResearchDrive at the SSCC for details.

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

4.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.

4.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.

4.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. It is highly convenient to set the working directory to the location of the files you plan to work with before you start working with them. 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 /researchdrive/bbadger

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.

4.1.6 Directories in Slurm Assistant

Slurm Assistant allows you to specify the directory where the job you want to run is located. We suggest you always set the working directory to the location of your job before you run the command Slurm Assistant gives you. If you do that, you can leave the directory box blank. Otherwise, specify the location as described above.

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

4.2 Logging Into Linstat or LinSilo

You have two main options for logging into Linstat:

  1. Use Open OnDemand, a web-based app that gives you a graphical “desktop” similar to a Windows or Mac computer. You can also use it to run a standard terminal.
  2. Use a terminal program running on either Winstat or your computer. On Windows we suggest X-Win32; on a Mac or Linux computer you can use the built-in terminal program.

To log into LinSilo you will need to first log into WinSilo and use it to run X-Win32.

To log into Linstat from your own computer we suggest first connecting to the SSCC VPN. It’s required to use OnDemand or X-Win32, and allows you to map SSCC network drives for easy access from your computer.

If you are not on VPN you’ll need to use Multifactor Authentication (MFA) to log in to Linstat, so take a moment to set it up now if you haven’t already. (MFA is also required for the SSCC VPN.)

4.2.1 Open OnDemand

Details on using OnDemand can be found in Using OnDemand, but the short version is:

  • Be sure you’re on the SSCC network, most likely using the SSCC VPN
  • Go to ondemand.ssc.wisc.edu and log in
  • Click SSCC Linux Desktop and then the big blue Launch button
  • When your desktop is ready, click Launch SSCC Linux Desktop

OnDemand’s graphical interface makes it farily intuitive to use. If you lose your connection to the server, OnDemand will keep your session running. Just log in to the web site again and re-launch it.

4.2.2 X-Win32 on 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.

4.2.3 X-Win32 on Other Windows Computers

To connect sto 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.

4.2.4 Terminal on 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.