# Files and Editing

### How do I connect to a SEAS Machine?

First, please make sure you have an active account with SEASnet (see Boelter 2664 if you do not have a login and/or apply here: ).

Then, you will be able to connect to their servers using a simple SSH command:

ssh yourusername@cs33.seas.ucla.edu


While cs33.seas.ucla.edu is a machine dedicated for us, in case it becomes overloaded and slow due to too many people accessing it at once, you should also be able to connect to more available machines without issue with the command:

ssh yourusername@lnxsrv.seas.ucla.edu


Important note: if not connected to a UCLA network, you must use the Campus VPN service if trying to login into these machines. Read more here.

If you are on Windows, you can use putty to connect instead of using the command line.

### How do I update to the latest versions of the linux tools (gcc,gdb,etc.)

First run this command on your cs33 machine:

echo 'export PATH=/usr/local/cs/bin:$PATH' >> .profile  Then log out of the machine and then log back in again. Now check if you are using the right version. Run this command: which gdb  If it shows “/usr/local/cs/bin/gdb” then it is correct. ### How do I edit files on a SEAS Linux machine There are different methods depending on what you’re most comfortable with, but here are three strategies: • Linux Master: • Approach: Download the files onto the machine that you will run the code on (using any mechanism, wget if its a link on the internet), then edit locally using a command-line editor. • Editors: Vim and Emacs are two classic options. • Why: Allows you to easily switch from coding to running the program. Vim and emacs (but especially vim) is on almost every Linux machine, so there’s no set up to get it going. • How to learn vim: Get and interactive tutorial, or take an adventure, and eventually you will become a vim genius. • Remote Access + Local Editor: • Approach: Use a tool that can automatically update a remote file any time you edit it with some local editor, then only use the command line for making and running the program. • Remote Access Tools: The two that I know of are cyberduck and winscp. These are both pretty easy to use, but make sure you switch the default editor from notepad (if on windows) to something actually usable. • Editors: Any graphical editor will do: notepad++, sublime, Atom, etc… • Remote IDE: • Approach: Use a local IDE like Visual Studio or Eclipse, but download a plug-in that enables you to log in remotely. • Plug-ins: One example is RemoteVSCode. ### How do I use Cyberduck Specifically? 1. Download Cyberduck (LINK: https://cyberduck.io/download/). 2. When you open the app, go to ‘Open Connection’ in the top left corner of the window. 3. Once this opens, click the pulldown menu and select SFTP. 4. Fill the server and your username with, for example, cs33.seas.ucla.edu and “bob” 5. For the password, enter your password that you use to get on the linux server. 6. Click Connect in the bottom right corner. Once you connect, you will see what you typically see when you type ls on linux server, which shows all of your folder and files. 7. Double click a file to download to your Downloads folder. ### I can’t execute/read/write one of my files on linux, what should I do? chmod, a linux command, is your friend. You can enable read (r) write (w) and/or execute (x) permissions on a file (filename) by executing the following command: chmod +rwx filename  You can learn lots more about this command here. # Terminal ### I’m not familar with terminals, is there any resources that I can use to learn about it? There are many resources online that teaches about Linux terminal command, a few recommended listede below: • Terminal Tutorial : A comprehensive tutorial about terminal command. Some sections of the tutorial is not needed for this course, but still good to learn. Recommended section 1-5 and 8-12. • Cheat Sheet : Cheat Sheet of terminal commands & examples relevant to this course. A good alternative if you don’t want to spend too much time on the tutorial (Made by TA of this course) Dont’ worry if there is seems to be too many Linux terminal commands, nobody knows them all or even come close to that. Plus you’ll learn a lot more about terminal in CS35L. # GDB ### I’ve never used GDB, and it seems terrible. How can I learn how to use it? Don’t worry, GDB is not so bad. It is just a normal debugger with a text-based interface. There are many good tutorials online that you could use. Google is your friend here, but here are a few that are pretty good. ### GDB’s TUI mode shows garbled output. What should I do? Basically, GDB gets confused when you run within TUI mode. To get around this, just switch out of TUI mode before you run the program. I normally follow this pattern when debugging assembly. 1. switch to tui mode (c-x ,c-a) 2. if debugging assembly, switch to asm layout 3. single step (ni or si commands, etc.), and look at registers (p$rdx), set break points (b label)

4. switch back to normal mode (c-x ,c-a)

5. run until next breakpoint (run)

6. switch back to tui mode (back to step 1)

# x86 Encoding

### x86 Encoding is very strange – how do I get use to it?

• Here’s a pretty good link

# Other

### Any Tutoring available?

During many weekday hours from 10:00 to 5:00 through week 9, free CS 33 tutoring is available by
UPE TBP, and HKN.