Introduction to the Unix Shell

https://ubc-library-rc.github.io/intro-shell/

Land Acknowledgement

UBC Vancouver is located on the traditional, ancestral, and unceded territory of the xʷməθkʷəy̓əm (Musqueam) peoples.

I have never used the shell/terminal

I have used the shell/terminal for various tasks


Learning Objectives

  • Explain the role of the shell in the operating system and users’ programs and compare it with the graphical user interface
  • Construct absolute and relative paths to access specific files and folders
  • Use options and arguments to change the behaviour of shell commands
  • Create, copy, edit, and delete files and directories
  • Write to files and construct command pipelines

What is the Shell?

A program that allows you to interact with your computer using typed text commands.

Why is it useful?

  • It lets you skip the visual intermediary
  • You can do something to many files or folders at once in many locations
  • You can automate many steps in a task or a series of tasks

For example:

  • Create backups of all files in a certain location or of a certain type
  • Move all of the files of a certain type in all of the folders on your computer into one folder
  • Get a dataset from a website that has an API endpoint
  • Browse the web and scrape information from it
  • Clean and sort data in and across text files
  • Search through all of your files for key words or trends

Why the Unix Shell? What about Windows CMD?

Unix shell is more universally applicable and is well documented.

Default on Mac and Linux.

Present on PCs as of Win 10.

Getting to the Unix shell

  • On Linux - Terminal/Konsole
  • On a Mac - the Terminal
  • On a PC - Linux Sub-system for Win10. Separate program to download for older versions of Windows.

Let's open a terminal and try it out!