Click here to load reader

Lab02

  • Upload
    laksha

  • View
    47

  • Download
    0

Embed Size (px)

DESCRIPTION

Lab02. Dayu Zhang 9/8/2014. Example of Commands. pwd --- show your current directory. Account dzhang’s home directory. Tilde: means you are in your home directory. This is home of venus , not your home directory. Example of Commands. - PowerPoint PPT Presentation

Citation preview

Lab02

Dayu Zhang9/8/2014Lab02Example of Commandspwd --- show your current directory

This is home of venus, not your home directoryTilde: means you are in your home directoryAccount dzhangs home directoryExample of CommandsIf you move up beyond your home directory, you may not have permission to view the files.

If you see something like this, one reason might be that you are trying to vi a file beyond your home directory

To fix this, press q (for Quit)

Example of Commandsmkdir dirname --- make a new directory dirname

cd dirname --- change directory to dirname

ls --- list your files in current directory

cd --- go to your home directory

cd .. --- move up one directory in the hierarchy

This is your home directory

Example of CommandsExample of Hello.cppCreate file Hello.cpp using command touch

Then use command vi to edit Hello.cpp

Command Mode

To switch from Command Mode to Insert Mode, press i

Insert Mode

To switch from Insert Mode to Command Mode, press ESC

Write the program in Insert Mode

Go to Command Mode, then save the program using :wq

:wqThis is11vi Editor in Command Mode::wq --- save the file and quit vi:q --- quit vi when the file has not been modified:q! --- disregard any modification and quit vi

Compile Hello.cppCompile Command is g++

If you get an error here, it means there is something wrong with your code. You should go back to check your code using vi Hello.cpp

You should see thisRun ProgramRun Command is ./a.out

Example of SSH Secure File Transfer ClientDesktop Icon

Log in to venus.cs.qc.cuny.edu

Left Pane: LocalRight Pane: VenusUpload and Download FilesLog in to venus.cs.qc.cuny.eduTo upload a file from your Windows pc to Venus, drag the file from the left pane to the right paneTo download a file from Venus to your Windows pc, drag the file from the right pane to the left paneMore Command Examplesrm -r dirname --- removes the directory dirname and all files in it

rmdir dirname --- removes an empty directory dirname

More Command Examplescp --- copy a file e.g. to copy file Hello.cpp to directory folder1

More Command Examplescp -r --- copy all files in a directory e.g. to copy all the files in directory folder1 to directory folder2

exit --- to exit Venus

If You Use MacNo need to download SSH Secure Shell ClientGo to Terminal

Login in to Venus using ssh

Mac File Upload and DownloadUpload a file upload.txt from Mac desktop to Venus account directory CS111

Download a file Hello.cpp from Venus account directory CS111 to Mac desktop