The Ten-Minute Test Drive for Unix

This version is for Linux or Unix using the Perforce Command-Line Client (P4).
There are also Perforce Visual Client (P4V) versions for Windows, Unix/Linux, and Mac.

This demo supports only two users and five client workspaces. We can issue you a free Evaluation License to remove the user/workspace restrictions for a limited time.

Introduction

This page tells you how to get a Perforce demo up and running in a matter of minutes. You'll set up both server and client on a single Unix machine. Examples are shown in csh and bash—if you're in a different shell, use its syntax. No special privileges are required, and these instructions are geared toward an experienced Unix user.

If you need more guidance setting up a demo, please visit the Technical Support page for contact options.

Installing Perforce

Make a directory to use for your demo installation, and set up your environment:

mkdir ~/perforce

For csh:

set path=(~/perforce $path)
setenv P4PORT 1666

For bash:

export PATH=~/perforce:$PATH
export P4PORT=1666
	

Go to our Downloads page and download both a client (p4) and a server (p4d) for your platform. Put both programs in your ~/perforce directory.

Make the programs executable, then start the Perforce Server as shown:

cd ~/perforce
chmod a+x p4 p4d
p4d -d

Trying Perforce

You now have everything you need to use Perforce on your machine, and all Perforce features are available to you. Here are some things you can try:

1. Creating a Client Workspace

You need a client workspace to work with files in Perforce. For this demo, create a client workspace in your home directory with the following commands:

mkdir ~/p4client
cd ~/p4client
p4 client

This puts you in the editor. Just save and quit—the defaults are fine.

2. Adding New Files to the Perforce Depot

Copy some test files and directories to the ~/p4client directory. Then add them to the depot with the following commands:

cd ~/p4client
find . -type f -print | p4 -x - add
p4 submit

The p4 submit command puts you in the editor. Replace the line that reads <enter change description> with text of your own, write the file, and quit.

3. Editing and Deleting Files

The files you added are now under Perforce's control. To work on Perforce files, open them for edit, then modify them. For example:

cd ~/p4client
p4 edit foo.c bar.c
vi foo.c bar.c

To remove files, open them for delete:

p4 delete foo.c

To submit these changes to the depot, use the following command:

p4 submit

4. Branching Files

Once you have files in the depot, you can branch them from one path into another. You do that by opening them for integration, then submitting them. For example, if you have files in a path called //depot/mystuff, you can branch them into a new path called //depot/mybranch using the following commands:

p4 integ //depot/mystuff/... //depot/mybranch/...
p4 submit

5. Showing Depot History

Now that you've submitted a few changes to the depot, you have some history to show. Try this:

p4 changes

Cleaning Up

After you're done, uninstall your Perforce demo so that you don't confuse it with any working Perforce installation you install later. Kill your Perforce Server, and remove your demo installation and workspace directories:

p4 admin stop
rm -rf ~/perforce
rm -rf ~/p4client

For More Information

The Perforce commands shown in this demo are just to get you started. Online help for P4 is available; use p4 help to display the main topics.

For more information, consult the following sources:

If you have questions about Perforce or comments on this demo, please email us at support@perforce.com.