Linux most commonly used instruction encyclopedia! Let's see. Do you have it?

Learn programming together~ 2021-06-23 16:49:34
linux commonly used instruction encyclopedia


Linux Many of the common commands in English are required , I'll share it here linux The basic command commonly used when getting started , I hope I can help you .

File directory directive

pwd Instructions

Basic grammar :

pwd

The path used to display the current directory

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

ls Instructions

Basic grammar :

  • ls [ Options ] [ Directory or file ]
  • Common options
  • -a : Display all files and directories in the current directory , Include hidden .
  • -l : Display information as a list , amount to ll

Practical operation cases :

List all the files and directories in the current directory :

 Practical dry goods !!Linux Common command sharing

 

cd Instructions

Basic grammar :

  • cd [ Parameters ]

Function description : Switch to the specified directory

  • Common parameters

Absolute path ( With / The starting list ) And relative path ( A directory that begins with a directory name , Start from the current directory )

cd ~ perhaps cd : Go back to your home directory

cd .. Go back to the previous level of the current directory

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

mkdir command

Basic grammar :

  • mkdir [ Options ] Directory to create
  • Common options

-p : Create multi-level directory

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

rmdir Instructions

Basic grammar :

rmdir Catalog

Function description : Delete an empty directory

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

touch Instructions

Basic grammar :

touch List of file names

Function description : Create one or more empty files

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

cp Instructions

Basic grammar :

  • cp [ Options ] source dest
  • Common options :

-r : Recursively copy entire folder

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

rm Instructions

Basic grammar :

  • rm [ Options ] Files or directories to delete
  • Common options :

-r : Recursively delete entire folder

-f : Force delete without prompting

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

mv Instructions

Basic grammar :

  • mv oldNameFile newNameFile ( Function description : rename )
  • mv /temp/movefile /targetFolder ( Function description : Moving files )

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

cat Instructions

Basic grammar :

  • cat [ Options ] The name of the file to view
  • Common options

-n : According to the line Numbers

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

 Practical dry goods !!Linux Common command sharing

 

 Practical dry goods !!Linux Common command sharing

 

more Instructions

Basic grammar :

more The name of the file to view

Functional specifications :more The instruction is based on VI Editor's text filter , It displays the contents of the text file page by page in a full screen way .

Shortcut key :

 Practical dry goods !!Linux Common command sharing

 

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

less Instructions

Basic grammar :

less The name of the file to view

Functional specifications :less The command is used to view the file content in different screens , Its function and more Instruction similar , But compared to more More powerful instructions , Support various display terminals .less Command when displaying the contents of a file , It is not displayed until the entire file is loaded at one time , Instead, load the content according to the display needs , High efficiency for displaying large files .

Shortcut key :

 Practical dry goods !!Linux Common command sharing

 

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

head Instructions

Basic grammar :

  • head file ( Function description : Default view file header 10 Row content )
  • head -n 5 file ( Function description : View header 5 Row content ,5 Can be any number of lines )

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

tail Instructions

Basic grammar :

  • tail file ( Function description : View the end of the file by default 10 Row content )
  • tail -n 5 file ( Function description : Check the end of the file 5 Row content ,5 Can be any number of lines )

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

echo Instructions

Basic grammar :

echo [ Options ] [ Output content ]

Function is introduced : Output variable or constant content to the console

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

> Instructions

Basic grammar :

View instructions > Target file

Functional specifications : Write the result of the previous view instruction to the target file , If the target file does not exist , The new .

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

>> Instructions

Basic grammar :

View instructions >> Target file

Functional specifications : Append the result of the previous view instruction to the target file , If the target file does not exist , The new .

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

 Practical dry goods !!Linux Common command sharing

 

Time date command

date Instructions

Basic grammar :

1) date( Function description : Display current time )

2) date +%Y( Function description : Show current year )

3) date +%m( Function description : Show current month )

4) date +%d( Function description : Display the current day )

5) date "+%Y-%m-%d %H:%M:%S"( Function description : Display year, month, day, hour, minute and second )

6) date -s String time ( Function description : Setting date )

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

cal Instructions

Basic grammar :

cal [ Options ]( Function description : No option , Show calendar of the month )

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

Search for instructions

find Instructions

find The instruction will recursively traverse its subdirectories from the specified directory , Display the qualified files or directories on the terminal .

Basic grammar :

find [ Search scope ] [ Options ]

Option description :

  • -name: Search by name , Support for wildcards .
  • -user: Search by user name
  • -size: Find by file size

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

 Practical dry goods !!Linux Common command sharing

 

 Practical dry goods !!Linux Common command sharing

 

locate Instructions

Basic grammar :

locate The file name to search for

explain :locate Instruction can quickly locate the file path in the whole system .locate The command uses all the file names and paths in the pre established system locate Fast location of given files based on Database .locate Instructions do not need to traverse the entire file system , Fast query speed . In order to ensure the accuracy of query results , Administrators must update regularly locate moment .

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

grep Instructions

Basic grammar :

  • grep [ Options ] Find the content of the source file for
  • Common options :

-n: Show matching lines and line numbers

-i: Ignore case

explain :grep Filter lookup , Pipe, ,“|”, Indicates that the processing result output of the previous command is passed to the subsequent command processing .

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

Compression and decompression instructions

gzip Instructions

Basic grammar :

gzip file

Functional specifications : Compressed files , Compress the file to *.gz The file is stored in the directory where the original file is located , After successful compression, the original file will be deleted . Used to compress a single file .

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

gunzip Instructions

Basic grammar :

gunzip file

Functional specifications : Extract file command , After decompression, it will be stored in the directory where the original compressed file is located , And delete the original compressed file .

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

zip Instructions

Basic grammar :

  • zip [ Options ] XXX.zip What will be compressed

Function description : Compress the specified file or directory into XXX.zip file , Used to compress all file structures .

  • Option description :

-r: Recursive compression , Compress directory

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

unzip Instructions

Basic grammar :

unzip [ Options ] XXX.zip

Common options :

-d Catalog : Specify the directory to store the extracted files

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

tar Instructions

Basic grammar :

tar [ Options ] XXX.tar.gz [ Packaged content ]

Function description : Package or unzip files

Option description :

  • -c: produce .tar.gz Package files
  • -v: Show details
  • -f: Specify the compressed filename
  • -z: Pack and compress
  • -x: decompression .tar.gz file
  • -C: Specify which directory to unzip to

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

 Practical dry goods !!Linux Common command sharing

 

Group management instruction

Linux Basic introduction of group :

stay linux Each user in must belong to a group , Can't be independent of the group , You can change the user's group .

stay linux Each file in has an owner 、 Group in 、 Other groups , You can also change the file group .

file / Owner of directory

It's usually the creator of the document , Who created the file , Naturally become the owner of the file , By default, the owner's group is the same as the file's group .

View the file owner and group instructions

Basic grammar :

ls –ahl file name

(a-all,h-human,l-list)

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

Modify file owner instructions

Basic grammar :

chown New owners file name

chown newowner:newgroup file Modify the user's owner and all groups at the same time

-R If it is a directory, it makes all the sub files or directories under it recursively effective

Functional specifications : Change the file owner to the specified user .

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

Modify the group instruction of the file

Basic grammar :

chgrp New group name file name

-R If it is a directory, it makes all the sub files or directories under it recursively effective

Function description : Change the file group to the specified group

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

Rights management instructions

Basic introduction of authority

The permissions mentioned here are file and directory permissions . stay Linux in , Every file and directory has its own access rights , Through the file list, you can see .

 Practical dry goods !!Linux Common command sharing

 

RWX Detailed explanation of authority

rwx Apply to documents

1) [ r ] Representative readable (read): Can read , see

2) [ w ] Representative may write (write): You can modify , But it doesn't mean that you can delete the file , The prerequisite for deleting a file is to have write permission to the directory where the file is located , To delete the file .

3) [ x ] Representative executable (execute): Can be executed

rwx To the directory

1) [ r ] Representative readable (read): Can read ,ls View directory contents

2) [ w ] Representative may write (write): You can modify , Create... In directory + Delete + Rename Directory

3) [ x ] Representative executable (execute): You can go to the directory

rwx Show by number

r=4( namely 2²),w=2( namely 2¹),x=1( namely 2º)

Rights management instructions

Modify file / Directory permission instructions chmod

The first way : adopt r、w、x Change authority

1) chmod u=rwx,g=rx,o=x File directory name

2) chmod o+w File directory name

