Linux instructions

1. cd /home to enter the /home main directory

2. cd ../ returns to the previous directory

3. cd ./ returns to the current directory

4. ls -a View all files, including hidden files, files starting with .

5. pwd displays the current directory.

6. mkdir directory name; only one directory can be created

     mkdir -p test1/test2/test3 ;-p means that multi-level directories can be built

     mkdir -m 777 test; -m indicates that creating a directory is directly adding permissions

7, rmdir directory name; delete an empty directory

      rmdir -p directory name; -p deletes along with the blank directory above

      rmdir -r directory name; -r delete all contents in the directory

      rm delete files or directories;  

8. rm delete file: rm -rf file name;

      rm -r file name; -r means recursive deletion, most commonly used in directory deletion

      rm -f filename; -f if the target file already exists, do not ask, force overwrite

9. cp copy file: cp original file name new file name; copy and rename

       cp -p filename; -p copies along with file attributes

       cp -d file name; -d means that the original source file is a link file attribute, then copy the link file attribute, not the source file itself

       cp -r file name; -r means recursive continuous copying for directory copying behavior

       cp -a filename; -a means -pdr

       cp -i file name; -i means that if the target file exists, the action will be asked first when overwriting

10. View all current files:

       ls -l directory; -l displays file attributes and permissions

       ls -a directory; -a shows all files, including hidden files

       ls --full-time directory; display full time

       ls -R directory; display together with the contents of subdirectories, which is equivalent to displaying all contents in the directory

       ls -t directory; display chronologically

       ls -S directory; display by size

11. Move file: mv file name; mv old file name new file name; modify file name
       mv -f filename; if the target file already exists, do not ask, force overwrite
       mv -i filename; if the target file already exists, it will ask whether to overwrite
       mv -u file name; if the target file already exists and the source is relatively new, it will be updated







Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324788089&siteId=291194637