Linux self-study journey-basic commands (1)

Linux self-study journey-basic commands (1)


Preface

1. The installation chapter has passed, and we started the formal Linux basic command chapter.

2. The basic commands from the beginning of this chapter will mainly introduce the commands commonly used in Linux and their functions.


Tip: The following is the content of this article

1. Login interface

1. When you first enter the system, there will be a section of "localhost login", which can be entered later; here is for you to enter your login user account (by default, "root" is used to log in [root is the system administrator, do you imagine windows? There is also the concept of an administrator account]), just type "root" and press Enter.
Insert picture description here


2. After entering "root" and press Enter, you will be required to enter the password of the user "root" ; remember the root user password we set during installation, it is the first time you were asked to enter the password set during installation , Just hit it directly. ( Centos will not display your password by default when you enter it. Just press Enter after you type , and then you can officially enter the system)
Insert picture description here
Insert picture description here

Second, the command prompt

Then after we log in successfully, we see the following message, and we can enter it, our Linux is in this interface and enter the code after this sentence (command prompt) to execute; next let's talk about this sentence the meaning of.

[root@localhost ~] #

1. [] : The segmentation function of the prompt has no special meaning . To be straightforward is to make the format look better. emm

2. Root: the username you are logging in (root is the administrator account we just logged in)

3. @: It also serves as a segmentation and has no special meaning

4. localhost: The abbreviated host name of the current system (remember the host name that was required to be set when it was first installed, abbreviated the previous part)

5. ~: The current working path (remember the "/" I said, that is the root directory, if I am in the "/" directory, "/" will also be displayed here; bluntly, it means I am in Linux Which directory in the system) ( ~ represents me under /root/ )

6. #: This symbol means that you are currently logging in with the administrator account . I said "root" is the administrator account


Three, the basic format of the command

So we finished talking about the "command prompt", we found that the "command prompt" has its own set of grammatical format, then the commands we enter in Linux also have its own set of grammatical format. as follows:

[root@localhost  ~] #  命令  [选项]  [参数]

1. The content enclosed in [] means that the content of this place can be written or not;

2. After the command prompt, connect the "command name" first, and then if this command has some "options", you can connect it, of course, most commands have practical uses even if you don't connect options

3. The following parameters are also optional
[
4. We regard "command" as a store, "option" as something to buy in the store, and "parameter" as the amount of payment

4.1: When we enter the store (command), do we first choose what we want to buy (options), and then go to the cashier to pay (parameters)? This is like the format of command execution, there must be a command, then options, and finally parameters.

4.2: Of course, sometimes we can go to the store (order) or not to buy things, just walk around and come out, right? This is also the format of our order, sometimes it can only be the order itself, without having to pick up options.

4.3: Sometimes we run out of money, can we just go to the store (command) and get the things (option) and just run without paying (emm, in real life, don’t be like this, you will be caught), In this way, sometimes we can also directly receive commands and options themselves, and execute them without adding parameters.

4.4: The last situation is that you go to the store (order), and you just walk around without taking anything, but when you come out, you still pay the boss, because what a duck, because you told the boss that your store is in a good environment , I will give you some sponsorship fees (improper example, emm, let's make do), so that it is just like our command format, you can directly receive the command and the parameter itself, and the option does not need to be added.


Four, ls command

ls is the most common directory operation command in our Linux, the main function is to display what is in the directory.

  • Command name: ls
  • English full name: list (the original intent of this command)
  • Location: /bin/ls ("Everything is a file" under Linux, commands are also files, this is where the commands are placed)
  • Function description: display the contents of the directory

The basic syntax format of ls:

[root@localhost ~]# ls [选项] [文件名或目录名] 

Available options (common) :

  • -a: display all files (including hidden files)
  • -d: display directory information, not the files in the directory
  • -h: Humanized display of directory information, according to the unit we are used to to display file size
  • -i: display the inode number of the file
  • -l: long format display

Let me give you a few examples, everyone else try it yourself:

[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog
[root@localhost ~]#
(直接ls回车显示当前目录下所有内容,不包括隐藏文件)
[root@localhost ~]# ls -a
.   anaconda-ks.cfg  .bash_logout   .bashrc  install.log         .tcshrc   .Xauthority
..  .bash_history    .bash_profile  .cshrc   install.log.syslog  .viminfo
[root@localhost ~]# ls -a :是显示当前目录下所有文件,包括隐藏文件。【. .. 前缀的都是隐藏文件】)
[root@localhost ~]# ls -lh
总用量 44K
-rw-------. 1 root root 1.2K 1月  11 11:22 anaconda-ks.cfg
-rw-r--r--. 1 root root  27K 1月  11 11:22 install.log
-rw-r--r--. 1 root root 7.4K 1月  11 11:21 install.log.syslog
[root@localhost ~]# ls -lh :长格式(更详细的信息)并人性化显示文件大小的形式呈现出目录下所有内容【1.2k这些就是文件大小,大家可以试试不加选项h会怎么样】)

to sum up

This section mainly introduces the { 1. Command prompt: [root@localhost ~]# 2. Basic command format: [root@localhost ~]# command [option] [parameter] 3. ls command: display directory Everything below }



That's it for this section, I'm Jiehua, see you next time.

Guess you like

Origin blog.csdn.net/qq313088385/article/details/112521230