5
root@ubuntu:/etc/openvpn# ls -l test.conf -rw-r--r-- l root root 791 Mar 20 09:23 test.conf

What does the above command mean?

2
  • 3
    While we tend to encourage exploring and trying things on your Ubuntu system, you probably shouldn't be doing that as "root"
    – Aaron
    Mar 22, 2013 at 0:54
  • @ BryceAtNetwork23: Thanks for the tip but I was given the instruction to do that.
    – n00b
    Mar 22, 2013 at 7:02

2 Answers 2

11

That is not a command. It contains a command.

It's a prompt, followed by a command, followed by the output of the command. The command itself is:

ls -l test.conf

That command displays information about the file called test.conf located in the current directory. The ls command displays (or lists) information about files. The -l flag makes it display the information in long form, rather than just showing the filename.

(ls without a flag like -l is most often used to list multiple files or determine if a file exists, but may be used with a file known to exist; by default in Ubuntu, issuing ls filename will highlight filename in a way that shows what kind of file it is, for example, it will use a certain color if it is a directory, another if it is marked executable.)

The output is:

-rw-r--r-- l root root 791 Mar 20 09:23 test.conf

That means the file:

  • is not a directory (-rw-r--r-- doesn't start with d)
  • is non-setuid and non-setgid (no s in -rw-r--r--) and non-sticky (no t)
  • is readable and writeable by its owner (rw- for owner) but only readable by other users (r-- for group members, r-- again for others) — see the community documentation on permissions
  • is owned by the user root (with root as its group identity also)
  • is 791 bytes in size
  • reports that it was last modified (or created) on the 20th of March at 9:23 am
  • has the name test.conf

The beginning of the line is a prompt; this is what is displayed to the user in a shell to notify the user they may enter a command. Prompts are often configured to provide helpful information to the user. Here the prompt is:

root@ubuntu:/etc/openvpn#

This means the current user is root, the machine's hostname is ubuntu (which usually means this is a live CD/DVD/USB system, but someone could name their machine ubuntu in an installed system too), and the current directory is /etc/openvpn (which is where configuration data for OpenVPN are stored, see also the Ubuntu OpenVPN documentation).

The # character indicates that this is a superuser shell (which is to be expected as it is owned by root, the superuser); otherwise it would have been $ (but please note that this convention is not universally followed, and some shells default to % which does not indicate anything about the shell's capabilities).

2
  • I've edited the post slightly to account for what looks like a botched copypaste. Your post should still make sense.
    – Oli
    Mar 22, 2013 at 0:04
  • 1
    @ Oli: While I appreciate your good intention, I would appreciate it if you could edit it back to the original phrase/sentence. I copied exactly what was displayed on my computer screen. If you have any issue with it, you could point it out in your answer or comment.
    – n00b
    Mar 22, 2013 at 7:07
5

I think that you have a misunderstanding with the structure of that line.

The first sentence is telling the user at a determined computer that is in the mentioned folder:

root@ubuntu:/etc/openvpn#

Here you have:

  1. user = "root"
  2. machine name = "ubuntu"
  3. location = "/etc/openvpn"

and the corresponding separators between them are @, : and #

The command, that is after the last separator (#), is:

ls -l test.conf

The output that you get is:

-rw-r--r-- l root root 791 Mar 20 09:23 test.conf
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .