Training Notes 7.7

7.7

1. Motto

You tell my story, I leave my words, you decide how much I am worth, and I choose where I go.

2. Connection of Linux system (centos7.5 HUAWEI CLOUD as an example)

2.1 Use the ssh remote connection protocol to connect

2.2 There are two ways to use ssh

  1. Use the command to connect

ssh 用户名@ip

  1. Use some software to connect

xshell

finalshell

Three, Linux common commands

3.1 View the current working directory

pwd

3.2 Command to switch working directory

cd 路径(绝对路径/相对路径)

Linux directory structure

cd .. 切换到当前目录的上一级目录

cd

cd - 切换到上一次所在的工作目录

3.3 View which files or folders are in the current working directory

ll 参数

ls 参数

3.4 Command --help

3.5 Create files

touch 文件路径

3.6 Create Folder

mkdir [-p] 文件夹路径

3.7 Delete file folder

rm -rf 文件路径

rm -rf *

3.8 Moving files/folders

mvfile path to move file path to move to

Heavy Naming:mv 移动的文件路径 重命名之后的路径

3.9 Copy files/folders

cp [-r] 路径 复制的路径

scp [-r] 本机的一个文件 root@ip:其他主机的路径

3.10 vi/vim editor

3.10.1 Vim can mark different keywords with different colors according to the path of the file

3.10.2 Path to vi/vim file

  1. The command mode is entered by default: you cannot write files at will, you can only use some shortcut keys to write files

    [n] yy

    p

    [n] dd

    u

    G

    g

  2. edit mode:

    Write files at will Edit mode can only be entered from command mode: a A i I o O

    Edit mode back to command mode: esc

  3. Command line mode: search for files and exit or save files

    Command line mode can only be entered from command mode: / ? :

    1. /and? Represents the searched command line

    2. : Represents saving and exiting the file

      :q

      :q!

      :w

      :w!

      :wq

      :wq!

    Three editing modes

3.11 View file content

3.11.1 cat command

cat 文件路径

3.11.2 tac command

tac 文件路径

3.11.3 tail command

tail 【-n】 文件路径

tail -f|-F 文件路径

  1. Monitor file changes: print the last ten lines of the file first
  2. -f monitoring If the file is deleted, creating a file with the same name and the same path will not continue to monitor
  3. If the file is deleted during -F monitoring, creating a file with the same name and the same path will continue to monitor

3.12 Write back command echo

echo 数据

echo $变量名-- print the variable name to the console

3.13 Redirect command

>>

3.14 Link creation

3.14.1 Soft link

ln -s 原文件的路径 链接文件路径

3.14.2 Hard links

ln 原文件的路径 链接文件路径

If the hard link is deleted from the original file, the hard link will not be affected in any way, but the soft link will report an error

3.5~4.14

Operation commands related to Linux files/folders

3.15 Time and date commands

date:获取系统的当前时间

date -d "英语单词" date -d "-n days" date -d "n days"

date -s "字符串时间"Set the system time to a certain time period

date +%Y-%d......Convert the current time to the specified format

3.16 Operations related to Linux installation software

3.16.1 Compressed package decompression installation - most big data related software is decompression installation

  1. Linux supports many compressed package formats zip gzip tar tar.gz...

  2. Compression and decompression of direct zip

yum install -y zip

zip xxx.zip 文件路径....

unzip xxx.zip

  1. gzip compression and decompression

    1. gzip 文件路径
      1. The required file path must be a file
      2. If the folder cannot be compressed
    2. gunzip xxx.gz
  2. tar package: archive tool

    1. Archiving a folder is called a file. The file extensions are all .tar
    2. tar -cvf xxx.tar 文件或者文件夹路径: Archive the specified file or folder as a tarball
    3. tar -xvf xxx.tarUnarchive a tarball
    4. Directly provides us with a command to compress and decompress using the gzip algorithm
      1. tar -zcvf xxx.tar.gz 文件/文件夹
      2. tar -zxvf xxx.tar.gz -C 路径

gzip compression and decompression, tar package: archive tool: Linux system comes with

3.16.2 rpm package

3.16.3 yum warehouse installation

By default, yum's software store is a foreign website, so yum downloads software very slowly by default. Yum can also replace the warehouse with a domestic warehouse website.

yum list Check what software is available in the software store

yum install -y install package name

3.17 Filter commands

命令 | grep 筛选字符

Guess you like

Origin blog.csdn.net/cai_4/article/details/131605369
7.7