Skip to content

Chem406 command line Walkthrough

This document will help you understand how to use the UNIX commandline and BOSE supercomputing cluster for Chem406. If you have any questions, feel free to email us at bgsc.admins@uwec.edu


Open OnDemand | Linux Quick Guide PDF | GlobalProtect VPN


Logging into BOSE off campus

To login to the BOSE supercomputer If you're not connected to the UWEC network, you must first turn on the VPN called Global Protect.

Then enter the command ssh -p 50022 {YOUR UWEC USERNAME HERE}@bose.hpc.uwec.edu

Example : ssh -p 55022 doejn1234@bose.hpc.uwec.edu

Part 1: Practicing common commands in the terminal

Some preliminary rules to get well aquainted to is to never use spaces in a file or directory name, this will over complicate directory navigation and file selection.

Lession portion 1: Personal terminal

  1. Path of your home directory. Type the command pwd, which stands for print working directory.
    Output: /data/users/{YOUR USERID}

  2. Listing items. Type the command ls, which stands for list.
    Output: Nothing because we've not yet put anything in the directory.

  3. Creating a text file. Type the command vi test and hit enter. The command we're using is vi which is a text editing command, where the test is the name of the file we're creating.
    To begin editing, hit the key i. You've now entered insert mode. Go ahead and write something in the file, such as My first text.
    After, hit the esc key, type :wq and hit Enter. What you've done is written the text to the file, identical to saving, by hitting entering w and then quit with q.

  4. Now that you've exited vi, try and remember what command we'll use to check if the file was created.

Answer

The command is ls. After using the command, you should see the text file test.

  1. Creating a directory. Now lets create a directory, use the command mkdir {DIRECTORY NAME} to create a directory. We'll name it dir1 for now.

  2. Again type the ls command to confirm that both the directory and the file exists.

  3. For additional information, you're able to type ls -lt to see the exact time and date that these files were created. the l in the -lt parameter represents long format, and the t in -lt sorts by modification time. So the output will be the long format of each listed directory sorted by their modified time.

  4. Copying. Make a copy of the file test to the directory we created earlier. Copying can be done by typing the command cp {source} {destination} Go ahead and give it a shot yourself, otherwise check the command below if you need help.

    Tip: If you hit tab it'll autocomplete for you, and if you either have a confliction of two similar filenames or need to know what's available you can hit tab twice to see what directories or files exists in your working directory.

Full command

The command is cp test dir1/

  1. Changing directories. You can use the cd command to move into the dir1 directory and check if the file was successfully copied over. The command example is cd {destination}, where cd dir1 is what'd you will use to navigate into the directory.

Part 2: BOSE Supercomputer

The Prompt

The Bourne Again Shell (BASH) will be your primary method of interacting with your files on the cluster. When you are in the shell, you will see a Command Prompt that looks something like this

[username1234@bose ~]$

The prompt has several components:

  1. Your username
  2. The hostname of the machine. In this example the hostname is bose
  3. Your current working directory. The tilde (~) represents a user's Home Directory

Open OnDemand has a file browser built-in that can be used for basic operations such a creating, viewing, editing, and deleting files. If you'd like to access it on your own, click Files > Home Directory in the hotbar or click the pinned app on the OnDemand dashboard.

If you're off campus, refer to the 'logging into BOSE off campus' section.

Lesson portion 2: BOSE terminal

  1. To log into the BOSE open the terminal and type ssh -p 50022 {YOUR UWEC USERNAME HERE}@bose.hpc.uwec.edu
    Example : ssh -p 55022 doejn1234@bose.hpc.uwec.edu
  2. You'll then be asked to type in your password, please do so. Note that as you do so, you will not see any indicators that a character is being typed out, however it is still typing out your password. After it'll prompt to read and accept the user agreement, please do so.
  3. Copying from local to remote machine. Using the scp command, or secure copy you'll be copying a file either from your personal directory on your device to the server, or vice versa.
    The command is as follows: scp -P 50022 {FILENAME}.pdb {YOUR USER ID}.bose.hpc.uwec.edu:~/
  4. Renaming or moving. It is done by using the mv command in a similar format to the cp command earlier. The parameters are as follows mv {source} {destination} It can similarly be used to rename a file. Try using the command yourself to rename dir1 to dir_1.
Full command

The command is mv dir1 dir_1

  1. Changing Directory. we already navigated into a directory earlier in our examples. Can you remember what the command was? If so, try to navigate back into the directory again and also check if all the files are there.
Full command

The commands are cd dir_1 and ls dir_1

  1. Copying files from a different location. Copy the README file to the current directory by typing cp ../README ./ where again the command format is cp {source} {destination}. So the full command structure is copying the README file located in the parent directory to your current directory.

    Try and rename the file README to a new filename, called NEW_INFO. Edit the NEW_INFO using vi NEW_INFO and change the UNIX to vim editor and type commands after UNIX and save using escape+:wq.
Full command

Renaming command: mv README NEW_INFO

  1. Creating a subdirectory and copying or moving files into a new another can be done fairly easily. An example of this would be a directory with the path of /data/users/{USERID}/dir_1/dir_2/dir_3 and a file named README. You can copy a file README to dir_1 as NEW_INFO using cp NEW_INFO ../../dir_1/.

  2. Home Directory. When you first logged in you always center to your Home Directory by default. Typing cd will always put you back at your home directory.

  3. Viewing files. Another useful command is cat. Using the command will allow you to view a files contents without having to enter it in a text editor. Try it by using cat README for example.

  4. Removing files. Removing a file can be done by using the rm command. But be careful because there isn't a remove confirmation if the target file exists. The remove format would be rm {target_file}. For example you could do rm file1.

  5. Some additional fun commands are some such as rev. Try typing rev 123ABC and hit enter. What do you see? You can quit at any time with ctrl+c.
    What about the command w? How many people are logged in?
    Try typing factor 30 to factorize a number.
    Also try and run Yes "I love Science".

More info on Tabbing

When you enter commands, you can press tab to auto-complete both commands and file/directory names. For example, if you want to remove the file myfile.txt, you can type rm myf and then press tab. This will autocomplete the command for you so long as the file exists and there are no other files or directories matching that pattern in your working directory. In the case of ambiguity (such as myfile.txt and myfile2.txt existing in the working directory), you can double-press tab to see all matching entries in the directory. Use this as much as possible to save lots of time and your fingers!