当前位置: 代码迷 >> 综合 >> The basics of How to use Linux (如何使用Linux,基础笔记一)
  详细解决方案

The basics of How to use Linux (如何使用Linux,基础笔记一)

热度:17   发布时间:2023-09-30 04:50:50.0

The basics of how to use Linux (Note One)

Outline:
ls - list contents of the directory
file - check the file type
less - look through contents of the file

1. ls

“ls” is a common command used by people, and we can use it to see contents of the directory, directory’s attributes and important files.

1.1. List out all files and sub directories under the current dirctory:
The basics of How to use Linux (如何使用Linux,基础笔记一)
1.2. List contents of a directory or multiple directories
The basics of How to use Linux (如何使用Linux,基础笔记一)The basics of How to use Linux (如何使用Linux,基础笔记一)
1.3. Get more info by using arguements and options
A mojority of commands support to usre the options and arguments, and they adhere after the command.
e.g. The basics of How to use Linux (如何使用Linux,基础笔记一)

e.g. Get more detailed info of contents under the current directory
The basics of How to use Linux (如何使用Linux,基础笔记一)
e.g. Get more more detailed info of contents under the current directory, and contents are listed by the modified time
The basics of How to use Linux (如何使用Linux,基础笔记一)
e.g. Get more more detailed info of contents under the current directory, and contents are listed by the modified time then reverse the order.
The basics of How to use Linux (如何使用Linux,基础笔记一)

The detailed introduction of “ls” 's options and arguments:
The basics of How to use Linux (如何使用Linux,基础笔记一)
1.4. Long format of the file info
e.g. The basics of How to use Linux (如何使用Linux,基础笔记一)
1.4.1. The first char means the type of files:
Begin with “d” : directory
Begin with “-” : a normal file

1.4.2. The access permission:
e.g.
The basics of How to use Linux (如何使用Linux,基础笔记一)
“rw-” owner permission: read, write and non-execute
“r–” group permission: only read
“r–” other permission: only read

1.4.3. The number of hard link:
e.g.
The basics of How to use Linux (如何使用Linux,基础笔记一)
1.4.4. The name of file owner:
e.g.
The basics of How to use Linux (如何使用Linux,基础笔记一)
1.4.5. The name of group users:
The basics of How to use Linux (如何使用Linux,基础笔记一)
1.4.6. The size of a file (byte):
The basics of How to use Linux (如何使用Linux,基础笔记一)
1.4.7. The last modification time:
The basics of How to use Linux (如何使用Linux,基础笔记一)
1.4.8. The name of a file:
The basics of How to use Linux (如何使用Linux,基础笔记一)

2. Check the file type (less)

The file" command can be used to check a file type and get other info. In the unix-like system, there is a saying that everything is file.

The usage:
The basics of How to use Linux (如何使用Linux,基础笔记一)
e.g.
The basics of How to use Linux (如何使用Linux,基础笔记一)

3. Using “less” to look through contents of a file “less” command is a program to look text files.

Tips:
The basics of How to use Linux (如何使用Linux,基础笔记一)
The basics of How to use Linux (如何使用Linux,基础笔记一)
3.1. The usage:
The basics of How to use Linux (如何使用Linux,基础笔记一)
e.g.
The basics of How to use Linux (如何使用Linux,基础笔记一)
The basics of How to use Linux (如何使用Linux,基础笔记一)
if you want to exit the less program, you could click the keyboard with “q”.

3.2. Some function tips for less program
when you are using the less program, you can control the program by these commands.
The basics of How to use Linux (如何使用Linux,基础笔记一)
The basics of How to use Linux (如何使用Linux,基础笔记一)

tips:
The basics of How to use Linux (如何使用Linux,基础笔记一)