When you do the reading for this class, don’t just read! Do the commands discussed. Play with them, break them, try different options, explore, etc. Reading about using the command line or programming without practicing it will not teach you much!
Introduction
- p. xvii: This is one of my favorite quotes:
It’s been said that “graphical user interfaces make easy tasks easy, while command line interfaces make difficult tasks possible” and this is still very true today.
- I hope you will feel the same by the end of this course!
- p. xix: Prerequisites Don’t worry about this section, we will be using HiPerGator in this course. You do not need to install Linux on your own computer.
Ch. 1: What is the Shell?
Most of this text is written assuming you are running Linux on your computer. While that is certainly possible, for the most part, we will be connecting to a Linux server rather than using your own computer. I do this for a number of reasons:
- Using HiPerGator makes it so that everyone’s environment is the same. I don’t have to troubleshoot why something isn’t working on your computer.
- You don’t need to install much on your computer. Sometimes, getting software setup is the hardest part of an introductory course and presents such a high barrier to entry that people give up before they start.
- I find that new users are often afraid that they will type something wrong and break their computer. While there are some things covered in the text that you cannot do on the cluster, you also can’t really break the cluster.
GitHub Classroom
As you did with the GitHub Account exercise, we will use GitHub Classroom for this “assignment. There won’t be anything to turn in for this, but the GitHub Classroom assignments make it easy to get everyone a copy of the same repository where they can do their work.
Log into GitHub and Accept the Assignment
- Make sure you are logged into your GitHub account.
- Click this link to accept the GitHub Codespaces assignment.
Open a Codespace within your repository
-
Click the green ”<> Code” button, select the “Codespaces” tab, then click the “Create codespace on main” button.
The Shell and Terminal Emulators
As the TLCL text notes, the shell is the program that takes commands we type on the command line and passes them to the operating system to run. A terminal emulator is a program the provides the screen to type in. We will use several emulators in class, Codespaces and VSCode have one, the SSH client we use to connect to HiPerGator has one, Open on Demand has one, Jupyter Lab has yet another one. The good thing is that these all work about 99% the same. There are some differences that can be annoying…or that make you favor one over the other.
We will look at Ch 1 in class and I will demonstrate getting launching a Codespace and using the terminal within that.
We will start using GitHub Codespaces and later transition to using HiPerGator. Once we do that, the terminal emulators that we will use depend on the operating system of your computer. On MacOS, you will use Terminal. On Windows, you will use Bitvise, Git Bash or similar applications. Or, with any OS, you can use Open on Demand in your web browser.
Making Your first Keystrokes
The Codespaces shell looks very similar to the one shown on p. 2 of TLCL, but with some differences outlined below.
Connecting to HiPerGator
These videos demonstrate the process of using different emulators to connect to HiPerGator:
When using an ssh client, like the Terminal or Bitvise, the hostname is hpg.rc.ufl.edu
. Your username is your GatorLink and the password is your GatorLink password.
Making Your first Keystrokes
Our shell prompt looks very similar to the one shown here on p. 2:
@mgitz ➜ /workspaces/codespaces-assignment-mgitz (main) $
A note on the shell prompt on HiPerGator
When we get to HiPerGator, your shell prompt will look like:
[magitz@login7 ~]$
In this case, the shell prompt has my GatorLink username, magitz
, the @ symbol followed by the hostname, login7
, and the current working directory, ~
.
- Why
login7
? When you connect tohpg.rc.ufl.edu
, we run what is called a load balancer that places users on one of several login nodes to balance the load of all the users–one server would not be enough for all of our users. It doesn’t matter which you get put on, they are all the same. - What is the current working directory? When you first log in, you are put in your home directory. Kind of like your Home on MacOS or Windows. On most Linux systems, including HiPerGator, this directory has the path of
/home/<gatorlink>
. Because you frequently want to reference your home directory, there is a shorthand way of doing that with the tilde character:~
. So,~
is Linux shorthand for your home directory.
Mice and Focus
- Again, this box is mostly for people running Linux on their computer. Though the Ctrl-c. Ctrl-v caution does apply for Windows users. On MacOS, Command-c, Command-v typically still work.
- Ctrl-c is the Linux key command to cancel execution of an application. This will be a handy command to know, but doesn’t copy text as you may be used to.
- In general, I suggest avoiding using the mouse in the shell.
The Console Behind the Curtain
- This is specific to those running Linux on their computer and can be ignored.
Ch 2. Navigation
-
p. 8: Listing the contents of a Directory: On HiPerGator, your account starts with no files or directories. When you type the
ls
command at the bottom of p. 8, it will not show any files:[magitz@login2 ~]$ ls [magitz@login2 ~]$
This is expected.
-
p. 12: Important Facts About Filenames
- point 3 is worth emphasizing: File extensions generally do not matter in Linux. You don’t need to end a file with .txt, .jpg, .pdf, etc. But, these endings can be helpful for you. Using extensions consistently can make it easier to remember the contents of a file–is this file an image or text?
- point 4 is also critical: Do not use spaces in naming files or folders on Linux. In fact, it is a good habit to avoid using spaces on your Windows or MacOS computer if you think the files will end up transferred to Linux or analyzed with a command line tool on your computer.
- Common conventions are to use underscores (
this_is_a_text_file.txt
) or camel case (ThisIsATextFile.txt
). It doesn’t really matter which you chose, though does help to be consistent.
- Common conventions are to use underscores (
Ch. 3: Exploring the System
-
p. 20: Table 3-4: Certainly feel free to explore, but you don’t need to worry about all of the directories in this table. Most will be there, but can generally be ignored for what we will be doing.
-
p. 23: Symbolic Links: Take a look here, we may use some symbolic links, but don’t worry too much about the details. Also, a symbolic link is essentially the same as an Alias in MacOS or Shortcut in Windows. It’s a small file that points to the real file.
- I think this is the first time “foo” comes up…“foo” and “bar” are programmers’ favorite names to use as examples. They are commonly used as file names, variable names, program names, etc. where the author just needs a name. See Wikipedia for more on Metasyntactic variables.
Ch 4: Manipulating Files and Directories
- p. 27: Wildcards Work in the GUI Too: You can ignore this box.
rm
! As noted, there is no undelete command, trash can, or recycle bin on Linux. So be careful!Also, nothing is backed up on HiPerGator. We will cover this in class, but keep that in mind. In your home directory (
/home/<gatorlink>
) we do have one week of snapshots. We may cover this, but here is more information on snapshots on HiPerGator.- p. 33-34: ln – Create Links: Don’t worry too much about the symbolic and hard link section. We won’t be using them a lot.
- p. 37-39: Creating Hard Links: Again, you can skip the sections on hard and symbolic links.
- p. 39: Removing Files and Directories: Do try removing some of your playground files and directories, but again, don’t worry about the link stuff.