ls command to list files and directories
The -A option is used to list all files, including those hidden files. As long as the first character in front of the file name is a ".", The file is a hidden file. If the first character in front of a directory name is "." This directory is a hidden directory.
-l This option is used to display a list that contains a list of most attributes of all files in this directory.
--color This option is particularly useful, the executable file is green, the ordinary file is white, and the directory is blue
2.cd is used to change the current directory. Earlier we said that "/" represents the root directory, then execute cd / to enter the root directory. Use ".." to represent the upper directory.
If you are in the / usr / src directory, there are two ways to enter the / usr directory: cd / usr and cd ..
3.pwd view the current directory
mkdir New directory name command to create a new directory Add a dot "." in front of the method to hide the directory and files mkdir LoveLetter can create a new directory called LoveLetter
rm File name / directory name to be deleted The command to delete a directory can actually delete files
mv command to change file name and directory name
mv old file name new file name mv old directory name new directory name
7.cp Copy files and directories command
cp command is used to copy a file into a new file cp old file name new file name
8. How to use man command reference tool
man ls, so you can see a detailed explanation of all ls commands and parameters
nano is a small, free and friendly editor
nano filename exit ctrl + x
vi editing software, one is command mode, one is edit mode
vi LoveLetter. After entering, press the Insert function key or i key on the keyboard to enter the editing state, you can insert characters, and then press Insert to change to the cover mode
Save: Press the ESC key to return from the editing mode to the command mode, first enter a colon ": W"
Exit: Use the "q!" Command to exit directly: ": q"
Modify: "ESC: wq"
11.cat is the command used to display the content of the text file cat file name
The text file is very long, one screen can not be displayed, cat will not automatically page
12.more more command displays text files, if there is too much content, it will automatically pause at the end of each page, wait until the user presses the space bar to continue. more file name
13. The pipeline can display the contents of the file, and can also be used to create files
When using the ls command to display all the files in a directory, a page cannot be displayed
ls /dev | more
Use a file to record all the result pipeline symbols displayed by the ls command just now: ">;" ">;>;" Greater than the symbol, the difference is that a pipe greater than the symbol is used to create a new file names.txt If there is already a file with the same name, the previous content is overwritten; and two pipes with a greater-than symbol are used to append new content after the existing file, and create it if there is no such file.
ls /dev >; filenames.txt
vi filenames.txt to see how many lines there are
cd is used to switch the working directory Syntax: cd [relative or absolute path or special symbol]
cd: enter the user's home directory ~ (root user is / root, other users are / home / user name)
cd ..: return to the previous directory (note the space)
cd-: return to the last directory
cd /: return to the root directory (absolute path)
cd ./Directory 1 / Directory 2: Enter the subdirectory under the current directory (relative path)
pwd: display working path
2.ls: Used to list files in a directory, syntax: ls [options] [directory or file name]
ls -a: List all files under the file, including hidden files starting with "."
3.file file or directory: display the type of file (directory, text, zip, shell script, etc.)
4.mkdir dir1: create a directory (dir1)
mkdir -p ./dir1/dir2: create a directory recursively (-p: when the parent directory does not exist, create it at the same time)
5.touch a.txt: create file a.txt
6.rm: You can delete one or more files or directories in a directory, you can also delete all files and subdirectories of a directory and its subordinates; Syntax: rm (option) (parameters)
rm file: delete file
rm -r directory or file: delete the directory (and all files in the directory) (non-empty can also be)
rm -rf directory or file: force delete, such as: rm -rf * delete all files in the current directory
mv: is the abbreviation of move, which can be used to cut and move files, directories or rename files;
Syntax: mv source file target file (renamed) or directory (mobile);
mv ab: Move or rename a file or directory (move the directory or overwrite the file if it exists, rename it if it does not exist)
mv / opt / git / g / opt / a: move g to the opt directory and rename it as a (the a directory does not exist, if it exists, move g to the a directory)
mv -t ./test a.txt b.txt: move multiple files to a directory
8.cp: Copy files or directories; cp command can copy single or multiple files to an existing directory;
Commonly used: cp -ai file or directory target directory;
9.ln: abbreviation of link, used to establish hard (soft) links, often used to build soft links (similar to shortcuts) to PATH during software installation;
10.chmod [-R] 777 file or directory: set permissions r (read) corresponds to 4, w (write) corresponds to 2, x (execute) execution corresponds to 1, locate read data from the database
11.locate a.txt: Find files with the name a.txt in the global scope of the system (faster than find), locate to read data from the database
12.find: Search for files in the directory structure and perform specified operations
13.cat [-n] File name: display the content of the file, along with the line number
14.useradd username: create a user
15.passwd [ludf] User name: The user changes his password without entering a user name. Options -d: specify a blank password, -l: disable a user, -u unblock a user, -f: force the user to log in next Change password
16.userdel -r username: delete user: (-r means delete the user's home directory together)
17. groupadd group name: create a user group
18. groupdel user group: delete the group
19.su-User name: complete switch to a user environment (equivalent to login) (recommended to use this) (exit user: exit)
20. sudo command: execute the command as root (enter the user's own password, and su to enter the password of the user to switch, ordinary users need to set / etc / sudoers to use sudo)
21.file file name: check the file type (you can see which way to compress)
22.make: compile
23.make install: install
24.make clean: delete temporary files generated during installation
25.hello: execute software
26.rm -rf software directory name: uninstall the software
27.ps -ef: Display all process information, along with the command line ps -ef | grep sshd: common usage of ps and grep to find a specific process (ps -ef | grep sshd)
28.chkconfig iptables off / on: permanently turn off / on the firewall
Service iptables stop / start: temporarily turn off / on the firewall
ipconfig View ip address
30.grep view, can be used with pipeline
31.yum -y install httpd: install
32.yum remove httpd: remove the package httpd, that is, uninstall
33.chkconfig --list [name] service list eg: chekconfig --level 5 mysql off #Turn off the mysql service on the switch with run level 5
————————————————
Original link: https://blog.csdn.net/weixin_39736287/article/details/87911540