thoth is a computer in the CS building. It’s hooked up to Pitt’s network, but the CS department manages it and puts software on it useful for this and other courses.
By logging into thoth remotely, you don’t have to worry about setting up a C compiler on your own computer.
ssh is a way of running commands on a remote machine. It’s like your command line, but the console is connected across the internet instead of to your own computer.
Later projects will also use features only available on thoth. So please don’t try to compile your projects on your local machine.
1. Getting connected and set up
Nothing will show up when you type your password. That’s normal.
When you log in, don’t worry about the “unauthorized access” message. You are supposed to be logging in. You’re authorized 😉
Windows users
You need to get an ssh client, like PuTTY (use the 64-bit installer). Run it, and use thoth.cs.pitt.edu as the address.
Say “Yes” to the certificate, give your username (lowercase) and password, and you’re in!
Mac users
Open up Terminal (⌘+Space, type “terminal”, hit enter). Then run:
$ ssh [email protected]
Say “Yes” to the certificate, give your username (lowercase) and password, and you’re in!
If you can’t log in, please ask the TA for help. If you are sure you’re putting in your username in lowercase, and the right password, please email me and CC Dr. Khattab ([email protected]). He’s the thoth administrator.
2. Common UNIX commands
Here’s a quick reference guide to refer back to.
- pwd – display the current directory
- cd dirname – change current directory to dirname
- cd .. moves up one directory
- cd ~ goes to your home directory
- cd – toggles back and forth between the last two directories you were in
- ls – list all files/folders in current directory
- ls dirname will list files/folders in the directory dirname
- mv source dest – move or rename a file
- source is the file you want to move/rename
- dest is the new place/name
- cp source dest – copy a file from source to dest
- mkdir name – make a new directory named name
- touch filename – make an empty file named filename
- cat filename – display contents of text file filename
- less filename – view contents of text file filename – good for longer files
- press q to exit!
- rm filename – delete (“remove”) filename
- rmdir dirname – delete an EMPTY directory named dirname
Where are we?
When you log in, you are placed in your home directory.
- Try using pwd; it’ll show you the full path of your home directory.
- Your home directory can be referred to as ~ in many commands as a typing shortcut.
- Try using ls. It will list the files and directories.
- Your private directory is what you want to do your work in. No one else can see it.
- Do cd private and you’ll move into that directory.
- pwd again, and you’ll see that your directory changed.
- You can use cd .. to move up one directory.
- You can use cd ~ to go to your home directory.
3. Setting up your ~/.bash_profile a little bit
bash is what you’re using right now – the thing you type commands into. .bash_profile is the configuration file for bash.
- Do cd ~.
- This goes back to your home directory.
- Do chmod u+rw .bash_profile
- Now let’s edit it: nano .bash_profile
- nano is a very simplistic text editor that runs inside the terminal. The controls are at the bottom of the screen – something like ^X means press Ctrl+X. (Mac users, use the actual control key.)
- Scroll down to the bottom of the file. There, you’ll see:
5. # Define your own private shell functions and other commands here
- Use the arrow keys to put your cursor after that line. Now, copy and paste this exactly:
- In putty, you can right click and paste
- In Terminal on a mac, ⌘V will paste
7. if [ “$HOSTNAME” = “thoth.cs.pitt.edu” ]; then8. source /opt/set_specific_profile.sh;9. fi
- If you want a nice-looking terminal prompt like I have, find the line that starts with export PS1, and replace it with this:
11. export PS1=”[\[\033[1;32m\]\h\[\033[0m\] \[\033[1;34m\]\w\[\033[0m\]]: “;
- Now hit Ctrl+O and hit enter to save. Then hit Ctrl+X to exit.
- Do source .bash_profile
- Try doing man open. If you see this, yay! Hit q to exit.
If you see No manual entry for open then you messed up somewhere. Ask for help!
4. Making a “hello world” program
Organization is good. Don’t just do all your work in private. Make a directory for your 449 work!
- Make sure you are in your private directory. Then do mkdir cs449.
- Do ls, and you should now see cs449 listed. cd into cs449.
- Now make a lab1 directory inside your cs449 directory, and cd into that.
- Let’s make a C file. Do nano lab1.c. This will create a new file and open it in nano.
- Now type the following into the editor.
6. // Your Name (username)7. #include <stdio.h>8. 9. int main() {10. printf(“Hello World!\n”);11. return 0;12. }
- Save the file and exit nano.
- Now, compile it like so:
15. gcc –std=c99 -Wall -Werror -o lab1 lab1.c
If you did it right, it should print nothing. With UNIX, “no news is good news.” Successful commands will usually be quiet. But if you ls, you should now see a new file, lab1. This is your executable!
- Type ./lab1 to run your program. It should say “Hello, World!”

