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
Quick links
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
-
Path of your home directory. Type the command
pwd
, which stands forprint working directory
.
Output: /data/users/{YOUR USERID} -
Listing items. Type the command
ls
, which stands forlist
.
Output: Nothing because we've not yet put anything in the directory. -
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 keyi
. You've now entered insert mode. Go ahead and write something in the file, such asMy first text
.
After, hit theesc
key, type:wq
and hitEnter
. What you've done is written the text to the file, identical to saving, by hitting enteringw
and then quit withq
. -
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
.
-
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. -
Again type the
ls
command to confirm that both the directory and the file exists. -
For additional information, you're able to type
ls -lt
to see the exact time and date that these files were created. thel
in the-lt
parameter represents long format, and thet
in-lt
sorts by modification time. So the output will be the long format of each listed directory sorted by their modified time. -
Copying. Make a copy of the file
test
to the directory we created earlier. Copying can be done by typing the commandcp {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/
- 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 iscd {destination}
, wherecd 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:
- Your username
- The hostname of the machine. In this example the hostname is
bose
- 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
- 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
- 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.
- Copying from local to remote machine. Using the
scp
command, orsecure 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:~/
- Renaming or moving. It is done by using the
mv
command in a similar format to thecp
command earlier. The parameters are as followsmv {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
- 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
- Copying files from a different location. Copy the README file to the current directory by typing
cp ../README ./
where again the command format iscp {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 usingvi NEW_INFO
and change theUNIX
tovim editor
and typecommands
after UNIX and save usingescape+:wq
.
Full command
Renaming command: mv README NEW_INFO
-
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 asNEW_INFO
usingcp NEW_INFO ../../dir_1/
. -
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. -
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 usingcat README
for example. -
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 berm {target_file}
. For example you could dorm file1
. -
Some additional fun commands are some such as
rev
. Try typingrev 123ABC
and hit enter. What do you see? You can quit at any time withctrl+c
.
What about the commandw
? How many people are logged in?
Try typingfactor 30
to factorize a number.
Also try and runYes "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!