INLS161-001 Fall 2024

Tools for Information Literacy

Practice interacting at the command line

First things first

  1. Open an SSH connection to Opal. On Windows, you'll need to use PowerShell for this; on MacOS and Linux, you can open a Terminal window
  2. Enter ssh your_onyen@opal.ils.unc.edu and then enter your password when prompted.

    Once you've connected, you should see a command prompt like this: your_onyen@opal:~$

Now, we are ready to work at the command line

What does this mean? Where exactly are we? Are there any clues?

We are in our root directory, which is subordinate to Opal's home directory.

  1. In UNIX file system parlance there are directories similar to the folders that you may be used to using on Mac or Windows systems.
  2. These directories exist in a hierarchical structure where your root directory (which will be named with your_onyen) is the "root" or top level of your files and directories.

Some general tips on logging into and working on remote computers

  1. Your mouse won't do much. You can't click things to make them happen.
  2. You can, however, copy and paste between applications.
  3. You can scroll up and down in your SSH window to see what you did previously.
  4. You can switch between your login window and other windows, or set them up so you can see multiple windows. This is very useful when editing a Web page while logged in, and viewing it in a Web browser in another window.

But first ...

be certain about where you are in your file structure. You are at the top, or root, level, denoted by your_onyen
you need to move down one level into your public_html directory.

To do so, you need to execute the change directory commandcd
with the argument being the name of the directory you wish to step down to → cd public_html

And you are now here

The next step is to create some directories and files in your home directory.

There are several commands that you will use to create directories and files.

These are (again) command line commands. They all have options, and they all take one or more arguments. In UNIX parlance, an argument is a file or directory name, or some other piece of information needed to complete the command.

To step up one level from a directory, you want to use the command ../
This tells the server to step up to the parent directory.

We will look at the arguments.

To create a directory,

type the make directory commandmkdir followed by the name you want the directory to have.
This looks like → mkdir mynewdir
In this case, mynewdir is the argument for the mkdir command.

The Linux (and UNIX) rm Command: Everything You Need to Know
Removing a directory is similar

the argument is the name of the directory you want to remove. Try it.
rm for removing a file takes one argument, the name of the file.

The Copy cp and Move mv commands each take two arguments.

In the copy command, the first argument is the name of the file you wish to move or copy, the second argument is the name of the file you want to copy into or move the file to.

cp mynewfile mynewfile1
makes a copy of the file named mynewfile and names it mynewfile1

The arguments are not limited to file and directory names in the local directory. An argument can specify another directory and a file in that directory. For instance, if you have a directory called public_html (which you should), then you can move a file from your home directory into this directory as follows.

mv thisfile public_html

If in addition to moving the file, you want to rename it, then the new file name can be typed following the slash, as follows:
mv thisfile public_html/thatfile

UNIX file literacy

These are commands commonly used. You will find them valuable when you work within a UNIX system, and for other UNIX tasks as well. Remember: UNIX is case-sensitive

Commands can have arguments and options. Options usually have a hyphen.

Most common errors in UNIX come from not knowing what directory you are in. Use the pwd and ls commands to keep track.

Use the man command to get help and usage information

Copyright © R.E. Bergquist 2014- | Last Updated on | Powered by w3.css