Linux Operating System

Posted by veenasv on Wed, 09 Mar 2022 18:27:31 +0100

Introduction to the linux operating system:
We often use the Windows operating system in our daily life, so what is this linux operating system?
Linux, fully known as GNU/Linux, is a free-to-use and free-to-disseminate UNIX-like operating system. Its kernel was first released on October 5, 1991 by Linus Benedict Towaz. Inspired by the ideas of Minix and Unix, it is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system. It runs major Unix tool software, applications, and network protocols. It supports 32-bit and 64-bit hardware. Linux inherits the Unix network-centric design idea and is a stable multi-user network operating system.
In short: we can equate windows with linux, but the windows operating systems we are familiar with are graphical, and the Linux operating systems we learn and use most of the time are commands. But you don't need to worry, we can try to understand the structure of the Linux operating system and master the common operating commands.

Linux OS architecture:

In fact, we can clearly see the structure of the linux system through pictures
The linux system can be interpreted as time-graded. First of all, [Root/] is divided into / bin, / boot, / dev and so on, depending on the system content stored in the root directory. There are other subdirectories under these subdirectories, such as / root/Maildir. In fact, I don't think we need to "memorize hard" what's stored in these folders for the structure. Mainly or often, increase your "feel"

	[Focus) linux Operational commands
	 1,Command to switch paths: cd     
	 			Usage method: cd   [Route]    You can switch to a specified path
	 								For example, switch to the root path: cd /    
	 								Switch to parent path: cd ..
	 								Switch to Home Directory: cd ~
	 2,Commands that show information along the path: ls perhaps ll
	             Usage method: ls -[parameter]
	             have access to ls perhaps ll View the file information under the current path, and the command can also be used with attached conditions
	                ls-l: View file properties      ls -ld  View the properties of the specified file   ls-lh: File properties and size
	                When viewing a file, it may be possible to hide a part of the file if there is a "."Then the file is hidden) ls - a View
	   3,New folder: mkdir
	                      mkdir   Name      Create a new folder with that name
	4,New file: touch
	                    touch  file name    Create a file with the specified file name
	                    [Create a new file if the file with that name does not already exist, and change the update time of the file if the file with that name already exists.)

		5,Show the current path: pwd
		6,Copy file: cp
				Grammar: cp  Source File Target File
						-i   You can give a user hint whether to overwrite when copying
						in use cp When assigning directories, add-r  And if it's a value directory, it copies everything under the directory tree
		7,Move: mv
				Grammar: mv Source File Target File
				Files can be moved or renamed
				If the paths of the source and destination files are identical but the file names are inconsistent, the file names will be changed
		8,Delete: rm   Singular note rm Used to delete directories if you want to delete files rm -rf file name
				-r  Use this command to delete oysters
				-f  Force deletion without prompting
		9,Delete empty directories: rmdir
		10,System time: time
		11,View the contents of the file: tail
		12,View the contents of the file: less
		13,Edit file: vim
		14,Show the contents of the file: cat
		15,Help Assistant: help perhaps man
		16,Change permissions: chmod Change permissions (note that linux Operation in System(x)Permission value is 1, write(w)Permission value is 2, read(r)Operational value is 4)

ls-l can be used to view user permissions

		17,Pack/Unpack- tar				
			#Package file tar-cvf Package file. The file/path where tar is packaged...
			#Unpack file tar-xvf package file. Tar
							[tar Commands are only responsible for packaging, but not compression)
		18,compress/Decompression - gzip
			#Compressed file gzip-zcvf packaged file. gz compressed files/directories
			#Unzip the packaged file gzip-zxvf. gz
			#Unzip to the specified directory gzip-zxvf package file. Gz-C Specified Directory
		19,Network connection: ping
		20,See cpu: top-See CPU,Real-time continuous monitoring system trip
		21,View memory usage: free
		22,df: Common commands for checking disk space usage for file systems: df -lh
		23,ps: View process information
					View all processes: ps -aux

[linux Advanced Section: The Three Swordsmen and the Shallow Pipeline of linux]


1. What is a pipeline: Pipeline is a way of transferring data in Linux system. Linux provides a pipeline character'|'to separate two commands, then the output of the command on the left side of the pipeline character will be used as input to the command on the right side of the pipeline character

**

One of the three swordsmen: grep

**
The grep command can be used with regular expressions to find specific types of data in a linux system
[Expansion: Regular Expression]
Address for online exercises:
Online Regular Expression Test (oschina.net)

Grammar for grep:
grep [options] parttern [file...]
Common options:
-v Displays rows that are not matched by a parttern
-i Ignore character case
-n Displays matching line numbers
-c Statistics Match Rows
-o Displays only matched strings
-E uses ERE, equivalent to egrep
Examples used:

**

One of the three swordsmen:sed

**
sed is a stream editor that processes content line by line
sed syntax:

	sed [-hn] [-e<script>] [-f<script file>] [text file]
	
		-h: Show help
		-n: Show Only script Result after processing
		-e<script>As specified in the option script To process the input text file
		-f<script file>As specified in the option acript File to process input text
		-g:Represent Global

		Replace Back with Front
		Insert is inserted after the specified line
		New is added before the specified line


It is important to note that sed does not operate on the source file, it is based on the schema space when modifying the file, and the -i parameter is used when modifying the source file.

One of the three swordsmen: awk**

Read the file line by line, slice each line with a space as the default delimiter, and process the cut sections

awk syntax:

	awk 'pattern + action [filenames]'
		-pattern  regular expression
		-action  Commands executed on matched content (default output per line)


Demonstrate usage examples

Topics: Linux