Easily fix Linux common commands

Source: Internet
Author: User
Tags disk usage

Shutdown-h now shuts down
Reboot restart your computer now
Logout user logoff

PWD [show current working directory]
CD [Change Directory]
mkdir directory name [build directory]
rmdir [Delete Empty directory]

MV [option] source file or directory destination file or directory [move file or rename file]
RM-RF directory name [delete directory and all files under directory] r recursion; F Force
Cp-r dir1 dir2 [recursive copy command]
Grep-n "HANXL" file name [query HANXL keyword in file]
Find directory-name file name [query for this file under the specified directory]

Useradd HANXL [Add user Hanxl]
USERADD-G Group name User name [add user and specify which group to assign the user to]
passwd HANXL [Modify HANXL's password or set password]
Userdel HANXL [delete user Hanxl]
Userdel-r HANXL [Delete user Hanxl and Hanxl's home directory] * If you want to keep what HANXL left behind, please use the delete user above!!!
All group information and all user information in Linux are in the two files of/etc/group and/etc/passwd, which can be viewed with the cat or VI command.

The permissions are divided into three types: R is readable, 4 is written, W is writable, 2 is, X is executable, and 1 is represented.

You can use chmod to change the permissions of a file or directory, for example:
chmod 777 HANXL: Give HANXL permission rwxrwxrwx
chmod u=rwx,g=rx,o=rx Hanxl: Ibid., u= user Rights, g= group permissions, o= other group user rights
chmod u-x,g+w HANXL: To hanxl Remove user-executed permissions, increase group Write permissions
chmod a+r HANXL: Add Read permissions to all users
Chown user name file or directory: Change the owner of a file or directory
Chown-r User name directory: Change directory and all file and directory owners below
CHGRP Group name File name: Modify the group in which the file resides
USERMOD-G Group name User name: Change the group where the user is located
usermod-d Directory name User name: Change the initial directory of user login

In Linux and UNIX systems | is the pipe command, which means to give the result of the previous command | After the command is processed

init [0123456] 0: Shut down, 1: Single user, 2: Multi-user State no Network service, 3: Multi-user State has network services, 4: The system is not used to retain to the user; 5: graphical interface; 6: System restart
To modify the default RunLevel, you can modify the Id:5:initdefault of the file/etc/inittab: The numbers in this row

grep "HANXL" AA > My.bak writes the found content to the file My.bak, or if >> appends the content to the end of the file.

Fdisk-l View Linux system partition details

Df-h Viewing disk usage

Easily fix Linux common 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.