70条常用Linux命令,助你完成小白到大神的转变

2019-07-3109:39:09服务器及运维Comments2,179 views字数 5479阅读模式
70条常用Linux命令,助你完成小白到大神的转变

[root@ping ~]# tree -L 1 /文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

#使用tree 命令查看根目录下的一层的目录结构文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

ls - list directory contents文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# ls -l /文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

以长格式显示文件和目录的信息文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# ls -d /文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

显示目录和文件文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# ls -d /*文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

根目录下的所有的目录和文件文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

cd - Change the shell working directory文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cd -文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

上次一次所在的目录文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping /]# cd .文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

当前目录文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cd ..文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

这个目录的上一次目录文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping /]# cd ~文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

当前用户的家目录文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

pwd - Print the name of the current working directory.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# pwd文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看当前所处的目录文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

cp - copy files and directories文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cp文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

拷贝文件或目录文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

alias - Define or display aliases文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# alias rm ="mv"文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

定义别名alies 为mv 命令文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

unalias - Remove each NAME from the list of defined aliases文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# alias文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

alias -rf='you want remvoe files or directories to mv'文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

alias cp='cp -i'文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

alias l.='ls -d .* --color=auto'文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

alias ll='ls -l --color=auto'文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

alias ls='ls --color=auto'文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

alias mv='mv -i'文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# unalias mv文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

取消mv这个别名文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

cat - concatenate files and print on the standard output文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cat -n /root/.bashrc文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看文件内容并列出行号文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

find - search for files in a directory hierarchy文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

option:!取反、-a(and)并且、-o(or)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# find / -type f -name "useradd"文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查找根目录下文件类型为文本文件并且包含名字是"useradd" 的文件路径文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

head - output the first part of files文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# head /etc/services文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

默认查看文件前十行内容文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

tail - output the last part of files文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# tail /etc/passwd文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

默认查看文件后十行内容文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# tail -f /var/log/messages文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看文件动态更新的内容文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

rpm - RPM Package Manager文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# rpm -ivh /mnt/Packages/elinks.el6_3.x86_64.rpm文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

安装显示输出rpm软件包情况文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# rpm -qa | grep mysql文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看当前系统安装关于"mysql"的rpm包名文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

yum - Yellowdog Updater Modified文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# yum -y install ftp文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

用yum安装ftp管理工具文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# yum grouplist文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看当前系统已经安装和可以安装的包组文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# yum -y groupinstall PostgreSQL 数据库服务器文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

向当前系统中安装一组软件包文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# yum info文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

显示关于软件包或组的详细信息文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# yum groupinfo文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看yum和各个参数的详细信息文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# yum serache all文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

在软件包详细信息中搜索指定字符串文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

seq - print a sequence of numbers文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# seq 5文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

生成序列从1到5的数字文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# seq 3 5文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

生成序列从3到5的数字文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# seq 3 3 10文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

生成序列3到10中间隔多少个数字文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# seq -s "" 5文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

12345文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

-s指定分隔符为空文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# seq -w 10文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

生成两位数的数字并对齐文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

hostname - show or set the system’s host name文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# hostname文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

ping文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

显示系统主机名文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

uname - print system information文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# uname -r文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

2.6.32-573.el6.x86_64文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

显示当前系统的内核版本和操作系统位数文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# uname -a文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

Linux ping 2.6.32-573.el6.x86_64 #1 SMP Wed Jul 1 18:23:37 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

显示当前系统的所有版本信息文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# uname -m文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

x86_64文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

显示当前系统的操作系统位数文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

whoami - print effective userid文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# whoami文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

root文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看当前登录系统的用户名文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

su - run a shell with substitute user and group IDs文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# su - ping文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

切换普通用户为ping文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

logout - Exit a login shell文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# logout文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

退出当前登录shell文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

history - Display or manipulate the history list文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# history文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看当前用户输入命令的历史记录文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# history -d 122文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

指定122行的命令历史记录清除文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# history -c文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

清除当前用户输入命令所有历史记录文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

runlevel - output previous and current runlevel文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# runlevel文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

N 3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看当前系统的运行级别文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

init - Upstart process management daemon文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# init 5文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

切换当前系统的运行级别文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

chkconfig - updates and queries runlevel information for system services文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# chkconfig sshd on文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

使ssh服务开机自启动文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# chkconfig --list sshd文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看ssh服务在每一个运行级别是否为开机自启动文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

which - shows the full path of (shell) commands文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# which ps文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

搜索ps命令的绝对路径文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

whereis - locate the binary, source, and manual page files for a com-mand文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# whereis jobs文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

