Linux learning (6) - the mount command

table of Contents

Queries and automatically mount

Mount Command Format

Mount CD

Uninstall command

Mount U disk

View user login information

Query currently logged in and logged user information in the past

See all the user's last login time


 

Video tutorial lesson but learning Mu: https://www.imooc.com/video/4443

This section summarizes the study and made notes.

 

Queries and automatically mount

Mount (that is, assign a drive letter in Windows)

Insert U disk assign a drive letter in Windows is automatic, and requires manual execution Linux distribution.

grammar:

mount
	查询系统中已经挂载的设备
mount -a
	根据配置文件/etc/fstab的内容,自动挂载

Example 1: mount command , query system has been mounted equipment.

It is not recommended to use automatically mount, once mounted automatically every time you start the U disk or CD-ROM will be checked, if not, then the system will collapse.

 

Mount Command Format

mount [-t 文件系统] [-o 特殊选项] 设备文件名 挂载点
	选项:
		-t 文件系统:加入文件系统类型来指定挂载的类型,可以ext3、ext4、iso9660等文件系统
		-o 特殊选项:可以指定挂载的额外选项 

 

Mount CD

mkdir /mnt/cdrom/
	建立挂载点,任何一个空目录都可以做挂载点。
mount -t iso9660 /dev/sr0 /mnt/cdrom/
	挂载光盘。其中"-t iso9960"可以省略。正确挂载”mounting read-only",去"/mnt/cdrom/"下查看。“/dev/sr0”是光盘设备名,是系统固定的。

Example 1: mount -t iso9660 / dev / sr0 / mnt / cdrom / command , optical disc mount.

 

Uninstall command

grammar:

umount 设备名或挂载点
	如:umount /mnt/cdrom,卸载光盘的挂载

Example 1: umount / dev / sr0 command , unload the optical disk apparatus.

After using the disc must be unloaded.

 

Mount U disk

fdisk -l
	查看U盘设备文件名
mount -t vfat /dev/sdb1 /mnt/usb/
        挂载U盘设备。vfat是U盘设备
	注意:Linux默认是不支持NTFS文件系统的。可以通过安装ntf -3g来支持NTFS。

Example 1: fdisk -l command to view the device file name

 

View user login information

w command syntax:

w 用户名
	命令输出:
		USER: 登录的用户名;
		TTY: 登陆终端;
		FROM: 从哪个IP地址登陆;
		LOGIN@: 登陆时间;
		IDLE: 用户闲置时间;
		JCPU: 指的是和该终端连接的所有进程占用的时间。这个时间里并不包括过去的后台作业时间,但却包括当前正在运行的后台作业所占用的时间;
		PCPU: 指的是当前进程所占用的时间;
		WHAT: 当前正在运行的命令

Example 1: w command to view the user's login information

w see which users are logged in and a number of resource consumption.

who command syntax:

who 用户名
	命令输出:
		- 用户名
		- 登录终端
		- 登录时间(登录来源IP地址)

Example 1: who command to view the user login information, the information displayed by the command w ratio less.

see which users who log on.

 

Query currently logged in and logged user information in the past

grammar:

last
	查询当前登录和过去登录的用户信息。last命令默认是读取/var/log/wtmp文件数据。
	命令输出:
		- 用户名
		- 登录终端
		- 登录IP
		- 登录时间
		- 退出时间(在线时间)

Example 1: last command to see the last login user information

 

See all the user's last login time

grammar:

lastlog
	查询所有用户的最后一次登录时间。lastlog命令默认是读取/var/log/lastlog文件内容。
	命令输出:
		- 用户名
		- 登录终端
		- 登录IP
		- 最后一次登录时间

The log file can not view, to avoid human modification.

Example 1: lastlog command to see the last login time for all users.

Published 500 original articles · won praise 77 · views 160 000 +

Guess you like

Origin blog.csdn.net/cnds123321/article/details/104982162