Starting from:

$30

CECS326- Homework 0 Solved

Purpose: To test your accounts, logins, remote access, demos, and write simple programs on Linux. This assignment is ungraded but should help familiarize you with the Linux environment.

Please follow instructions carefully.

1)  Login to your machine. Use your mycsulb and beachboard credentials (student id and password)

2)  Open a command line terminal. On linux, there should be an icon on your desktop or you can type ctrl+alt+t. On mac, I recommend using iterm2, but if not, the native terminal can be found in the

Applications/Utilities directory.

The terminal will start you out in your home directory. It is in /home and is named after your student id. If you do an “ls” you should see sub directories like Downloads and Desktop.

3)  Use “cd Desktop” to go to your desktop. Now, make a new directory called testdir using the command “mkdir testdir”. You should see this directory appear on your desktop.

4)  Create an empty file with the touch command. “touch emptyfile”. You’ll see an emtpy file on your desktop. You can open and edit it if you wish.

5)  Delete the empty file with “rm emptyfile”. You should see it dissapear. Delete the directory using “rm -r testdir”. (the -r argument is needed for directories. It stands for recursive.)

6)  Use “cd ..” to go back up one level to the root of your home directory. Make a new directory there called “Homework00” (this should not be on your desktop, although you can open a file explorer and see it in a window).

7)  Create 3 files in this Homework00 directory.

a)              The first should be called “whereami” and should contain a single line with the output of the “pwd”command.

b)              The second is a python “helloworld.py”. You should already know how to do this, but perhaps youhaven’t done this outside of an IDE like pycharm. I’d like you to write this with a basic text editor and run it on the command line using “python helloworld.py”.

c)              Lastly, you’ll write an equivalent C++ “helloworld.cpp” program in a basic text editor. To compile the program: g++ helloworld.cpp -o helloworld

8)  After the first homework, work will be done on a remote server called “linux1.cecs.csulb.edu”. First, run

the “hostname” command on your local machine and note the name. Then use “ssh yourstudentid@linux1.cecs.csulb.edu” and run the hostname command there.

9)  OPTIONAL: If you have a laptop or are at home, you may still access linux1 remotely. If you use Linux or a Mac, open a terminal, use “ssh -p 2022 yourstudentid@134.139.248.2”. If you are using windows, download a tool called “Putty” and use ssh (port 2022) with that. Note: ssh may work with the default port 22, but this is not guarenteed due to campus firewall rules.

Demo: The instructor would like to see demonstrations of the two helloworld programs. This isn’t graded or required but is how most future assignments will be graded.

Nathan Pickrell                        26 August 2019 (Week 1 Lecture 1)                        Due: 28 August 2019 (Week 1 Lab 2)

More products