Linux Infrastructure and commands

Source: Internet
Author: User
Tags bz2

The meaning of the 1.Linux file system

  • To mount a disk is to put the disk in a directory
  • Bin directory is a command to place a normal user
  • The commands in the Sbin directory are only available to administrators
  • The boot directory is the configuration file where the Linux operating system is placed
  • Dev is the place to store files (including hard disks)
  • ETC is a configuration file for placing systems and application services
  • Home is an ordinary user's home directory
  • Lib is the file that holds the function library
  • Opt is a large file on the periphery of the installation
  • USR Installation Web program
  • var is the root directory of some log files, middleware
  • Enter the character page with ctrl+alt+f2*
    2.Linux Common commands (placed in the/bin/bash directory)
    LS View directory contents
  • -l view content in detail
  • -al See all the details in the directory
  • -R View all content in the current directory
  • -LH Viewing file sizes
    Uname viewing system-related commands
  • -A display host name, kernel version, hardware platform, etc. details
  • -R Display Kernel version
    Hostname View current host name
    Ifconfig to view IP information
    Cat/proc/cpuinfo Viewing CPU information
    Cat/proc/meminfo Viewing memory information
    Halt,shutdown-h No shutdown
    Rebot restart
    PWD View the path to the current directory
    CD Switch Directory
    Du view the size of the directory
    mkdir Creating a new directory
    Touch Create new file, update file date
    CP Copy file (CP (option) source file or directory ... Destination file or directory)
  • -R recursively replicate entire directory tree
  • -P Keep the properties of the source file unchanged
  • -F Force overwrite the target file or directory with the same name
    RM Delete file or command
  • -R recursively deleting files or directories
  • -F force Removal of files or directories
    MV Move file or directory (MV (option) source file or directory ... Destination file or directory)
    Find finds a file or directory (find find scope lookup condition)
  • -name Search by file name
  • -size Search by File size
  • -user Search by file owner
  • -type Find by File type
    VI Compiler
    Enter is Command mode
    Press I to enter insert mode
    ESC exits insert mode and enters command mode
    Save exit: Wq
    Force Save exit: wq!
    Exit: Q
    Forced exit: q!
    Use: Set Nu to display line numbers in command mode
    Command mode search for/search content, N is the next
    :%s Full text replacement (: The word or letter replaced by the word or letter to be replaced by the%s file)
    Cat Displays the full contents of the file
    Cat 1 2 > 3 merge Files 1, 2 to 3 inside
    CAT/ETC/PASSWD View all users of the system
    CAT/ETC/PASSWD |grep (user name) to see if this user exists
    Root:x:100:40:root:/root:/bin/bash
    Root refers to your user name
    X indicates a password
    100 is the UID number (user ID)
    40 is the GID number (user group ID)
    Root is the name of your group
    /root is the user's home directory
    /bin/bash the shell used by this user
    Cat/etc/shadow Placing a password
    ! There's no password.
    Cat/etc/group viewing all user groups of the system
    Cat/etc/group |grep (user name) view in that user group
    Archive (TAR) and Compress commands gzip bzip2
    gzip filename compression file (suffix. gz)
    BZIP2 filename Compressed file (suffix. bz2)
    Tar multiple files archived into one compressed package
    TAR-CVZF compressed file 1 Compressed file 2 Create archive (. gz)
    TAR-CVJF compressed file 1 Compressed file 2 Create archive (. bz2)
    TAR-XVZF compressed file-C directory extract to directory file (. gz)
    TAR-XVJF compressed file-C directory extract to directory file (. bz2)
    Tar option archive file name source file or directory
    -C Create an archive file (with a. tar extension)
    -V Output Details
    -F means using an archive file
    TAR-CVF archive files into a single file (. tar)
    TAR-CVF 4.tar 1 2 3
    TAR-XVF Unpacking an archive file
    TAR-XVF 4.tar
    Installing the RPM Package
    -I install a new RPM installation package
    -U upgrade software, installation is not installed
    -F Update software, not installed not installed
    -E Uninstall Software
    CHOMD command to change the permissions of a file or directory

    • RWX r-x R-x
      D rwx R-x R-x
      First character-Represents a normal file
      The character D represents the directory
      L on behalf of linked files
      R Readable 4
      W writable 2
      X executable 1
      RWX 7
      Rw-6
      R-x 5
      r--4
      -WX 3
      -w-2
      --x 1
      ---0 executable 1
      The representation of a permission range is as follows:
      U (user), which is the owner of the file or directory;
      G (group), which is the group of files or directories;
      O (other), except the file or directory owner or group, other users belong to this scope;
      A (all), that is, all users, including owners, groups and other users;
      R Read permission, the number code is "4";
      W Write permission, the number code is "2";
      x execute or switch permissions, the number code is "1";

        • Without any permission, the number code is "0";
          s special Feature Description: Change permissions for a file or directory.
          chmod u+x,g+w files//For files set themselves can be executed, the members can write permissions
          chmod u=rwx,g=rw,o=r//Documents
          chmod 764//Documents
          chmod a+x File//Set executable properties on U,g,o of a file

      Owner and owner group property settings for the file
      Chown user:market File//file to UESR, add to market Group
      Ll-d F1 View the properties of a directory F1
      LL View permissions
      Add, delete, change users and user groups
      Useradd add user, create user account
      Main parameters
      -C: Add note text, note text is saved in passwd's remarks column.
      -D: Specifies the primary CD directory at which the user is logged in, replacing the system default/home/< username >
      -D: Change the preset value.
      -e: Specifies the expiration date of the account, the date format is Mm/dd/yy, for example 06/30/12. The default indicates permanent validity.
      -F: Specify the number of days after the password expires to close the account. If the 0 account is immediately deactivated, if 1 then the account is always available. The default value is-1.
      -G: Specifies the group to which the user belongs. The value allows the group name to be a GID as well. The user group must already exist, with the default value of 100, which is users.
      -G: Specifies the additional group to which the user belongs.
      -M: Automatically establish the user's login directory.
      -M: Do not automatically create a user's login directory.
      -N: Cancels the creation of a group named after the user name.
      -R: Set up the system account.
      -S: Specifies the shell to use when the user is logged in. The default value is/bin/bash.
      -U: Specifies the user ID number. The value must be unique within the system.

               建立一个新用户账户testuser1,并设置UID为544,主目录为/usr/testuser1,属于users组:                                      

      #useradd-u 544-d/usr/testuser1-g users-m testuser1
      Plus-M automatically created if the home directory does not exist
      Create a new Oracle user, which initially belongs to the Oinstall group, and also makes him part of the DBA group.
      #useradd oracle-g oinstall-g dba
      Create a new Oracle user, which initially belongs to the Oinstall group, and also makes him part of the DBA group.
      Userdel Deleting a user

                                 -f:强制删除用户,即使用户当前已登录;           -r:删除用户的同时,删除与用户相关的所有文件。                    usermod修改用户帐号的各项设定。           -c<备注>  修改用户帐号的备注文字。           -d登入目录>  修改用户登入时的目录。           -e<有效期限>  修改帐号的有效期限。           -f<缓冲天数>  修改在密码过期后多少天即关闭该帐号。           -g<群组>  修改用户所属的群组。           -G<群组>  修改用户所属的附加群组。           -l<帐号名称>  修改用户帐号名称。           -L  锁定用户密码,使密码无效。           -s<shell>  修改用户登入后所使用的shell。           -u<uid>  修改用户ID。           -U  解除密码锁定。                                  更改登录目录

    #usermod-D/home/hnlinux Root

                   改变用户的uid

    #usermod-U 777 Root

                      将newuser2添加到组staff中:

    #usermod-G staff newuser2

                                          修改newuser的用户名为newuser1:

    #usermod-L newuser1 newuser

                                             锁定账号newuser1:

    #usermod-L Newuser1

                                             解除对newuser1的锁定:

    #usermod-U newuser1

                groupadd 选项 用户组  //增加一个新的用户组                 -g GID 指定新用户组的组标识号(GID)。                 -o 一般与-g选项同时使用,表示新用户组的GID可以与系统已有用户组的GID相同。**  # groupadd group1**

This command adds a new group group1 to the system, and the group identification number of the new group is added 1 on the basis of the currently existing maximum group identification number.

#groupadd-G 101 group2

This command adds a new group group2 to the system, specifying that the group identification number for the new group is 101.

             groupdel 用户组  //删除一个已有的用户组                                 -g GID 为用户组指定新的组标识号。                 -o 与-g选项同时使用,用户组的新GID可以与系统已有用户组的GID相同。                -n新用户组 将用户组的名字改为新名字

# GROUPMOD-G 102 Group2

This command modifies the group ID number of group group2 to 102

#groupmod –g 10000-n Group3 group2

This command changes the identification number of the group group2 to 10000 and the group name to Group3.

Linux Infrastructure and commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.