Linux Common directives

Source: Internet
Author: User

The following instructions have been tested under CentOS 7 64bit, please post a message if you have any questions

This post will supplement and update the content on a regular basis.First, user operation1. View User cat/etc/passwd #查看所有用户信息cat/etc/passwd|grep user name #查看某个用户信息这里有必要介绍一下用户信息都有啥? Sample data: Root:x:0:0:root:/root:/bin/bash format description: Username:password:userid:groupid:comment:userhome:shellhome format translation: User name: Secret Code: User ID: Group ID: note: User home directory: Shell command directory Cat/etc/group #查看所有用户组信息cat/etc/Group|grep user group #查看某个用户组信息查询结果: felix:x:1000:felix,test Format Description: User group: User group password: Group ID: User 1, User 2 ... 2. Add User & Set Password (login root account) AddUser TestUser #创建TestUserAccountpasswd testUser #设置密码, then enter two times the password can beor Useradd.TestUser#创建TestUserAccountpasswd testUser #设置密码, then enter two times the password can beSpecial Note: CentOS: AddUser and useradd instructions are not different, will automatically generate the user directory under the home, and use the default shell script directory, the password is empty need to use the passwd instructions to set their own. Ubuntu: AddUser instructions will automatically generate the user directory under the home, and use the default shell script directory, but also friendly prompts to set the initial password; the useradd instruction does not automatically generate the user directory, the default shell script is not enabled, the password defaults to NULL, You need to set it yourself using the passwd directive. 3. Modify Username & password (login root account) usermod-l newuser-d/home/newuser-m testUser #将testUser重命名为newUserpasswd NewUser # Modify the password of the NewUser user, then enter the password two times to 4, delete the user (login to the root account) Userdel TestUser #删除testUser用户rm-rf/home/testuser #删除testUser用户所在目录rm- Rf/var/spool/mail/testuser #删除testUser用户的邮箱特别提示:
If you do not delete the user directory, the next time you create a user with the same name, you will be prompted that the directory already exists, although it can be created to visually automatically use previous user data. Similarly, the user mailbox data is the same, so when deleting the user, you need to delete the directory and mailbox. 5, switch account above said to delete and change users, need root user rights, if we use the ordinary user login, then how to quickly switch to the root account? Su-root #切换到root账号, then you will be prompted to enter the root account password how to exit the root account? Direct execution "6, Exit account" instructions, automatically switch back to the original account 6, Exit account logout #注销用户或者exit #退出当前控制台, for multi-layered shell, multiple use can step out, the last one of the Exit function is equivalent to logoutSecond, directory operation1, create the file directory mkdir ABC #在当前目录下创建文件夹abcmkdir/abc #在根目录下创建文件夹abcmkdir/abc/a #在/abc directory to create folder A, if the/ABC path does not exist will be an error: no such file or Directory 2, delete file directory rmdir ABC #删除当前目录下的abc文件夹rmdir/abc #删除根目录下的文件夹abcrmdir/abc/a #删除/abc directory to create folder A, if the/abc/a path does not exist will error: no Such files or directory 3, navigate to a file directory under Cd/home/felix #进入home/felix directory under CD. #返回上一级目录cd/#返回根目录, i.e./CD. /.. /ABC #进入上级目录的上级目录下的abc目录里 4, folder view LS #查看当前目录下的文件列表three, disk operation1, loading plug-in FAT file formatUSB drive or disk: Mkdir/mnt/usbmount-t Vfat/dev/sdb/mnt/usb 2, loading the external NTFS file formatUSB drive or disk: Mkdir/mnt/usb1mount-t NTFS/DEV/SDB/MNT/USB1If the error is NTFS format is not recognized, please execute the following instruction, Add ntfs-3g Support:Yum Update;yum Install ntfs-3gFinally, try this command again:Mount-t NTFS/DEV/SDB/MNT/USB1 Iv. OtherClear #清屏操作, equivalent to dos screen command Clsuname-a # Displays information about the computer and the operating system Cat/proc/version # running kernel version

Linux Common directives

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.