1  Local computing

1.1 Mac OS

  • Root = /
  • Other disks (USB, etc.) mounted under /Volumes
  • User directories under /Users; your home directory at /Users/yourusername
  • System wide applications under /Applications; users can also install applications under /Users/username/Applicatons
  • User specific config files under /Users/username/Library (hidden by default)
  • Unix related executables under /bin, /sbin, etc.
  • PATH is an environment variable, settable from command line or ~/.profile

1.2 Windows 10/11

  • Root = C:\
  • Other disks mounted as D:\, E:, etc.
  • User directories under C:\Users; your home directory at C:\Users\yourusername
  • System wide applications under c:\Program Files (64 bit) and C:\Program Files (x86) (32 bit)
  • Path variable settable from “System Properties” dialog

1.3 Both

  • Standard shortcuts like “Desktop”, “Documents”, and “Downloads” are usually subdirectories of your home directory

  • Hidden files and directories can be viewed by setting appropriate options in Finder / Explorer

1.4 Recommendations for file naming schemes

  • Avoid spaces (or other non-printing characters) and punctuation other than dashes, underscores, and periods in file names

  • File names that include dates should preferably follow the ISO-8601 formatting standard, which has the form “YYYY-MM-DD”. For example, an experiment done of Jan 12, 2022 should be named something like “2022-01-12-Expt01.csv”.

    • The advantage of this is it makes it easy to sort and search by date
  • Try and be consistent in your naming schemes. I promise this will make your life (and/or that of your collaborators) easier at some point in your research career!

  • See further recommendations from Iowa Stat University’s Open Research Data Repository

1.5 Terminology

  • A “terminal” is a text input/output environment for interacting with your computer. A terminal used to be a physical device attached to a computer. Strictly speaking, these days we run “terminal emulators” – graphical programs that emulate terminals.
  • A “shell” is a program that runs in a terminal that processes and interprets the command you type. You can run different shells in the same terminal.

1.6 Mac OS

  • Terminal accessed by running “Terminal” program (in the “Applications/Utilities” folder)
  • Default shell is zsh; but bash also included by default (invoke at command line by typing bash)

1.7 Windows

  • Default terminal is “Command Prompt” but new “Windows Terminal” is better choice
  • Several options for shell but I recommend “PowerShell”

1.8 Commands for navigating the file system on Unix based systems

NOTE: The following commands also work in Windows PowerShell

  • pwd – prints name of your “working” directory (i.e. the directory you’re currently in)
  • ls – lists the contents of the working directory
  • cd – change directory
    • cd Downloads
    • cd ~ (move to your home directory)
  • mkdir – make a new directory
    • mkdir foo_dir
    • mkdir bar_dir
  • rmdir – remove a directory (must be empty)
    • rmdir bar_dir
  • rm – remove a file
    • rm bar.txt
  • cp – copy a file
    • cp foo.txt foo_copy.txt
  • mv – move a file or directory
    • mv foo.txt baz.txt
    • mv foo_dir foo.dir
  • cat – write the contents of a file to the terminal:
    • cat foo.txt
  • more – a pager program. View the contents of a file, one page at a time. Type <space> to advance pages, q to quit.

Side note: Why is it common to use names like foo, bar, and baz in examples? See https://en.wikipedia.org/wiki/Foobar

1.9 Shortcuts for working with the file system

  • ~ – refers to the users home directory.
    • cd ~ = change to my home directory
    • ls ~/*.txt = list all files ending with the prefix .txt in your home directory
  • . – the current directory
    • cd ./tmp = move to the directory called tmp that is located in the directory the cd command is executed from.
  • .. – the directory above the current directory (if it exists)
    • cd .. = move up one level in the directory hierarchy. For example if pwd is /home/jsmith then cd .. moves you to /home
  • / – the root directory of the file system
  • cd /data = move to the data directory that is the subdirectory of the root
  • ls / = list all files and directories in the root directory