搜索命令的文件所在的绝对路径文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# whereis -b ping文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

只搜索命令的二进制文件的绝对路径文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

开户网卡和重新读取配置文件文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# ifdown eth0 && ifup eth0 ==》 [root@ping ~]# /etc/init.d/network reload文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

blkid - command-line utility to locate/print block device attributes文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# blkid文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看当前系统块设备的UUID号文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

BASH_BUILTINS(1)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

alias, bg, bind, break, builtin, caller, cd, command,文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

compgen, complete, compopt, continue, declare, dirs, disown, echo,enable, eval, exec, exit, export, false, fc, fg, getopts, hash, help,history, jobs, kill, let, local, logout, mapfile, popd, printf, pushd,pwd, read, readonly, return, set, shift, shopt, source, suspend, test,times, trap, true, type, typeset, ulimit, umask, unalias, unset, wait文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

#Linux中所有的内置命令,我们说which只能在PATH变量中搜索命令的绝对路径,内置命令是内置在bash中的,所以我们找不到文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

DEVICE=eth0 #《==物理设备名,eth1表示第2块网卡文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

ONBOOT=yes #《==控制网卡是否为开机自启动文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

NM_CONTROLLED=yes #《==是一个可以让networkmanage管理的工具文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

BOOTPROTO=none #《==其中,proto取下列值这一:none,引导时不使用 协议;static静态分配地址;bootp,使用bootp协议文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

使用dhcp协议文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

IPADDR=192.168.114.5 #《==ip address是IP地址文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

netmask=255.255.255.0 #《==子网掩码,划分网络位和主机位。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

resolv.conf - resolver configuration file文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cat /etc/resolv.conf文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

#DNS的客户端文件,DNS在网卡的文件中也可以配置文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cat /etc/resolv.conf文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

nameserver 8.8.8.8文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

nameserver 202.106.0.20文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

#一般最好配置两个DNS,一个主,一个备文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

# 不要配置网卡里设置DNS优先于/etc/resolv.conf文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

小结:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

1、客户端DNS可以在网卡配置文件里设置(ifcfg-eth0)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

2、客户端DNS也可以在/etc/resolv.conf里设置文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

3、网卡里的设置DNS优先于/etc/resolv.conf文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

hosts - The static table lookup for hostnames文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cat /etc/hosts文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

#设定用户IP与名字(或域名)的对应解析表,相当于本地LAN局域网内的DNS文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

对应windows的文件路径:C:\Windows\System32\drivers\etc\hosts文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

/etc/hosts:局域网 主机名和ip地址的解析,相当于DNS工具文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

hosts企业里的作用:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

1.开发、产品、测试等人员,用于通过正式的域名测试产品文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

2.服务器之间的调用可以用域名(内部DNS),方便迁移文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cat /etc/sysconfig/network文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

#配置主机的主机名的配置文件文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

fstab - static information about the filesystems文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# cat /etc/fstab文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

设置文件系统挂载信息的文件,使得开机自动挂载磁盘分区文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

The third field:such as adfs, affs, autofs,coda, coherent, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660,jfs, minix, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs,smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xenix, xfs, and possiblyothers.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

包含了所有的Linux文件系统类型文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

df - report file system disk space usage文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# df -h文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

#以人类可读的信息查看磁盘挂载信息文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

mount - mount a filesystem文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# mount文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

查看当前系统中所使用的文件系统类型文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# mount -t ext4 -o loop,noatime,noexec /dev/sdb1 /mnt文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

-o 参数:noatime,noexec不改变时间戳,不改变命令文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

手动挂载一个文件系统文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

挂载:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

1.命令文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# mount -t ext4 -o noexec /dev/sdb1 /mnt文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

2.文件文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# vim /etc/fstab文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

dd - convert and copy a file文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# dd if=/dev/zero of=/dev/sdb1 bs=4096 count=10文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

生成一个文件系统文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

mke2fs - create an ext2/ext3/ext4 filesystem文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# mkfs.ext4 /dev/sdb1文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

格式化文件系统/dev/sdb1文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

测试手动挂载:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

1.创建一个虚拟的块设备文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

dd if=/dev/zero of=/dev/sdb1 bs=4906 count=100文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

2.格式化文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

mkfs.ext4 /dev/sdb1文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

3.挂载文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

mount -t ext4 -o loop,noatime,noexec /dev/sda1 /mnt文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

fsck - check and repair a Linux file system文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

[root@ping ~]# fsck -A /dev/sda文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

磁盘检查(不要检查好磁盘),卸载的状态检查文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html

文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/14658.html
  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/yunwei/14658.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定