linux command basic format

Command Prompt

[root@localhost ~]#
  • []: This is the prompt delimiter, no special meaning.
  • root: displays the current logged-on user, I now use the root user login.
  • @: Delimiter no special meaning.
  • localhost: The current short hostname of the system (the full name is the host localhost.localdomain).
  • ~: Represents the user's current directory, the directory in this case the user is currently located is the home directory.
  • #: Command Prompt, Linux with user permission levels This symbol identifies login. If the super user, the prompt is #; If you are a regular user, the prompt is $.

What home directory (also known as the home directory) is the? Linux system is a pure character interface, users log in, there must be a position of the initial login, the initial login location is called the user's home:

  • Super user's home directory: / root.
  • Average user's home directory: / home / username.

Full user in their home directory, so we recommend performing experiments can be placed in the home directory. We look to switch the user directory, to see what works.

[root@localhost ~]# cd /usr/local
[root@localhost local]#

If you cut the user directory, the command prompt will become the user's current directory is the last directory (do not show the full directory / usr / local, show only the last directory local).

The basic format of the command: command [options] [parameters]

 [] Represents the available options, that is, some commands can not write options or parameters, can be performed.

1, Option Effect

After the ls command without options and parameters can be performed, but can only perform the most basic function, which displays the file name in the current directory.

Linux options are divided into short-format options (-l) and long format options (--all) . Short-format options are English shorthand, calling with a minus sign, for example:

[root@localhost ~]# ls -l

Long Format option is to complete the English word, usually with a minus two calls, for example:

[root@localhost ~]# ls --all

In general, short-format options is the abbreviation long form of options , which is a short-format options have corresponding long format options. Of course there are exceptions, such as short-format options -l ls command without a corresponding long format options.

2, the effect of the parameters

Parameter is the operation target command, the general files, directories, users, and processes can be used as parameters command operations.

Why did ls command can omit the parameter? That is because there are default parameters. Object command who generally need to add parameters to specify the operation of the command Yes. If omitted, the default parameters generally. E.g:

[root@localhost ~]# ls
anaconda-ks.cfg install.log install.log.syslog

The ls command does not specify the parameters behind, the default parameter is the current location, it will display the file name in the current directory.


Guess you like