File Management

From UCB Math Wiki
Revision as of 18:12, 25 September 2006 by Mgsa (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page describes how to manage your files on the math department network, both remotely and locally. File uploading/downloading, directory creation, and setting permissions are among the topics covered belong.

Connecting to the Network

In order to manage your account, you first have to connect to the network. If you are in Evans, you can log onto one of the departmental computers (such as the ones in 708) and instantly be on your math department account. Note that the only computers allowed to be physically connected to the network are the departmental ones. Therefore, if you want to connect from another computer, such as your laptop or home computer, you need to connect remotely. There are two kinds of programs that can connect your computer remotely, SSH and SFTP.

SSH

SSH stands for Secure Shell. For those who have used Telnet before, it is practically the same program except that is has stronger encryption to securely transfer data. The department server no longer accepts connection requests from Telnet clients, so you have to use SSH if you want to connect.

SSH basically is a program that mimics the Terminal windows found on our department's computers. It is useful for editing files, changing file permissions and running basic programs like text editors or Pine email program. With a more elaborate setup, you can actually run programs such as webbrowsers remotely through SSH (but be warned, it can be an extremely slow process!).

  • Windows: you need to download an SSH client. One option is Putty. Then use the SSH client to connect to login.math.berkeley.edu, using your usual departmental username and password.
  • Mac: you already have SSH installed with your operating system. Just go to Utilities and click on Terminal. In the terminal window, type: ssh -l <username> login.math.berkeley.edu The -l <username> part indicates to SSH that you want to log in with that specific username; if you don't include this text, then SSH will automatically use the account name on your computer (which probably won't be your departmental username).
  • Unix: you probably have SSH preinstalled as well. Just open a terminal window and type in the same thing Mac users do.


SFTP

SFTP stands for Secure File Transfer Protocol, which is a secure version of FTP. As with Telnet, the department server no longer accepts connection requests from FTP, in order to increase network security.

As the name suggests, this program is primarily used to transfer files between the computer you are on and your account on the department network. Many SFTP clients have a graphical interface which make downloading and uploading very easy, and most also have an easy way of changing file and directory permissions.

I do not know whether SFTP comes standard on Macs or Unix, but it may be worthwhile to install a program anyway since there are many free, well-written programs out there. A recommendation for Windows is WinSCP.

Navigation

Every file and directory has a path; if you think of the directories as a tree, then the path is just the path in the tree through all the subdirectories you need to get to that directory or file. For example, your account's home directory is /home/u2/grad/<username>

  • cd <pathname> Change directory to the one given in <pathname>. This command has a very fine distinction between absolute paths and relative paths. If the pathname does not begin with / then it signifies that you are talking about subdirectories of the current one. If it does begin with / then you are specifying the path from the root of the directory tree.
  • cd .. Go up one level in the heirarchy.
  • pwd Present working directory. This is really useful if you've forgotten what directory you're in.
  • ls Lists the files and subdirectories of the present directory.
  • ls -a Lists all the files and subdirectories in the present directory. This includes settings files and other weird junk that usually you don't care about.

Create, Move and Destroy

The file server tends to treat directories very differently from files, so if you're going to do some major changes to you account heirarchy it's probably better to use a graphical SFTP program than trying to do this all in a terminal or SSH.

  • mkdir <name> Makes a new directory with the given name.
  • cp <filename> <pathname> Creates a copy of file <filename> in the directory given by <pathname>. The same caveat regarding pathnames applies as with cd. This assumes that the file is in the current directory. If you'd like to move a file in a different directory, you have to put the file's path instead of <filename>.
  • mv <filename> <pathname> Exactly like copy, except it moves the file (so that the file no longer exists in the location it came from.
  • rm <filename> Removes (deletes) the file. Be VERY careful if you try to apply this command to a directory--many times the file server won't let you, but if it does and you type things in wrong, the results could be disastrous.