Basic commands for learning Linux

  

Help command

Man + command

Command + -help

whatis + command 1 + command 2: can easily explain multiple commands

Help for Query Commands

Files, Directory Common Commands

ls

List files+directories in the current directory (-starts with files, starts with dir For the directory)

cd

The path of the transformation can be absolute or relative.

pwd

Getting the current path

mkdir

Creating a new directory

rmdir

Deleting a directory (can only delete Non-empty directory)

rm –r

Recursively delete all

rm –rf

Force all deletions

touch< Br>

New file (the suffix name of the file in linux has no meaning, only the meaning of the prompt)

cp (copy)

cp + file 1 + file 2, copy file 1 to File 2

cp –r + folder 1 + folder 2, copy folder 1 to folder 2, r stands for recursive call

mv (move)

Mv + file 1 + folder 2, move 1 to 2

mv -r

recursive move, mv + folder 1 + folder 2

vi

Text Editor, two common modes

Command

Input

more

Viewing file contents

Example more + File name

cat

Positive order view

tac

Reverse view

head

Head start with parameters view

Example Head -3 XX.txt, view the first 3 lines of XX

tail< Br>

Start of the tail

find

Find the file with parameters

Example find /-name *local Start from the root directory, find by name, suffix is Local

whereis(where these commands come from)

followed by the command, get the executable file and help documentation

ln

link, create a new copy File, synchronized with the source file. It will not delete

ln A B at the same time; B is A copy, A, B sync, modify A or B, equal to modify two, when the delete is not synchronized.

ln –s

Soft links, which are shortcuts

Example ln –s A C; C is a shortcut to A. The difference with hard links is that after A is deleted, C is also deleted synchronously.

wc

Counts the number of lines, words, of the specified text file.

grep

Finding the line of the specified string in the file

Example: grep + character + file name

Copyright © Windows knowledge All Rights Reserved