<<

Basic Commands

Login/Logout

Use XWin32 to connect to a UNIX server from a Windows machine. To connect from a machine or an Apple (X11 console only):

ssh -X -l account_name machine_name OR ssh -X -Y -l account_name machine_name

Example:

ssh -X -l masc1234 rohan.sdsu.edu

The X and Y are capital, everything else is lowercase. The -l is the lowercase letter L.

To close the connection,

Transfer files between your computer and the server

Use a transfer utility on a computer. On a linux machine or an Apple (X11 console only):

To send a file from your computer to the server:

scp filename username@machine_name:~/

Example: To transfer a file named prog1.java to account masc1234 on rohan:

scp prog1.java [email protected]:~/

This will place the file prog1.java in the level directory of the account masc1234 on rohan.

To transfer a file from the server to your computer:

scp username@machine_name:~/filename .

The file to be transferred must be in the top level directory on the server. Note the space and period the end. The period means the current directory on your machine. Example: scp [email protected]:~/prog1.java .

This copies the file prog1.java from the top level directory on rohan to your local machine.

[ To a file created on a UNIX machine with Windows, use Wordpad. ]

Account Control

Change your password:

Please do not use weak passwords on SDSU servers!

Get the full of the current directory:

Check the amount of disk space you are using and the amount you are allowed to use:

quota -v

Managing Directories

Make a new directory (folder):

directory_name

This creates a new directory in the current directory.

Delete a directory (it must be empty):

directory_name

Change directories (up or down): directory_name

There are three special shortcut symbols used with directories: • ~/ This is the top level of your account. • .. This is the directory above the current one. • . This is the current directory.

Examples: cd ~/ the top level directory in your account the working directory. cd .. up one level. cd project_1 Make project_1 the current working directory.

By default, you can only move up or down one level at a (unless you provide the full path). However, you can chain directory specifications.

Examples: cd ../.. Move up two levels. cd project_1/data_structures Move down two levels.

Working with files

The * character is a wildcard that matches anything.

Make a of a file:

source destination

Examples: cp prog1.java prog1_back.java Make a copy of the file with a different name. cp *.java backup/ Copy all files with a .java extension to the directory named backup

The cp command never changes or moves the source file. It merely makes an identical copy of the source with the same name in a different directory, or in the same directory with a different name.

Move a file:

source destination

This command works just like the cp command with one big difference. The source file is deleted. Only a single copy of the file exists, and mv just changes its location.

Delete a file:

filename

Deletes the file specified. Unlike the Apple or Windows operating systems, there is no trash bin, and the deletion cannot normally be undone.

Example: rm prog1_back.java Deletes the file. It cannot be recovered.

Get a listing of all the files in the current directory:

Short version, just writes a listing of the files to screen OR ls -l Long version, shows file properties

Echo the contents of a file to screen:

filename the contents of a text file to screen OR cat filename | As above, but one screenful at a time. Hit the space bar to advance to the next screen.

This command can only be used with text data. Using cat with binary data can corrupt the settings on your console window, rendering it useless.

For programming, the best text editor to use on UNIX machines is nedit

You can read the documentation for this editor at www.nedit.org

When you it, put the & character at the end, before you hit enter:

nedit & Start the editor with a blank page nedit filename & Start the editor and load the specified file

The & character allows you to continue to type commands in the console window. Without it, the console window will not accept any new commands until you terminate the editor.