Skip to content

Using the shell

Tessa Rhinehart edited this page Jan 23, 2024 · 6 revisions

Helpful shell commands

  • ssh kitzeslab@<robin's URL>
  • pwd - print working directory. This is the directory, aka the "folder", that you're issuing commands from.
  • ls - list contents of the current working directory
  • ls /Volumes/seagate1/ - list the contents of the directory /Volumes/seagate1/
  • ls -lh - list the files with more information: l = long list, h = human-readable file sizes
  • cd - change directories into your home directory
  • cd .. - go up one directory, e.g. from /Volumes/seagate1/ to /Volumes/.
  • cd seagate1/ - change directories into seagate1/. This is a relative path, i.e. the shell attempts to change into a directory contained within the current working directory.
  • cd /Volumes/seagate1 - change directories into /Volumes/seagate1/. This is an absolute path, i.e. you can do this from any working directory
  • mkdir hello - make a directory called hello within the current directory
  • mkdir /Users/tessa/Recordings/MSD-0001 - make the directory MSD-0001 within preexisting directory /Users/tessa/Recordings/.
  • scp kitzeslab@<robin's URL>:/Volumes/seagate1/data/field-data/<date folder>/<card folder>/<filename>.WAV . - copy a file into your current working directory (specified by .).
  • scp kitzeslab@<robin's URL>:/Volumes/seagate1/data/field-data/<date folder>/<card folder>/<filename>.WAV /Users/<username>/Recordings - copy a file into the directory /Users/<username>/Recordings.
  • cat myfiles.txt | zip myfiles.zip -@ - Zip a list of files (contained in myfiles.txt as absolute paths to the files with line breaks)

Helpful programs

Watch your processor usage: htop

Run long programs: tmux

This package allows you run programs in the background. Use this for long programs that you'd like to keep running, even if you leave, exit your SSH session, etc.

  • New tmux session: tmux new -s <descriptive-session-name>
  • Detach from session: ^B then D
  • View sessions: tmux ls
  • Reattach to session: tmux attach -t <descriptive-session-name>