UNIX Commands
Departments and student organizations that publish from Web Central,
which runs on a UNIX machine, will have to learn basic UNIX commands for
performing common tasks. Personal publishers on UTS or CCWF must learn
these commands, too. You type these commands once you are logged on, with
Telnet for example, to the machine.
Macintosh users should note that many commands listed below can be
performed more easily in Fetch. When a command has a Fetch equivalent, it
is noted below.
IDENTIFYING
THE CURRENT DIRECTORY Directories on a UNIX machine are similar
to folders on a Macintosh. Just as you can have a folder in a folder in
a folder, you can have a directory in a directory, etc. Use the command
below to display the current directory.
- pwd
- Shows you what directory you are in currently, your working directory.
CHANGING
DIRECTORIES Use the commands below to move between directories.
- cd dirname
- Connects to the directory named dirname. Use this command,
for example, to connect to your publishing directory after you log
on. Here are some examples:
cd ~www/student/admissions
cd ~www/its/
cd ~www/research/
cd public_html
Fetch users can select Change Directory from the Directories
menu, or they can use the pop-down directory box.
- cd ..
- Connects to the directory one level up from the current directory.
(That's a cd, space, and two periods.) Use this command, for example,
when you are in one of your publishing subdirectories and you want
to move up one level.
- cd
- Connects to your login directory. When you log on, you are automatically
placed in your login directory, or home directory. This command takes
you back to that directory.
LISTING
THE CONTENTS OF THE CURRENT DIRECTORY Use the commands below to
see a list of the files in the current directory. Fetch automatically
displays the contents of the current directory.
- ls
- Lists all files and subdirectories, except for those that begin
with a period, such as .links files.
- ls -al
- Lists all files and subdirectories (including those that begin with
a period), with owners and sizes.
CREATING,
REMOVING, AND MOVING DIRECTORIES Use the commands below to create,
move, or remove directories.
- mkdir dirname
- Creates a subdirectory named dirname in the current directory.
Fetch users can select Create New Directory from the Directories
menu.
- rmdir dirname
- Removes the subdirectory named dirname from the current directory.
Fetch users can select Delete Directory or File from the Remote
menu.
- mv dir1 dir2
- Moves (renames) the subdirectory (and its contents) named dir1
to dir2. Fetch users can select Rename File from the
Remote menu.
MANIPULATING
FILES Use the commands below to copy, move, remove, or display files.
- cp file1 file2
- Makes a copy of the file named file1 and names the copy file2.
- mv file1 file2
- Moves (renames) the file named file1 to file2. Fetch
users can select Rename File from the Remote menu.
- rm filename
- Removes the file named filename. Fetch users can select Delete
Directory or File from the Remote menu.
- more filename
- Displays the file named filename one screen at a time. Fetch
users can select View File from the Remote menu.
EDITING
FILES
- pico filename
- Edits the file named filename with the Pico, an editor that
is easy for new users to learn.
CHANGE
GROUP AFFILIATION OF DIRECTORIES OR FILES Note: You must own the
file or directory you want to change and you must belong to group you
are changing it to.
- chgrp group-name filename
- Changes group affiliation of filename to group-name.
- chgrp -R group-name dirname
- Changes group affiliation of dirname and all files within
dirname to group-name.
GIVE
GROUP MEMBERS WRITE PRIVILEGES Note: You must own the file or directory
you want to change.
- chmod g+w filename
- Gives the group write privileges to filename. Any member
of the group affiliated with filename can change or delete
the file. Use g-w to remove group write privileges.
- chmod -R g+w dirname
- Gives the group write privileges to all files within dirname.
Any member of the group affiliated with dirname can change
or delete any file within dirname. Use g-w to remove
group write privileges.
|