{"id":374,"date":"2026-10-14T00:21:01","date_gmt":"2026-10-14T00:21:01","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2014\/09\/22\/interview-questions-and-answer-for-perforce-version-control-tool\/"},"modified":"2026-10-14T00:21:01","modified_gmt":"2026-10-14T00:21:01","slug":"interview-questions-and-answer-for-perforce-version-control-tool","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/interview-questions-and-answer-for-perforce-version-control-tool\/","title":{"rendered":"Perforce Interview Prep: Essential p4 Commands for Workspaces, Changelists, and Admin Tasks"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>Originally published on 2014-09-22; fully revised and updated.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide is for engineers preparing for Perforce (Helix Core) interviews or maintaining existing Perforce environments. It focuses on practical commands from the original post, clarifies where each command fits, and highlights safety considerations for admin operations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full aligncenter\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2014\/09\/perforce-interview-question.png\" alt=\"perforce-interview-questions-answers\" width=\"600\" height=\"400\" \/><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Core Perforce commands interviewers often ask about<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These are common command-level checks in interviews: file history inspection, changelist discovery, and status-based filtering.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># Show each line in a file with revision attribution<\/span>\np4 annotate file.c\n\n<span class=\"hljs-comment\"># Last 10 changelists touching a project path<\/span>\np4 changes -m <span class=\"hljs-number\">10<\/span> <span class=\"hljs-comment\">\/\/depot\/project\/...<\/span>\n\n<span class=\"hljs-comment\"># Last 10 changelists by status<\/span>\np4 changes -m <span class=\"hljs-number\">10<\/span> -s submitted <span class=\"hljs-comment\">\/\/depot\/project\/...<\/span>\np4 changes -m <span class=\"hljs-number\">10<\/span> -s pending <span class=\"hljs-comment\">\/\/depot\/project\/...<\/span>\np4 changes -m <span class=\"hljs-number\">10<\/span> -s shelved <span class=\"hljs-comment\">\/\/depot\/project\/...<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>Best for<\/th><th>Interview angle<\/th><\/tr><\/thead><tbody><tr><td>p4 annotate<\/td><td>Line-by-line revision tracing<\/td><td>Debugging ownership and historical context<\/td><\/tr><tr><td>p4 changes -m N<\/td><td>Recent activity in a path<\/td><td>How to scope by depot path and limit result size<\/td><\/tr><tr><td>p4 changes -s status<\/td><td>Filtering by submitted\/pending\/shelved<\/td><td>Operational reporting by lifecycle state<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Ignoring files in a workspace: client view exclusions and P4IGNORE<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The original post shows two ways to keep generated binaries (for example, <code>.dll<\/code>) out of normal reconcile\/add flows: negative mappings in the client view and an ignore file via <code>P4IGNORE<\/code>.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php language-bash\"><span class=\"hljs-comment\"># Example client view exclusions from the original article<\/span>\n-<span class=\"hljs-comment\">\/\/depot\/foo\/*.dll \/\/CLIENT\/foo\/*.dll<\/span>\n-<span class=\"hljs-comment\">\/\/depot\/foo\/...\/*.dll \/\/CLIENT\/foo\/...\/*.dll<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The post also includes a compact variant:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript language-bash\">-<span class=\"hljs-comment\">\/\/depot\/foo...\/*.dll \/\/CLIENT\/foo...\/*.dll<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">References from the original post: <a href=\"http:\/\/stackoverflow.com\/questions\/55449\/can-you-ignore-a-file-in-perforce\">Stack Overflow discussion<\/a>, <a href=\"http:\/\/answers.perforce.com\/articles\/KB_Article\/Exclude-Directories-from-Commands\">exclude directories from Perforce commands<\/a>, and the <a href=\"http:\/\/www.perforce.com\/perforce\/doc.current\/manuals\/cmdref\/P4IGNORE.html\">P4IGNORE command reference<\/a>.<\/p>\n\n\n\n<pre class=\"mermaid\">\nflowchart TD\n    A[Edit files locally] --> B[Run Reconcile Offline Work]\n    B --> C{Excluded by view or P4IGNORE}\n    C -- yes --> D[Shown as excluded files]\n    C -- no --> E[Opened for add or edit]\n    E --> F[Review changelist]\n    F --> G[Submit]\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Admin commands and interview prompts for Perforce superusers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>p4 admin<\/code> command family is used for service-level operations and is typically restricted to superusers.<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">p4 admin checkpoint &#91; -z | -Z ] &#91; prefix ]\np4 admin journal &#91; -z ] &#91; prefix ]\np4 admin stop\np4 admin restart\np4 admin updatespecdepot &#91; -a | -s type ]\np4 admin resetpassword -a | -u user<\/code><\/span><\/pre>\n\n\n<p class=\"wp-block-paragraph\">Reference: <a href=\"http:\/\/www.perforce.com\/perforce\/doc.current\/manuals\/cmdref\/p4_admin.html\">p4 admin command reference<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Common admin interview questions<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>How do you take a Perforce backup?<\/li><li>How do you restore a Perforce backup?<\/li><li>How do you verify the health of repository metadata?<\/li><li>What is the difference between <code>p4 dbverify<\/code> and <code>p4 verify<\/code>?<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Choosing metadata mechanisms: counters, keys, attributes, properties<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The original article distinguishes these mechanisms by simplicity, association with files, and visibility\/control needs.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Mechanism<\/th><th>Use when<\/th><th>Scope and behavior<\/th><\/tr><\/thead><tbody><tr><td>p4 counter \/ p4 key<\/td><td>You need flat key\/value storage<\/td><td>Simple storage; typically no rich visibility model<\/td><\/tr><tr><td>p4 attribute<\/td><td>Metadata is tied to files<\/td><td>Associated directly with file objects<\/td><\/tr><tr><td>p4 property<\/td><td>You need admin-managed definitions and controlled visibility\/precedence<\/td><td>Used by Perforce applications such as P4V; not core server metadata behavior by itself<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs language-bash\">p4 property -n name -v value\np4 counter mycounter 123\np4 key mykey 12\np4 attribute -n name -v value files...<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Commands that can permanently remove file data<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The original post explicitly warns that <code>p4 archive -p<\/code> is one of the few commands that removes file data, and names <code>p4 obliterate<\/code> as the other. Treat both as high-risk operations and validate policy before use.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Command<\/th><th>Risk level<\/th><th>Operational guidance<\/th><\/tr><\/thead><tbody><tr><td>p4 archive -p<\/td><td>High<\/td><td>Use with caution; confirm retention and recovery requirements first<\/td><\/tr><tr><td>p4 obliterate<\/td><td>High<\/td><td>Use only with explicit approval and change tracking<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Perforce integration topics often discussed in interviews<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Git Fusion<\/li><li>Swarm<\/li><li>Replication<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For each integration topic, be prepared to explain why it is used, where it fits in your workflow, and the operational trade-offs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Best practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Scope commands by depot path (<code>\/\/depot\/project\/...<\/code>) to reduce noise and risk.<\/li><li>Prefer explicit exclusion rules for build artifacts to keep reconcile output clean.<\/li><li>Separate interview knowledge into user commands vs superuser\/admin commands.<\/li><li>Treat archive\/obliterate workflows as controlled change events with approvals and backups.<\/li><li>Validate command syntax against your installed Helix Core version before production use.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>A practical Perforce interview refresher focused on high-value commands and admin concepts from real usage. Learn how to query changelists, exclude files, use metadata options, and avoid risky data-removal mistakes.<\/p>\n","protected":false},"author":1,"featured_media":3543,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[370],"tags":[767,1824,766,507,1553,373,1825,1829,1826,1827,482,1830,341,637,381,1828],"class_list":["post-374","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-perforce","tag-answer","tag-control","tag-interview","tag-list","tag-most-asked","tag-perforce","tag-perforce-interview","tag-perforce-interview-qa","tag-perforce-interview-questions","tag-perforce-interview-questions-answers","tag-questions","tag-selected","tag-tool","tag-top","tag-version","tag-version-control-interview-questions-and-answer"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=374"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":79254,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/374\/revisions\/79254"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/3543"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}