To view

  • View the absolute path of the current directorypwd
  • View the current directoryls
  • View other pathsLs Other paths

Ls does not see files starting with a “.” by default, but this can be changed by showing hidden files

  • Viewing file Contents
    • The cat filenameShow all
    • The head file nameShow the first 10 lines
    • Tail filenameShow the next 10 lines
    • Less filenameDisplay a screen of content, then passleftorjYou can go ahead and check it out,qexit

    through- n numberLimit how many rows to view, for example:

    Cat path -n 14 // View the tail path in the first 14 lines. -n 12 // View the content in the last 12 linesCopy the code

increase

  • Touch the file name
  • Content of the echoWill return the content
  • Echo Content > File namePut the content into the file
  • Echo Content 2 >> File nameAdditional content
  • Echo -e "contents 3\n contents 4"Enter two lines of content
TXT //'>' will overwrite the previous content echo haha >> 4. TXT //'>>' Add content echo -e "hehehhe\n222" >> 4. TXT //'\n' indicates enterCopy the code
  • The mkdir filenameCreate a directory
  • mkdir -p q/b/c/d/eCreating a multi-level directory
  • cp 1.txt 2.txtCopy the 1. TXT file to 2. TXT
  • cp -r a bCopy a directory to b

delete

  • The rm file nameDelete the file
  • rm -rfMandatory delete

change

  • code 1.txtOpen the file to modify
  • start 1.txtOpen with the default program
  • Echo '' > File nameClear file contents
  • mv 1.txt 2.txtChange file 1 to file 2
  • Touch the fileExample Change the update time of a file

To view

  • tldrView common command types
// INSTALL NPM I -g TLDR YARN Global add TLDRCopy the code

Command combination

  • &&Execute the next command after success
Rm 1.txt && echo was deleted successfully. ProcedureCopy the code
  • ;Execute both sentences