Linux learning (a)

The most commonly used seven Linux command:

cd: Change directory.

pwd: View current directory.

ls: view files in the directory.

touch: No files you create the file.

mkdir: create directory.

mr: remove deleted. -r can delete the directory

clear: clear the screen.

Files and directories for commonly used commands

View directory contents

ls

    -a: View hidden files

    -l: View details

    -h: -l with the use of user-friendly displays the file size

ls wildcard

    *: Represents any number of characters

    ?: Indicates any one character

    []: Represents any character can match a group

    [Abc]: represents a ratio with a, b, c of any one of

    [Af]: to match any character within a range of f

        

 

Change directory

cd

    cd: switch the current user's home directory

    cd ~: ditto

    cd:. maintained in the current directory

    cd ..: Switch to the parent directory

    cd -: to switch between the last two working directory

 

Create and delete operations (when creating a dot (.) At the beginning of the file is a hidden file)

touch

    If the file does not exist, you can create a blank file

    If the file already exists, you can modify the last modification date of the file

mkdir

    -p: create directories recursively

rm

 

Copy and move files:

tree (tree display)

-d: show only directory

cp [object address] [copied into the directory address]

-i: covered prompt before files

-r: If all the subdirectories and files directory files recursively copy directory

mv

May be used to move a file or directory, the file or directory may be renamed

 

 

View the file contents

cat

    View the contents of the file, create a file, file merging, additional features such as file content

    -b: display non-empty rows

    -n: display all rows

more

    Split-screen display file contents

 

grep

    Search the contents of a text file

    -n: display the line number

    -v: Display all match line does not contain text (inverted)

    -i: ignore case

    Parameters: ^ a: first row, beginning with a line search

         ke $: end of the line, end of line searches to ke

 

other:

echo

重定向>和>>

    命令的执行结果 重定向多一个文件中

    >:表示输出,会覆盖文件原有的Neri

    >>:表示追加,会将内容追加到已有内容的末尾

管道 |

    将一个命令的输入通过管道 作为 另一个命令的输入

Guess you like

Origin www.cnblogs.com/cyhrefuel/p/10985950.html