Shutdown-h now immediately shuts down the machine
Shutdown-r now restart your computer
Reboot restart your computer now
Logout Log off users
Use of the VI Editor:
1) VI File name
2) input i "Enter command mode"
3) Enter ESC "Enter Command mode"
4) Enter: "Wq means exit hold q! Exit Do not save"
PWD Displays the current path
Groupadd polic Add polic user Group
To view information for all groups in Linux:
Vi/etc/group
Cat/etc/group
View all user information in Linux
vi/etc/passwd
cat/etc/passwd
Useradd xiaoming Add xiaoming user "Add user only user with root privileges can"
USERADD-G Group name User name add users and specify user groups at the same time
passwd add a password to the current user
passwd xiaoming to xiaoming user to change password
Userdel xiaoming Delete User xiaoming
Userdel-r xiaoming Delete User xiaoming and user's home directory
Command: init [012356]
Run level
0: Turn off the machine
1: Single-user mode
2: Multi-user status No NETWORK service
3: Network Service with multi-user status
4: System not used reserved to user
5: Image Interface
6: System restart
The common run level is 3, 5, to modify the default RunLevel to modify the Id:5:initdefault of the file/etc/inittab: The numbers in this line
LS Lists files and directories
-A Show hidden files
-l Display long list format
mkdir Building a Directory
RmDir Delete Empty Directory
Touch to create an empty file
CP Replication
Cp-r dir1 dir2 Recursive copy command
MV moving files and changing file names
RM Delete files and directories
RM-RF Delete all content (including directories and files)
R Recursive F Force
More display file contents with pagination
Less displays the contents of the file with pagination
grep queries a keyword in the text
For example: Find the Xiaohong keyword in the file file.txt file: grep "Xiaohong" file.txt
If you also want to display the number of rows that the Xiaohong keyword appears: grep-n "Xiaohong" file.txt
| The pipe command "gives the result of the previous command to the following command for processing"
Find search files and directories
Find/home-name AAA starting from/home search for files and directories named man
Search for files or directories that have been accessed or changed over time
find/home-amin-10 directories or files accessed within 10 minutes
find/home-atime-10 directories or files accessed within 10 hours
Find/home-cmin-10 a directory or file that has changed within 10 minutes
Find/home-amin-10 a directory or file accessed 10 minutes ago
Search for files of a specified size
Find/home-size +10k to find files of size 10k in the/home directory
>, >> redirect command:
Ls-l > A.txt The contents of the list are written to the file A.txt (overwrite write)
Ls-al >> Aa.txt The contents of the list are appended to the end of the file Aa.txt
Databse < Database_data entering information from a file
Chown User name File name modify file owner
CHGRP Group name File name modify the group in which the file is located
Mount Command:
Mount [-parameters] [device name] [Mount Point]
Uninstall command:
Umount [device name]
To view disk usage:
DF [-parameter]
To see which partition a directory is in:
DF [Directory full path]
View Linux system partition specifics:
Fdisk-l
RPM Package Installation:
Rpm-i PRM Package Full path name: Install package to current system
RPM-IVH RPM Package Full path name: Install package to current system with prompt information
I:install Installation
V:verbose Tips
H:hash progress bar
RPM Delete:
RPM-E RPM Package Name
If other software depends on the package you are uninstalling, an error message will be generated when uninstalling.
Use the --nodeps command-line option if you want RPM to ignore this error and continue uninstalling (Programs that depend on the package may not run).
Linux basic commands