# What is the \`\[user\]\` command on the top level? How do I find docs for it?

**URL:** https://swi-prolog.discourse.group/t/what-is-the-user-command-on-the-top-level-how-do-i-find-docs-for-it/4498
**Category:** Help!
**Created:** [September 29, 2021, 4:50pm UTC](https://swi-prolog.discourse.group/t/what-is-the-user-command-on-the-top-level-how-do-i-find-docs-for-it/4498 "2021-09-29T16:50:35Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ericzinda](https://avatars.discourse-cdn.com/v4/letter/e/b3f665/32.png) [@ericzinda](https://swi-prolog.discourse.group/u/ericzinda)
#### Post date: [September 29, 2021, 4:50pm UTC](https://swi-prolog.discourse.group/t/what-is-the-user-command-on-the-top-level-how-do-i-find-docs-for-it/4498/1 "2021-09-29T16:50:35Z")

</div>

A user trying out the [Python MQI library](https://www.swi-prolog.org/pldoc/doc_for?object=section(%27packages/mqi.html%27)) does the following at the top level (which I’ve never seen before):

```prolog
?- [user].
|: fruit(mango).
|: fruit(apple).
|: ^D% user://1 compiled 0.01 sec, 2 clauses
true.

?- fruit(mango).
true.

```

Can someone describe what this feature is and maybe point me at the docs so I can understand how to translate it to something that can be run through the Python MQI library?

It looks like a shortcut to asserting clauses into the user module, but I’d like to know more details.

---

<div class="post-metadata">

### Author: ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)
#### Post date: [September 29, 2021, 4:57pm UTC](https://swi-prolog.discourse.group/t/what-is-the-user-command-on-the-top-level-how-do-i-find-docs-for-it/4498/2 "2021-09-29T16:57:50Z")

</div>

> What is the `[user]` command on the top level?
> 
> It looks like a shortcut to asserting clauses into the user module, but I’d like to know more details.

That is correct.

See: [Getting started quickly](https://www.swi-prolog.org/pldoc/man?section=quickstart) - Specifically: [Adding rules from the console](https://www.swi-prolog.org/pldoc/man?section=consultuser)  
Also: [User Top-level Manipulation](https://www.swi-prolog.org/pldoc/man?section=toplevel)

* * *

Since `Ctrl-D` or `^D` is not always understood there is end\_of\_file/0

```prolog
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.28-20-g6f8a68f2b)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
...

?- [user].
|: hello :- format('Hello world~n').
|: end_of_file.

% user://1 compiled 0.00 sec, 1 clauses
true.

?- hello.
Hello world
true.

```

---

<div class="post-metadata">

### Author: ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)
#### Post date: [September 29, 2021, 5:11pm UTC](https://swi-prolog.discourse.group/t/what-is-the-user-command-on-the-top-level-how-do-i-find-docs-for-it/4498/3 "2021-09-29T17:11:59Z")

</div>

> [@EricGT](#):
>
> What is the `[user]` command on the top level?
> 
> It is not a command.  
> It is telling you that your are in the module `user` .

Not quite.

It’s equivalent to `consult(user)`, and `user` is special for the consult/1 predicate – it reads from the user’s terminal.

---

<div class="post-metadata">

### Author: ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)
#### Post date: [September 29, 2021, 5:12pm UTC](https://swi-prolog.discourse.group/t/what-is-the-user-command-on-the-top-level-how-do-i-find-docs-for-it/4498/4 "2021-09-29T17:12:49Z")

</div>

Thanks.

I changed it before your reply posted. I was more focused on getting the docs in place then reviewing.

---

<div class="post-metadata">

### Author: ![ericzinda](https://avatars.discourse-cdn.com/v4/letter/e/b3f665/32.png) [@ericzinda](https://swi-prolog.discourse.group/u/ericzinda)
#### Post date: [September 29, 2021, 9:04pm UTC](https://swi-prolog.discourse.group/t/what-is-the-user-command-on-the-top-level-how-do-i-find-docs-for-it/4498/5 "2021-09-29T21:04:10Z")

</div>

Perfect. Thank you!