3) chmod a-x File directory name

explain :u、g、o、a Each represents the owner of the file 、 Users in the file group 、 Other groups of users 、 All users =、+、- They represent setting permissions 、 Increase the permissions 、 Remove authority

The second way : Change authority by number

chmod A set of three numbers File directory name

explain :r=4 w=2 x=1 rwx=4+2+1=7

Practical operation cases :

 Practical dry goods !!Linux Common command sharing

 

 Practical dry goods !!Linux Common command sharing

 

 Practical dry goods !!Linux Common command sharing

 

 Practical dry goods !!Linux Common command sharing
版权声明
本文为[Learn programming together~]所创,转载请带上原文链接,感谢
https://javamana.com/2021/06/20210623164707190Z.html

  1. 【计算机网络 12(1),尚学堂马士兵Java视频教程
  2. 【程序猿历程,史上最全的Java面试题集锦在这里
  3. 【程序猿历程(1),Javaweb视频教程百度云
  4. Notes on MySQL 45 lectures (1-7)
  5. [computer network 12 (1), Shang Xuetang Ma soldier java video tutorial
  6. The most complete collection of Java interview questions in history is here
  7. [process of program ape (1), JavaWeb video tutorial, baidu cloud
  8. Notes on MySQL 45 lectures (1-7)
  9. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  10. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  11. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  12. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  13. 【递归,Java传智播客笔记
  14. [recursion, Java intelligence podcast notes
  15. [adhere to painting for 386 days] the beginning of spring of 24 solar terms
  16. K8S系列第八篇(Service、EndPoints以及高可用kubeadm部署)
  17. K8s Series Part 8 (service, endpoints and high availability kubeadm deployment)
  18. 【重识 HTML (3),350道Java面试真题分享
  19. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  20. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  21. [re recognize HTML (3) and share 350 real Java interview questions
  22. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  23. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  24. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  25. RPC 1: how to develop RPC framework from scratch
  26. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  27. RPC 1: how to develop RPC framework from scratch
  28. 一次性捋清楚吧,对乱糟糟的,Spring事务扩展机制
  29. 一文彻底弄懂如何选择抽象类还是接口,连续四年百度Java岗必问面试题
  30. Redis常用命令
  31. 一双拖鞋引发的血案,狂神说Java系列笔记
  32. 一、mysql基础安装
  33. 一位程序员的独白:尽管我一生坎坷,Java框架面试基础
  34. Clear it all at once. For the messy, spring transaction extension mechanism
  35. A thorough understanding of how to choose abstract classes or interfaces, baidu Java post must ask interview questions for four consecutive years
  36. Redis common commands
  37. A pair of slippers triggered the murder, crazy God said java series notes
  38. 1、 MySQL basic installation
  39. Monologue of a programmer: despite my ups and downs in my life, Java framework is the foundation of interview
  40. 【大厂面试】三面三问Spring循环依赖,请一定要把这篇看完(建议收藏)
  41. 一线互联网企业中,springboot入门项目
  42. 一篇文带你入门SSM框架Spring开发,帮你快速拿Offer
  43. 【面试资料】Java全集、微服务、大数据、数据结构与算法、机器学习知识最全总结,283页pdf
  44. 【leetcode刷题】24.数组中重复的数字——Java版
  45. 【leetcode刷题】23.对称二叉树——Java版
  46. 【leetcode刷题】22.二叉树的中序遍历——Java版
  47. 【leetcode刷题】21.三数之和——Java版
  48. 【leetcode刷题】20.最长回文子串——Java版
  49. 【leetcode刷题】19.回文链表——Java版
  50. 【leetcode刷题】18.反转链表——Java版
  51. 【leetcode刷题】17.相交链表——Java&python版
  52. 【leetcode刷题】16.环形链表——Java版
  53. 【leetcode刷题】15.汉明距离——Java版
  54. 【leetcode刷题】14.找到所有数组中消失的数字——Java版
  55. 【leetcode刷题】13.比特位计数——Java版
  56. oracle控制用户权限命令
  57. 三年Java开发,继阿里,鲁班二期Java架构师
  58. Oracle必须要启动的服务
  59. 万字长文!深入剖析HashMap,Java基础笔试题大全带答案
  60. 一问Kafka就心慌?我却凭着这份,图灵学院vip课程百度云