1 / 20

CS 202 Computer Science II Lab

CS 202 Computer Science II Lab. Fall 2009 September 3. Today Topics. File Access Permissions Text Editors VI Emacs Compiling C++ Programs Accessing Linux Remotely Putty SSH. File Access Permissions. user u/group g/other o r or 4 read permission w or 2 write permission

sancho
Download Presentation

CS 202 Computer Science II Lab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 202Computer Science II Lab Fall 2009 September 3

  2. Today Topics • File Access Permissions • Text Editors • VI • Emacs • Compiling C++ Programs • Accessing Linux Remotely • Putty • SSH

  3. File Access Permissions • user u/group g/other o • r or 4 read permission • wor 2 write permission • x or 1 execute permission • - no permission • chmod [options] file –change file or directory access permissions; (+/-/=) • chmod 755 file1 or chmod u=rwx,go=rx file1

  4. Text editors - emacs • emacs/xemacs – are text editors used to create/modify files • emacs [filename] • $ emacs cs202file.cpp • Note: • C- = Control (Ctrl) key • M- = Meta key, generally the Alt key but can also be the Esc key • Essential Commands • C-x,C-s Save the file • C-x,C-w Save to a new file • C-x,C-c Exit emacs • C-x,u Undo last edit

  5. Text editors – VI.. • There are two mode on this editor: • Command mode • Text-entry mode • vi [filename] • Back to command mode by using “Esc” key

  6. .Text editors – VI. • Inserting text: • ‘i’ : insert before cursor • ‘a’ : append after cursor • ‘R’ : replace the text • ‘I’, ‘A’, ‘o’, ‘O’ • Deleting text: • ‘x’ : delete character under cursor • ‘dw’ : delete word under cursor • ‘dd’ : delete line under cursor

  7. ..Text editors – VI • Saving Files • ‘:w <filename>’ : save file as <filename> • ‘:w’ : save file with current name • Exit program: • ‘:wq’ : Save and Exit • ‘:q!’ : Exit without Save

  8. showInfo • The content of “showInfo.cpp” #include <iostream> using namespace std; int main() { cout << "My name is : Ray" << endl; cout << "My email is : amayeh@cse.unr.edu" << endl; return 0; }

  9. Compiling and Running C++ programs on Linux • The g++ compiler: On Linux and many Unix systems the standard C++ compiler is called g++.

  10. Compiling Program • Primitive Compilation • $ g++ <programname.cpp> • Compile with specified output name • $ g++ -o <ouput filename> <programname.cpp> • Compile as object • $ g++ -c -o <object filename> <programname.cpp> • Linking Program • $ g++ -o <object filename> <pg1.cpp> <pg2.cpp>

  11. Hello World • Using any text editor to create file called “hello.cpp” #include <iostream> using namespace std; //use standard namespace int main() { cout << "Hello World" << endl; return 0; } g++ -o hello hello.cpp ./hello

  12. Remote Login • Software: • SSH Secure Shell Client • Putty • WinSCP • Host: • remote.ecc.unr.edu

  13. Remote Login -Putty

  14. Remote Login -Putty

  15. Remote Login -SSH

  16. Remote Login -SSH

  17. Remote Login -SSH

  18. Remote Login -SSH

  19. Remote Login -SSH

  20. Questions?

More Related