Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Welcome! If you're reading this, you're interested in learning about using Linux, perhaps the most famous open-source operating system. While we won't be delving into how Linux operates, we will be looking at how we can interact with it using the command line.

Info

Many of these commands may additionally work on your local system, especially if you are using a Mac product. However, we will assume that you are working on the server, a Linux environment where these commands are known to work

Setup Script

The first thing you'll want to do when logging into the server is to source the C2S2 setup script. This can be done with the command below (this formatting will always indicate a command to run):

...

We'll delve a lot into these details later, but right off the bat, you can see the date when each item was created. Additionally, if you look at the long string of characters to the left, notice that some of them start with "d" - this indicates the directories within your current working directory! (Just a dash "-" means that it's a regular file)

The other main flag that we'll pass is the a flag. Normally, items with names that begin with a dot (".") are hidden from us, as they usually contain some configurations and stuff that isn't used to often. However, we may wish to see these on occasion, which the a flag (for "all") allows us to do:

...

You should be able to see your new directory named c2s2. To move into a directory, we use the cd command (for change directory), with an argument of the directory that we want to move into:

...

Great - you know have many tools at your disposal to navigate all around your Linux filesystem! Take some time playing with these to get comfortable navigating around and visualizing the directory hierarchy just from your terminal.

Info

You can visualize the folder hierarchy from where you are by using the tree command to print a tree representation of the folder structure - be careful using this in large directories however, as it will display all of the subdirectories, the subsubdirectories, and so on!


Absolute vs. Relative Paths

...

Both of these options get us to the same folder, just in different ways. The "long" path (/home/<netid>/c2s2) is known as an absolute path; since it starts from our / directory, it will always point to the same folder, no matter what. In contrast, just typing cd c2s2 will take us to whatever c2s2 directory is under wherever our terminal happens to be at the time, meaning that the folder it takes us to could change! Since this is relative to the terminal's location, we call it a relative path; you'll often find these written as ./c2s2 (where . is our current directory), just to stress that the folder we go to depends on where we currently are. We commonly use relative paths when cd'ing about (as cd c2s2 is synonymous to cd ./c2s2), as they're more convenient and easier to type. However, when specifying file locations to other people of programs, we may want to use absolute paths. Many of the commands that we use will take either.