This paper is participating in the30 years of Linux”Topic essay activity
Liunx has been out for nearly 30 years, how is also the absolute king of IT field, there are a lot of small friends still do not understand Liunx, today I will take you to quickly understand this “big brother”!
Computer Network Notes
Command help:
Command – -help
Manls
Exit man help
The first column:
File properties: file type and file permissions
The D indicates that this is a directory
– The beginning indicates that this is a normal file
L indicates a link file
File permissions:
Read access to Rread
Wwrite write permissions
Rwxrwxrwx
Group 1: represents the owner of the file.
Group 2: indicates the group to which the file belongs
Group 3: indicates the permissions of other users to access files
Column 2: represents the link to the file
Third column: represents the owner of the file
Column 4: The group to which the file belongs
Column 5: Represents the size of the file in bytes
Column 6: indicates the last modification time of the file
Column 7: File name
Linux cp command replication
Directories: copy files and directories
Syntax format:
Cp [parameter] Source file Destination file,
And then the.bak is a copy of the file
Usage:
1. Copy files in the current directory
↓ Copy cp a.cfg a.cfg.bak to the ↓Copy the code
2. Copy the directory under the current directory
Cp -r source directory Destination directory Copy directory must add arguments -r -r, -r, -- recursively copy all contents of the directory and its subdirectories. Example: copy the test directory from the current directory and rename it test_bak cp -r test test_bakCopy the code
3. Copy the contents of the current directory to other directories
Cp [-r] Current directory Contents Other directories
- Example 1.cp -r test/(test copied to root directory)
- Example 2.cp -r test /test_bak (test copied to root and renamed test_bak)
4. Copy the contents of other directories to the current directory
Cp [-r] Contents of other directories (including files and directories) Current directory
- Example: cp /anaconda-ks.cfg.
- Example: cp /anaconda-ks.cfg./ana.cfg
scp
secure copy(remote file copy program)
Secure replication Remote file replication program
Usage 1. Copy files from the local server to the remote server
Syntax: SCP [-r] local content username @ip:/ directory
Example: SCP -r sofr_frg/ [email protected]:/root/
Copy the soft_frg directory in the current directory on the local server to the /root directory on the remote server
2. Copy the contents of the remote server to the local server
SCP [-r] username@ip :/ local content
Supplement:
/ root directory
/root Home directory of user root
Linux CD command switch
Man can also be viewed
(view) CD –help (view)
cd
Change the shell working directtory
(Switch working directory)
CD usage:
1. Do not add any parameter CD
Action: Back to home directory
In Linux, the root user’s home directory is /root
2. CD catalogue
Function: Switches to the specified directory
Example: CD /
3.cd ..
Function: Returns the upper directory (upper two levels.. /..)
. The superior
4.cd ~
Action: Back to home directory
~ indicates the user’s home directory
5.cd .
Function: CD to current directory
.Current directory
6.cd –
Function: Toggles back and forth between current and previous directories
Supplement:
PWD (Locate the current path)
Prints the current directory/working directory
CTRL + C (force end command) or Enter end line feed
Rm of linu was deleted
Prerequisites for deleting:
Online server, you must make a backup before deleting
rm remove files or directories
Delete a file or directory
Grammar:
[Parameter] File/directory
Common parameters: -r (recursive, recursive delete, first delete inside, then delete outside)
-f (–force forcible deletion, regardless of whether the file exists or not)
Rm -rf File or directory
usage
1. Delete the contents in the current directory
Example: rm -rf test
2. Delete other directories and their contents
Example: rm -rf /test
* Hidden directory cannot be selected
.* You can find hidden directories with dots
This is delete library run necessary skills 😂, careful use!
Linux ls command
ls(list)
Lists the contents of the directory
Grammar:
Ls [Optional] [file]
usage
1: ls
No arguments are added
Function: Lists the names of files and directories in the current directory
2: the ls -l
-l (long, long format)
What it does: Lists the files and files in the current directory in long format. Interest rates
3: LS-AL is the same as ls-a-L
-a Displays all files, including hidden files, all
Function: Lists all articles in the current directory in long format. Files, including hidden files
4: ls [parameter] File name
ls -l abc.txt
Function: View the specified file
5: ls [parameter] directory
ls -l /var/
Function: View the specified directory
Cat, less, more orders
Cat (link files and print their contents to standard output)
(Display file contents on screen (command line))
(View file contents)
Cat [parameter] file
usage
1. View all contents of the file
The cat file
Scenario: Users with low permissions can view file contents
2. View the file content and redirect (input) the file to another file
Cat ifcfg-ens33 > ifc.txt(new file)
3. View the file content and display the line number
Cat-n Specifies the file name
Less (is the opposite of more)
Feel free to view files
More (View file contents in split screen)
(Only press space or Enter to view the new content below)
According to q to exit the
Head (View file header contents)
(View the first ten lines of the file by default)
usage
1. The head file
2. View the specified number of rows
Head -n Number of lines file name
Tail (View file tail contents)
(Default last 10 lines)
Common parameters: -n -f (View file contents in real time)
tail -f -var/log/secure
Linu’s mv command moves
mv move (rename) files
Move or rename files
The mv command has two functions:
1. Move (cut) files or directories
2. Rename a file or directory
grammar
1. Move files in the current directory
Syntax: mv file destination directory
Example: mv anaconda-ks.cfg.bak /
2. Move the directory in the current directory
Syntax: mv Source directory Directory
Example: mv test /
3. Move the contents of other directories to the current directory
Example: MV /test.
4. Rename the file in the current directory
Syntax: mv Old filename New filename
Example: mv anaconda-ks.cfg. Bak ana-ks.cfg
5. Move the files in the current directory to another directory and rename them
Syntax: mv Source file destination directory/new file name
Example: mv Ana-ks. CFG /anac.cfg
Xiaobian below will continue to update, what information you need can be directly private letter oh
- Male _ no. ❤; Front-end honest person, you can exchange and learn with small partners!