Introduction to Linux (1) ----Linxu commonly used commands

1. Introduction to Linux file system structure

Know the Linux command line mode: The command line execution mode is fast and stable; the command interpreter in Linux is Shell.

a. Why do we need to learn Shell

The Linux system is mainly composed of four parts

1. Linux directory structure

a. / root directory, the top of the file, /etc /bin /dev /lib, etc.;
b. /bin–> stores important commands required by the system, such as file or directory operation commands ls cp mkdir, etc.;
c. / boot–>stores the important core files needed by the kernel and boot system programs when Linux starts. The kernel files and the grub system boot manager are in this directory;
d. /dev–>stores all the device files, CD-ROMs, disks, etc. under the Linux system , Accessing a file in this directory is equivalent to accessing a hardware device, commonly used mount optical drive;
e. /etc–>Generally store system configuration files, as the directory read by default configuration files when some software starts;
f. / home–>The default user home directory of the system;
g. /lib–>64-bit systems have a /lib64 folder, which mainly stores dynamic link libraries;
h. /mnt–> is used to store the mount directory for mounting storage devices, such as CD-ROM, disk, etc.;
i. /proc–>store operating system information such as process information, kernel information, network information, etc.;
j. /root–>Linux super-privileged user root home directory;
k. /sbin–> Store some system management commands, which can only be executed by the super user root;
l. /tmp–>temporary file directory, anyone can access;
m. /usr–>application storage directory, such as commands, help files, etc.;
n. /var–>The contents of the directory are frequently changed and used to store system logs;
o. /sys–>This is similar to /proc, which is a virtual file system that mainly records information related to the core of the system. This directory is actually Does not occupy hard disk space.

2. System core composition

The core that commands the stable and orderly operation of the Linux system is the Linux kernel, which is equivalent to the "brain" of Linux, and the Linux operating system is continuously developed on the Linux kernel. The high reliability and high stability of the Linux system are all in terms of the kernel.

A complete Linux kernel generally consists of 5 parts: memory management, process management, inter-process management, virtual file system and network interface.

a.内存管理:主要完成的是如何合理有效地管理整个系统的物理内存,同时快速响应内核各个子系统对内存分配的请求。Linux内存管理支持虚拟内存,即在系统上运行的所有程序占用的内存总量可以大于实际物理内存。
b.进程管理:主要控制系统进程对CPU的访问,当需要某个进程运行时,由进程调试器根据基于优先级的调试算法启动新的进程,Linux支持多任务运行。
c.进程间通信:主要用于控制进程之间在用户空间的同步、数据共享和交换。
d.虚拟文件系统:Linux内核中的虚拟文件系统用一个通用的文件模型表示各种不同的文件系统,这个文件模型屏蔽很多具体文件系统的差异,使Linux内核支持很多不同的文件系统。虚拟文件系统可以分为:逻辑文件系统和设备驱动程序。逻辑文件系统指Linux所支持文件系统,如ext2 ext3 xfs fat等,设备驱动程序指每一种硬件控制器所编写的设备驱动程序模块。
e.网络接口:提供对种网络标准的实现和各种网络硬件支持。网络接口:网络协议和网络设备驱动程序。

Two, Linux commonly used commands and usage skills

1. Shell command syntax analysis

shell命令格式
用户登录系统成功之后,shell命令启动。shell遵循一定的语法格式将用户输入的命令进行分析解释并传递给系统内核 。shell命令一般格式为:
command		[options]		[arguments]
command	-->表示命令的名称
[options]-->表示命令的选项
[arguments]-->表示命令的参数

在命令行中,选项包含一个或多个字母的时候,主要用于改变命令的执行方式。一般选项前面有一个

The "-" symbol is used to distinguish parameters. For example:
vico@ubuntu:~$ ls -a------>show hidden files
vico@ubuntu:~$ ls ------>do not show hidden files

2. The wildcard of the shell

主要是为了方便用户对文件或者目录的描述。
bash中常用的通配符有* ? []三种:
*--->匹配任何一个或多个字符;
?--->匹配任意单一字符;
[]--->匹配任何包含在方括号内的单字符;

3. System management and maintenance commands (commonly used)

	a.ls命令:命令显示指定工作目录下内容,列出工作目录所含的文件及子目录。
	b.pwd命令:显示当前的工作目录,执行pwd命令可立刻得知目录所在的工作目录的绝对路径名称。
	c.cd命令:改变当前工作目录,其用法与windows下的cd一样的。
	d.date命令:显示或修改系统时间与日期。
	e.passwd命令:用于设置用户密码:普通用户要修改自己的密码passwd;超级用户root修改某个用户的密码,passwd 用户名。
	f.su命令:主要用于改变用户身份。
	vico@ubuntu:~$ su root
	Password: 
	root@ubuntu:/home/vico# 

	g.clear命令:清除屏幕的信息。 

	i.man命令:显示指定命令的帮助信息。 

	j.who命令:显示目前登录到系统用户。
	root@ubuntu:/home/vico# who
	vico     :0           2020-07-24 05:06 (:0)

	k.w命令:用于显示登录到系统的用户信息。
	root@ubuntu:/home/vico# w
	06:38:20 up  1:33,  1 user,  load average: 0.00, 0.02, 0.01
	USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
	vico     :0       :0               05:06   ?xdm?   1:36   0.01s /usr/li

	l.uname命令:用来显示操作系统相关信息。
	root@ubuntu:/home/vico# uname -a
	Linux ubuntu 5.3.0-62-generic #56-Ubuntu SMP Tue Jun 23 11:20:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
	
	m.last命令:列出目录与过去登入系统用户的相关信息。
	n.ps命令:显示系统进程在瞬间的运行动态。

4. File management and editing commands (commonly used)

	a.mkdir命令:创建一个目录。

	b.cat命令:用来将文件的内容输出到标准输出终端。

	c.rm命令:用来删除某个目录及其下的所有文件及子目录。
	
	d.file命令:用来显示文件的类型。

	e.cp命令:将给出的文件或者目录复制到另一个文件或目录中。

	f.mv命令:用来将文件或目录改名或将文件由一个目录移到另一个目录中。

5. Compression and decompression commands (commonly used)

a.zip/unzip command: Compress or decompress common files or directories, and generate a compressed package with a .zip suffix by default.
b.gzip/gunzip command: Compress or decompress common files, and the default extension of compressed files is .gz.

6. Disk management and maintenance commands (commonly used)

a.df command: used to check the disk space occupation of the Linux system.

b.du command: used to display the disk space occupied by files or directories.

7. Network setting and maintenance commands (commonly used)

a.ifconfig command: used to configure the network or display the current network interface status.

b.netstat command: display the local network connection, running products and routing table information.

Guess you like

Origin blog.csdn.net/qq_44519484/article/details/114241385