Lab02_Sep8 -

Dayu Zhang
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
 If 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 Commands
 mkdir dirname --- make a new directory dirname
 cd dirname --- change directory to dirname
 ls --- list your files in current directory
Example of Commands
 cd --- go to your home directory
This is your home directory
 cd .. --- move up one directory in the hierarchy
Example of Hello.cpp
 Create 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”
This is
vi 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.cpp
 Compile Command is “g++”
You should see this
 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”
Run Program
 Run Command is “./a.out”
Example of SSH Secure File Transfer
 Desktop Icon
Log in to
Left Pane: Local
Right Pane: Venus
Upload and Download Files
 Log in to
 To upload a file from your Windows pc to Venus, drag the file
from the left pane to the right pane
 To download a file from Venus to your Windows pc, drag the
file from the right pane to the left pane
More Command Examples
 rm -r dirname --- removes the directory dirname and all files in it
 rmdir dirname --- removes an empty directory dirname
More Command Examples
 cp --- copy a file
e.g. to copy file Hello.cpp to directory folder1
More Command Examples
 cp -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 Mac
 No need to download SSH Secure Shell Client
 Go to Terminal
 Login in to Venus using “ssh”
Mac – File Upload and Download
 Upload 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

similar documents