The Linux command line is our gateway to immense computational power. These chapters introduce the shell, navigate the filesystem and mange files.
Edit me

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.

Terminal Emulators

We will look at Ch 1 in class and I will demonstrate getting logged into the cluster. In our case, 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.
These videos also demonstrate the process:

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:

[magitz@login3 ~]$

In this case, the shell prompt has my GatorLink username, magitz, the @ symbol followed by the hostname, login3, and the current working directory, ~.

  • Why login3? When you connect to hpg.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.

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.
  • 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.
Tags: linux