Basic LINUX operation commands and basic linux operations
Ls to list files and directories
-A: displays all files and directories, including hidden files and directories.
-L: displays full attribute information of files and directories.
Cd changes current path
(Relative path and data pair path)
Pwd displays the current working file directory
Create a directory using mkdir
-P: create the current directory (if there is no parent directory) and create the parent directory.
Mkdir-p test1/test1-1
Rmdir Delete empty directory
Delete the current directory (absolute path and relative path), and the directory is empty.
Touch creates an empty file
Move the music video file and change the file name
Mv test/usr/indicates to move the test file under the current directory to the usr directory under the Home Directory.
Rm delete files and directories
R: delete directories cyclically
F: Delete the directory with rigidity, and do not remind the user whether to delete the information.
Rf: the directory is forcibly deleted cyclically.
Rm-rf *: deletes all contents, including directories and files.
Ln establishes a symbolic connection, similar to creating a file shortcut
S: create a link symbol.
F: create a link symbol. If it exists, replace the file.
Ln-s ct. sh slink indicates that slink is created in the current directory and points to the ct. sh file.
Ln ‐s/etc/inittab, inittab points to the actual file/etc/inittab
Cp copy directory
R: directory of cyclic Replication
[Case] cp-r dir1 dir2, recursive COPY Command (copy sub-directory information)
Cp/etc/profile./pfile indicates to move the profile file under the etc directory to the current directory and change it to pfile.
Cp-r test/usr/indicates to copy all directories under the test directory to the usr directory.
Cat view.
Continuously output the file content to the screen, which can only be viewed but cannot be edited.
B is displayed together with the row number, but the empty row is not
Cat-n/etc/initable indicates to display all initable files in the etc directory and remove empty lines.
Vi view and edit the interface commands
You can see and edit
More: display the file content with pagination, Ctrl + page up, long space up down
Show all the content of the file (the difference with cat is that cat will flash over after 40 lines are displayed. More can be viewed manually.
Less, display file content with pagination
Like more, you can use pageup pagedown to flip pages.
Grep content in the text
I: search for qualified content in the file, case insensitive
V: Find unmatched rows.
X: Search for the content that matches the entire row. N: Mark the number of columns in the modified row before the row that matches the style is displayed.
Grep-I (lower case) 'sa 'abc grep-n' smb 'Install. log | grep-v 'lib' (possible error)
Assume that a file named aaa. java contains the shunping keyword. You can use the grep command to search for the file. grep n "shunping" aaa. java, and n indicates that the file appears in line n.
Man [command], help, Similar to the help in dos
Head
N: specifies N rows in the header of the file.
Tail
N: specifies N rows at the end of the file.
Which
Find the executable file location through the path set up by the Environment Variable path
Whereis
Find the file location in the cache area and use the custom directory.
Useradd
D
G
G
Passwd
Used to set the User Password
Su
Add "-" to switch to another user's environment. If it is not added, the current environment is used.
Gpasswd
A
D
Groups
Displays the group information to which the user belongs.
Id
View user information
ChownChange the owner (chown) and user group (chgrp) commands
R: all files and subdirectories under the directory are changed.
Chown is used to change the Directory and file owner and group
Chown-R liuli: root lamp indicates to change the lamp directory under the current directory and the subdirectories and file owner under the lamp directory to liuli, and change the group to the root group.
Chown xiaoming abc: Change the abc owner to xiaoming
Chgrp root abc: Change the abc Group to root.
Chown root./abc: Change the owner of the abc directory to root.
Chown-R root./abc: the owner of the abc directory and all files and directories under it is root.
ChmodChange file or directory permissions
R: Change the directory together with all files and sub-directory files
Chomd is used to change the read and write permissions of files and directories.
Chomd 760 ct. sh indicates the ct in the current directory. change the sh File Permission to rwxrw ____ (760 = ob111 110 000 chomd ug = rwx, o = r ct. sh indicates changing the permission in the current directory to rwxrwxr __
Chmod 755 abc: grant the abc permission rwxr-xr-x
Chmod u = rwx, g = rx, o = rx abc: Same as u = user permission, g = Group permission, o = other user permissions of different groups
Chmod u-x, g + w abc: removes the user's execution permission for abc and adds the group write permission.
Rpm
Ivh
Qa
E
Nodeps
Yum
Install: install the specified package
List: displays all existing rpm packages.
Groupinstall
Info
Configure
Configuration command
Make
Find, search for files and directories.
In linux, because the file system is composed of hierarchical structures, it is not easy to find specific files and directories in the entire system. The "find" command can solve the above problems.
-Search for and display files and directories with the specified name under a specific directory
[Case] find/-name man: indicates to search for a file or directory named man from the root directory.
Find/etc-name '* http *' find the files whose names contain hppt in the etc directory.
-Search for files or directories that have been accessed/changed for a period of time
[Case] find/home-amin-10: files or directories in ten minutes
[Case] find/home-atime-10: files or directories in 10 hours of memory
[Case] find/home-cmin-10: files or directories changed within 10 minutes
[Case] find/home-ctime + 10: files or directories changed 10 hours ago
-Search for objects of the specified size
[Case] "find/home-size + 10 k" means to search for files with a size of 10 k in the/home directory.
Redirection command
Ls-l> a.txt. The list content is written to the.txt file (overwrite)
Ls-al> aa.txt. The content of the list is appended to the end of aa.txt-
Input information from the file: database_program <database_data