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:
1.2. List contents of a directory or multiple directories
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.
e.g. Get more detailed info of contents under the current directory
e.g. Get more more detailed info of contents under the current directory, and contents are listed by the modified time
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 detailed introduction of “ls” 's options and arguments:
1.4. Long format of the file info
e.g.
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.
“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.
1.4.4. The name of file owner:
e.g.
1.4.5. The name of group users:
1.4.6. The size of a file (byte):
1.4.7. The last modification time:
1.4.8. The name of a file:
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:
e.g.
3. Using “less” to look through contents of a file “less” command is a program to look text files.
Tips:
3.1. The usage:
e.g.
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.
tips: