The first experience of rare rice


Linux learning

This is the first blog to introduce the configuration environment when I first worked. I have no experience in blogging, so it may be messy. I hope you can include more.

1、 Common instructions

Linux command

  • -EQ / / equals
  • -NE / / not equal to
  • -GT / / greater than
  • -LT / / less than
  • Ge / / greater than or equal to
  • Le / / less than or equal to

2、 Common commands for processing directory

  • Ls: List directory and file name
  • CD: switch directory
  • PWD: displays the current directory
  • MKDIR: create a new directory
  • Rmdir: delete an empty directory
  • CP: copy file or directory
  • RM: remove file or directory
  • MV: move files and directories, or modify the names of files and directories

3、 Linux content view

  • Cat displays the contents of the file from the first line
  • TAC is displayed from the last line. You can see that TAC is written in reverse of cat!
  • NL display, the output line number by the way!
  • Show the contents of the file page by page
  • Less is similar to more, but better than more, it can turn the page forward!
  • Just look at the first few lines
  • Tail only looks at a few lines of tail

4、 Change file properties:

  • Chgrp: change file group

    Chgrp [- R] group name file name
  • Chown: change the owner or group of the file

    Chown [– R] possessive name file name
    Chown [- R] generic name: generic group name file name
  • Chmod: change 9 attributes of file

    There are two ways to set Linux file attributes, one is number, the other is symbol.

    There are nine basic permissions for Linux files. They are owner / group / others, and each has its own read / write / execute permissions.

    Let’s review the data just mentioned above: the permission character of the file is: [ – rwxrwxrwx ], and the nine permissions are in a group of three! Among them, we can use numbers to represent each authority. The score comparison table of each authority is as follows:

  • r:4
  • w:2
  • x:1

    The scores of the three permissions (R / w / x) of each identity (owner / group / others) need to be accumulated. For example, when the permission is: [- rwxrwx —], the score is:

  • owner = rwx = 4+2+1 = 7
  • group = rwx = 4+2+1 = 7
  • others= — = 0+0+0 = 0

5、 Account management of Linux system

1. To add a new user account, use the useradd command. The syntax is as follows:

Useradd option user name

Parameter Description:

  • Options:

    • -C comment specifies an explanatory description.
    • -D directory specifies the user’s home directory. If this directory does not exist, the – M option is used to create the home directory.
    • -G user group specifies the user group to which the user belongs.
    • -G user group, which specifies the additional group to which the user belongs.
    • -S SHELL file specifies the login shell of the user.
    • -U user number specifies the user number of the user. If you have the – O option at the same time, you can reuse the identification number of other users.
  • user name:

    Specify the login name of the new account.