mirror of
https://github.com/JasonsGong/JasonsGong.github.io.git
synced 2024-11-24 09:49:35 +08:00
659 lines
68 KiB
HTML
659 lines
68 KiB
HTML
<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>Linux从入门到进阶 | The Blog</title><meta name="author" content="Jason"><meta name="copyright" content="Jason"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="本篇博客转载于传智播客黑马程序员,只作在线笔记使用,详细的课程资料请关注黑马程序员! Linux相关的书籍: 技术书籍-Linux指令大全 | The Blog (qingling.icu) 一.初识Linux Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网">
|
||
<meta property="og:type" content="article">
|
||
<meta property="og:title" content="Linux从入门到进阶">
|
||
<meta property="og:url" content="https://qingling.icu/posts/8957.html">
|
||
<meta property="og:site_name" content="The Blog">
|
||
<meta property="og:description" content="本篇博客转载于传智播客黑马程序员,只作在线笔记使用,详细的课程资料请关注黑马程序员! Linux相关的书籍: 技术书籍-Linux指令大全 | The Blog (qingling.icu) 一.初识Linux Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网">
|
||
<meta property="og:locale" content="zh_CN">
|
||
<meta property="og:image" content="https://qingling.icu/img/8.png">
|
||
<meta property="article:published_time" content="2023-09-19T13:41:55.000Z">
|
||
<meta property="article:modified_time" content="2024-05-10T05:31:11.691Z">
|
||
<meta property="article:author" content="Jason">
|
||
<meta property="article:tag" content="Linux">
|
||
<meta name="twitter:card" content="summary">
|
||
<meta name="twitter:image" content="https://qingling.icu/img/8.png"><link rel="shortcut icon" href="/img/%E5%9B%BE%E6%A0%87.png"><link rel="canonical" href="https://qingling.icu/posts/8957.html"><link rel="preconnect" href="//fastly.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="/cdn/icon/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="/cdn/css/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="/cdn/css/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
|
||
root: '/',
|
||
algolia: undefined,
|
||
localSearch: {"path":"/search.xml","preload":true,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"找不到您查询的内容:${query}","hits_stats":"共找到 ${hits} 篇文章"}},
|
||
translate: undefined,
|
||
noticeOutdate: undefined,
|
||
highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":400},
|
||
copy: {
|
||
success: '复制成功',
|
||
error: '复制错误',
|
||
noSupport: '浏览器不支持'
|
||
},
|
||
relativeDate: {
|
||
homepage: true,
|
||
post: true
|
||
},
|
||
runtime: '天',
|
||
dateSuffix: {
|
||
just: '刚刚',
|
||
min: '分钟前',
|
||
hour: '小时前',
|
||
day: '天前',
|
||
month: '个月前'
|
||
},
|
||
copyright: undefined,
|
||
lightbox: 'mediumZoom',
|
||
Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#006650","bgDark":"#006650","position":"top-center"},
|
||
source: {
|
||
justifiedGallery: {
|
||
js: 'https://fastly.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
|
||
css: 'https://fastly.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
|
||
}
|
||
},
|
||
isPhotoFigcaption: false,
|
||
islazyload: false,
|
||
isAnchor: true,
|
||
percent: {
|
||
toc: true,
|
||
rightside: false,
|
||
},
|
||
autoDarkmode: true
|
||
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
|
||
title: 'Linux从入门到进阶',
|
||
isPost: true,
|
||
isHome: false,
|
||
isHighlightShrink: false,
|
||
isToc: true,
|
||
postUpdate: '2024-05-10 13:31:11'
|
||
}</script><noscript><style type="text/css">
|
||
#nav {
|
||
opacity: 1
|
||
}
|
||
.justified-gallery img {
|
||
opacity: 1
|
||
}
|
||
|
||
#recent-posts time,
|
||
#post-meta time {
|
||
display: inline !important
|
||
}
|
||
</style></noscript><script>(win=>{
|
||
win.saveToLocal = {
|
||
set: function setWithExpiry(key, value, ttl) {
|
||
if (ttl === 0) return
|
||
const now = new Date()
|
||
const expiryDay = ttl * 86400000
|
||
const item = {
|
||
value: value,
|
||
expiry: now.getTime() + expiryDay,
|
||
}
|
||
localStorage.setItem(key, JSON.stringify(item))
|
||
},
|
||
|
||
get: function getWithExpiry(key) {
|
||
const itemStr = localStorage.getItem(key)
|
||
|
||
if (!itemStr) {
|
||
return undefined
|
||
}
|
||
const item = JSON.parse(itemStr)
|
||
const now = new Date()
|
||
|
||
if (now.getTime() > item.expiry) {
|
||
localStorage.removeItem(key)
|
||
return undefined
|
||
}
|
||
return item.value
|
||
}
|
||
}
|
||
|
||
win.getScript = url => new Promise((resolve, reject) => {
|
||
const script = document.createElement('script')
|
||
script.src = url
|
||
script.async = true
|
||
script.onerror = reject
|
||
script.onload = script.onreadystatechange = function() {
|
||
const loadState = this.readyState
|
||
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
|
||
script.onload = script.onreadystatechange = null
|
||
resolve()
|
||
}
|
||
document.head.appendChild(script)
|
||
})
|
||
|
||
win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
|
||
const link = document.createElement('link')
|
||
link.rel = 'stylesheet'
|
||
link.href = url
|
||
if (id) link.id = id
|
||
link.onerror = reject
|
||
link.onload = link.onreadystatechange = function() {
|
||
const loadState = this.readyState
|
||
if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
|
||
link.onload = link.onreadystatechange = null
|
||
resolve()
|
||
}
|
||
document.head.appendChild(link)
|
||
})
|
||
|
||
win.activateDarkMode = function () {
|
||
document.documentElement.setAttribute('data-theme', 'dark')
|
||
if (document.querySelector('meta[name="theme-color"]') !== null) {
|
||
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
|
||
}
|
||
}
|
||
win.activateLightMode = function () {
|
||
document.documentElement.setAttribute('data-theme', 'light')
|
||
if (document.querySelector('meta[name="theme-color"]') !== null) {
|
||
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
|
||
}
|
||
}
|
||
const t = saveToLocal.get('theme')
|
||
|
||
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
|
||
const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
|
||
const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
|
||
const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
|
||
|
||
if (t === undefined) {
|
||
if (isLightMode) activateLightMode()
|
||
else if (isDarkMode) activateDarkMode()
|
||
else if (isNotSpecified || hasNoSupport) {
|
||
const now = new Date()
|
||
const hour = now.getHours()
|
||
const isNight = hour <= 8 || hour >= 22
|
||
isNight ? activateDarkMode() : activateLightMode()
|
||
}
|
||
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
|
||
if (saveToLocal.get('theme') === undefined) {
|
||
e.matches ? activateDarkMode() : activateLightMode()
|
||
}
|
||
})
|
||
} else if (t === 'light') activateLightMode()
|
||
else activateDarkMode()
|
||
|
||
const asideStatus = saveToLocal.get('aside-status')
|
||
if (asideStatus !== undefined) {
|
||
if (asideStatus === 'hide') {
|
||
document.documentElement.classList.add('hide-aside')
|
||
} else {
|
||
document.documentElement.classList.remove('hide-aside')
|
||
}
|
||
}
|
||
|
||
const detectApple = () => {
|
||
if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
|
||
document.documentElement.classList.add('apple')
|
||
}
|
||
}
|
||
detectApple()
|
||
})(window)</script><script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script><script type="text/javascript" src ="/js/welcome.js" ></script><script src="/js/sweetalert.js"></script><link rel="stylesheet" href="/css/sweetalert.css"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css" media="print" onload="this.media='all'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.3.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/img/avatar.jpg" onerror="onerror=null;src='/img/loading.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">60</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">39</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div><br/><div class="menus_items"><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://www.tutorialspoint.com/compile_java8_online.php"><i class="fa-fw fas fa-code"></i><span> 代码</span></a></div><div class="menus_item"><a class="site-page" href="/notice/"><i class="fa-fw fas fa-stream"></i><span> 公告</span></a></div><div class="menus_item"><a class="site-page" href="/website/"><i class="fa-fw fas fa-list"></i><span> 网址</span></a></div><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="not-top-img" id="page-header"><nav id="nav"><span id="blog-info"><a href="/" title="The Blog"><img class="site-icon" src="/img/logo.png"/><span class="site-name">The Blog</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" target="_blank" rel="noopener" href="https://www.tutorialspoint.com/compile_java8_online.php"><i class="fa-fw fas fa-code"></i><span> 代码</span></a></div><div class="menus_item"><a class="site-page" href="/notice/"><i class="fa-fw fas fa-stream"></i><span> 公告</span></a></div><div class="menus_item"><a class="site-page" href="/website/"><i class="fa-fw fas fa-list"></i><span> 网址</span></a></div><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav></header><main class="layout" id="content-inner"><div id="post"><div id="post-info"><h1 class="post-title">Linux从入门到进阶</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-09-19T13:41:55.000Z" title="发表于 2023-09-19 21:41:55">2023-09-19</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-05-10T05:31:11.691Z" title="更新于 2024-05-10 13:31:11">2024-05-10</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E8%BF%90%E7%BB%B4/">运维</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">3.7k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>12分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="Linux从入门到进阶"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div><article class="post-content" id="article-container"><div class="note success flat"><p>本篇博客转载于传智播客黑马程序员,只作在线笔记使用,详细的课程资料请关注黑马程序员!</p>
|
||
</div>
|
||
|
||
<p>Linux相关的书籍: <a href="https://qingling.icu/posts/3661.html">技术书籍-Linux指令大全 | The Blog (qingling.icu)</a></p>
|
||
<h1 id="一-初识Linux"><a href="#一-初识Linux" class="headerlink" title="一.初识Linux"></a>一.初识Linux</h1><p> Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网络协议。支持32位和64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。</p>
|
||
<p><img src="/pictures/image-20230919214601245.png" alt="image-20230919214601245"></p>
|
||
<p>视频链接: <a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1n84y1i7td/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584">https://www.bilibili.com/video/BV1n84y1i7td/?share_source=copy_web&vd_source=aee5e475191b69e6c781059ab6662584</a></p>
|
||
<h1 id="二-Linux的安装和配置教程"><a href="#二-Linux的安装和配置教程" class="headerlink" title="二.Linux的安装和配置教程"></a>二.Linux的安装和配置教程</h1><h2 id="1-通过虚拟机安装Linux"><a href="#1-通过虚拟机安装Linux" class="headerlink" title="1.通过虚拟机安装Linux"></a>1.通过虚拟机安装Linux</h2><p>Linux安装教程: <a href="https://qingling.icu/posts/47407.html">VMWare虚拟机安装Linux教程 | The Blog (qingling.icu)</a></p>
|
||
<p>Linux设置静态IP:<a href="https://qingling.icu/posts/21883.html">Linux设置静态IP | The Blog (qingling.icu)</a></p>
|
||
<h2 id="2-通过WSL获取Linux环境"><a href="#2-通过WSL获取Linux环境" class="headerlink" title="2.通过WSL获取Linux环境"></a>2.通过WSL获取Linux环境</h2><p><strong>安装教程:</strong> <a href="https://qingling.icu/posts/25154.html">Windows10的Linux子系统WSL的安装和使用 | The Blog (qingling.icu)</a></p>
|
||
<h1 id="三-Linux的目录结构"><a href="#三-Linux的目录结构" class="headerlink" title="三.Linux的目录结构"></a>三.Linux的目录结构</h1><p><img src="/pictures/image-20230919230906304.png" alt="image-20230919230906304"></p>
|
||
<p><img src="/pictures/image-20230919231127383.png" alt="image-20230919231127383"></p>
|
||
<h1 id="四-LInux基础命令"><a href="#四-LInux基础命令" class="headerlink" title="四.LInux基础命令"></a>四.LInux基础命令</h1><h2 id="ls命令"><a href="#ls命令" class="headerlink" title="ls命令"></a>ls命令</h2><p>功能:列出文件夹信息</p>
|
||
<p>语法:<code>ls [-l -h -a] [参数]</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件夹,不提供参数,表示查看当前工作目录</li>
|
||
<li>-l,以列表形式查看</li>
|
||
<li>-h,配合-l,以更加人性化的方式显示文件大小</li>
|
||
<li>-a,显示隐藏文件</li>
|
||
</ul>
|
||
<h3 id="隐藏文件、文件夹"><a href="#隐藏文件、文件夹" class="headerlink" title="隐藏文件、文件夹"></a>隐藏文件、文件夹</h3><p>在Linux中以 <code>.</code>开头的,均是隐藏的。</p>
|
||
<p>默认不显示出来,需要 <code>-a</code>选项才可查看到。</p>
|
||
<h2 id="pwd命令"><a href="#pwd命令" class="headerlink" title="pwd命令"></a>pwd命令</h2><p>功能:展示当前工作目录</p>
|
||
<p>语法:<code>pwd</code></p>
|
||
<h2 id="cd命令"><a href="#cd命令" class="headerlink" title="cd命令"></a>cd命令</h2><p>功能:切换工作目录</p>
|
||
<p>语法:<code>cd [目标目录]</code></p>
|
||
<p>参数:目标目录,要切换去的地方,不提供默认切换到 <code>当前登录用户HOME目录</code></p>
|
||
<h2 id="HOME目录"><a href="#HOME目录" class="headerlink" title="HOME目录"></a>HOME目录</h2><p>每一个用户在Linux系统中都有自己的专属工作目录,称之为HOME目录。</p>
|
||
<ul>
|
||
<li>普通用户的HOME目录,默认在:<code>/home/用户名</code></li>
|
||
<li>root用户的HOME目录,在:<code>/root</code></li>
|
||
</ul>
|
||
<p>FinalShell登陆终端后,默认的工作目录就是用户的HOME目录</p>
|
||
<h2 id="相对路径、绝对路径"><a href="#相对路径、绝对路径" class="headerlink" title="相对路径、绝对路径"></a>相对路径、绝对路径</h2><ul>
|
||
<li><p>相对路径,==非==<code>/</code>开头的称之为相对路径</p>
|
||
<p>相对路径表示以 <code>当前目录</code>作为起点,去描述路径,如 <code>test/a.txt</code>,表示当前工作目录内的test文件夹内的a.txt文件</p>
|
||
</li>
|
||
<li><p>绝对路径,==以==<code>/</code>开头的称之为绝对路径</p>
|
||
<p>绝对路径从 <code>根</code>开始描述路径</p>
|
||
</li>
|
||
</ul>
|
||
<h2 id="特殊路径符"><a href="#特殊路径符" class="headerlink" title="特殊路径符"></a>特殊路径符</h2><ul>
|
||
<li><code>.</code>,表示当前,比如./a.txt,表示当前文件夹内的 <code>a.txt</code>文件</li>
|
||
<li><code>..</code>,表示上级目录,比如 <code>../</code>表示上级目录,<code>../../</code>表示上级的上级目录</li>
|
||
<li><code>~</code>,表示用户的HOME目录,比如 <code>cd ~</code>,即可切回用户HOME目录</li>
|
||
</ul>
|
||
<h2 id="mkdir命令"><a href="#mkdir命令" class="headerlink" title="mkdir命令"></a>mkdir命令</h2><p>功能:创建文件夹</p>
|
||
<p>语法:<code>mkdir [-p] 参数</code></p>
|
||
<ul>
|
||
<li>参数:被创建文件夹的路径</li>
|
||
<li>选项:-p,可选,表示创建前置路径</li>
|
||
</ul>
|
||
<h2 id="touch命令"><a href="#touch命令" class="headerlink" title="touch命令"></a>touch命令</h2><p>功能:创建文件</p>
|
||
<p>语法:<code>touch 参数</code></p>
|
||
<ul>
|
||
<li>参数:被创建的文件路径</li>
|
||
</ul>
|
||
<h2 id="cat命令"><a href="#cat命令" class="headerlink" title="cat命令"></a>cat命令</h2><p>功能:查看文件内容</p>
|
||
<p>语法:<code>cat 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件路径</li>
|
||
</ul>
|
||
<h2 id="more命令"><a href="#more命令" class="headerlink" title="more命令"></a>more命令</h2><p>功能:查看文件,可以支持翻页查看</p>
|
||
<p>语法:<code>more 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件路径</li>
|
||
<li>在查看过程中:<ul>
|
||
<li><code>空格</code>键翻页</li>
|
||
<li><code>q</code>退出查看</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h2 id="cp命令"><a href="#cp命令" class="headerlink" title="cp命令"></a>cp命令</h2><p>功能:复制文件、文件夹</p>
|
||
<p>语法:<code>cp [-r] 参数1 参数2</code></p>
|
||
<ul>
|
||
<li>参数1,被复制的</li>
|
||
<li>参数2,要复制去的地方</li>
|
||
<li>选项:-r,可选,复制文件夹使用</li>
|
||
</ul>
|
||
<p>示例:</p>
|
||
<ul>
|
||
<li>cp a.txt b.txt,复制当前目录下a.txt为b.txt</li>
|
||
<li>cp a.txt test/,复制当前目录a.txt到test文件夹内</li>
|
||
<li>cp -r test test2,复制文件夹test到当前文件夹内为test2存在</li>
|
||
</ul>
|
||
<h2 id="mv命令"><a href="#mv命令" class="headerlink" title="mv命令"></a>mv命令</h2><p>功能:移动文件、文件夹</p>
|
||
<p>语法:<code>mv 参数1 参数2</code></p>
|
||
<ul>
|
||
<li>参数1:被移动的</li>
|
||
<li>参数2:要移动去的地方,参数2如果不存在,则会进行改名</li>
|
||
</ul>
|
||
<h2 id="rm命令"><a href="#rm命令" class="headerlink" title="rm命令"></a>rm命令</h2><p>功能:删除文件、文件夹</p>
|
||
<p>语法:<code>rm [-r -f] 参数...参数</code></p>
|
||
<ul>
|
||
<li>参数:支持多个,每一个表示被删除的,空格进行分隔</li>
|
||
<li>选项:-r,删除文件夹使用</li>
|
||
<li>选项:-f,强制删除,不会给出确认提示,一般root用户会用到</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>rm命令很危险,一定要注意,特别是切换到root用户的时候。</p>
|
||
</blockquote>
|
||
<p><img src="/pictures/image-20230920231224351.png" alt="image-20230920231224351"></p>
|
||
<h2 id="which命令"><a href="#which命令" class="headerlink" title="which命令"></a>which命令</h2><p>功能:查看命令的程序本体文件路径</p>
|
||
<p>语法:<code>which 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的命令</li>
|
||
</ul>
|
||
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">jason@DESKTOP-PC4GEUR:~$ which pwd</span><br><span class="line">/usr/bin/pwd</span><br><span class="line">jason@DESKTOP-PC4GEUR:~$ which touch</span><br><span class="line">/usr/bin/touch</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="find命令"><a href="#find命令" class="headerlink" title="find命令"></a>find命令</h2><p>功能:搜索文件</p>
|
||
<p>语法1按文件名搜索:<code>find 路径 -name 参数</code></p>
|
||
<ul>
|
||
<li>路径,搜索的起始路径</li>
|
||
<li>参数,搜索的关键字,支持通配符*, 比如:<code>*</code>test表示搜索任意以test结尾的文件</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230923175004853.png" alt="image-20230923175004853"></p>
|
||
<h2 id="grep命令"><a href="#grep命令" class="headerlink" title="grep命令"></a>grep命令</h2><p>功能:过滤关键字</p>
|
||
<p>语法:<code>grep [-n] 关键字 文件路径</code></p>
|
||
<ul>
|
||
<li>选项-n,可选,表示在结果中显示匹配的行的行号。</li>
|
||
<li>参数,关键字,必填,表示过滤的关键字,带有空格或其它特殊符号,建议使用””将关键字包围起来</li>
|
||
<li>参数,文件路径,必填,表示要过滤内容的文件路径,可作为内容输入端口</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>参数文件路径,可以作为管道符的输入</p>
|
||
</blockquote>
|
||
<h2 id="wc命令"><a href="#wc命令" class="headerlink" title="wc命令"></a>wc命令</h2><p>功能:统计</p>
|
||
<p>语法:<code>wc [-c -m -l -w] 文件路径</code></p>
|
||
<ul>
|
||
<li>选项,-c,统计bytes数量</li>
|
||
<li>选项,-m,统计字符数量</li>
|
||
<li>选项,-l,统计行数</li>
|
||
<li>选项,-w,统计单词数量</li>
|
||
<li>参数,文件路径,被统计的文件,可作为内容输入端口</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>参数文件路径,可作为管道符的输入</p>
|
||
</blockquote>
|
||
<h2 id="管道符"><a href="#管道符" class="headerlink" title="管道符|"></a>管道符|</h2><p>写法:<code>|</code></p>
|
||
<p>功能:将符号左边的结果,作为符号右边的输入</p>
|
||
<p>示例:</p>
|
||
<p><code>cat a.txt | grep itheima</code>,将cat a.txt的结果,作为grep命令的输入,用来过滤 <code>itheima</code>关键字</p>
|
||
<p>可以支持嵌套:</p>
|
||
<p><code>cat a.txt | grep itheima | grep itcast</code></p>
|
||
<h2 id="echo命令"><a href="#echo命令" class="headerlink" title="echo命令"></a>echo命令</h2><p>功能:输出内容</p>
|
||
<p>语法:<code>echo 参数</code></p>
|
||
<ul>
|
||
<li>参数:被输出的内容</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230923181041583.png" alt="image-20230923181041583"></p>
|
||
<h2 id="反引号"><a href="#反引号" class="headerlink" title="`反引号"></a>`反引号</h2><p>功能:被两个反引号包围的内容,会作为命令执行</p>
|
||
<p>示例:</p>
|
||
<ul>
|
||
<li>echo `pwd`,会输出当前工作目录</li>
|
||
</ul>
|
||
<h2 id="tail命令"><a href="#tail命令" class="headerlink" title="tail命令"></a>tail命令</h2><p>功能:查看文件尾部内容</p>
|
||
<p>语法:<code>tail [-f] 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件</li>
|
||
<li>选项:-f,持续跟踪文件修改</li>
|
||
<li>选项, -num,表示,查看尾部多少行,不填默认10行(tail -10 文件)</li>
|
||
</ul>
|
||
<h2 id="head命令"><a href="#head命令" class="headerlink" title="head命令"></a>head命令</h2><p>功能:查看文件头部内容</p>
|
||
<p>语法:<code>head [-n] 参数</code></p>
|
||
<ul>
|
||
<li>参数:被查看的文件</li>
|
||
<li>选项:-n,查看的行数</li>
|
||
</ul>
|
||
<h2 id="重定向符"><a href="#重定向符" class="headerlink" title="重定向符"></a>重定向符</h2><p>功能:将符号左边的结果,输出到右边指定的文件中去</p>
|
||
<ul>
|
||
<li><code>></code>,表示覆盖输出</li>
|
||
<li><code>>></code>,表示追加输出</li>
|
||
</ul>
|
||
<p><img src="/pictures/image-20230923181307011.png" alt="image-20230923181307011"></p>
|
||
<h2 id="vi编辑器"><a href="#vi编辑器" class="headerlink" title="vi编辑器"></a>vi编辑器</h2><h3 id="命令模式快捷键"><a href="#命令模式快捷键" class="headerlink" title="命令模式快捷键"></a>命令模式快捷键</h3><p><img src="/pictures/20221027215841.png" alt="image-20221027215841573"></p>
|
||
<p><img src="/pictures/20221027215846.png" alt="image-20221027215846581"></p>
|
||
<p><img src="/pictures/20221027215849.png" alt="image-20221027215849668"></p>
|
||
<h3 id="底线命令快捷键"><a href="#底线命令快捷键" class="headerlink" title="底线命令快捷键"></a>底线命令快捷键</h3><p><img src="/pictures/20221027215858.png" alt="image-20221027215858967"></p>
|
||
<h2 id="命令的选项"><a href="#命令的选项" class="headerlink" title="命令的选项"></a>命令的选项</h2><p>我们学习的一系列Linux命令,它们所拥有的选项都是非常多的。</p>
|
||
<p>比如,简单的ls命令就有:-a -A -b -c -C -d -D -f -F -g -G -h -H -i -I -k -l -L -m -n -N -o -p -q -Q -r-R -s -S -t -T -u -U -v -w -x -X -1等选项,可以发现选项是极其多的。</p>
|
||
<p>课程中, 并不会将全部的选项都进行讲解,否则,一个ls命令就可能讲解2小时之久。</p>
|
||
<p>课程中,会对常见的选项进行讲解, 足够满足绝大多数的学习、工作场景。</p>
|
||
<h3 id="查看命令的帮助"><a href="#查看命令的帮助" class="headerlink" title="查看命令的帮助"></a>查看命令的帮助</h3><p>可以通过:<code>命令 --help</code>查看命令的帮助手册</p>
|
||
<p><img src="/pictures/20221027220005.png" alt="image-20221027220005610"></p>
|
||
<h3 id="查看命令的详细手册"><a href="#查看命令的详细手册" class="headerlink" title="查看命令的详细手册"></a>查看命令的详细手册</h3><p>可以通过:<code>man 命令</code>查看某命令的详细手册</p>
|
||
<p><img src="/pictures/20221027220010.png" alt="image-20221027220009949"></p>
|
||
<h1 id="五-Linux常用操作"><a href="#五-Linux常用操作" class="headerlink" title="五.Linux常用操作"></a>五.Linux常用操作</h1><h2 id="软件安装"><a href="#软件安装" class="headerlink" title="软件安装"></a>软件安装</h2><ul>
|
||
<li>CentOS系统使用:<ul>
|
||
<li>yum [install remove search] [-y] 软件名称<ul>
|
||
<li>install 安装</li>
|
||
<li>remove 卸载</li>
|
||
<li>search 搜索</li>
|
||
<li>-y,自动确认</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li>Ubuntu系统使用<ul>
|
||
<li>apt [install remove search] [-y] 软件名称<ul>
|
||
<li>install 安装</li>
|
||
<li>remove 卸载</li>
|
||
<li>search 搜索</li>
|
||
<li>-y,自动确认</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<blockquote>
|
||
<p>yum 和 apt 均需要root权限</p>
|
||
</blockquote>
|
||
<h2 id="systemctl"><a href="#systemctl" class="headerlink" title="systemctl"></a>systemctl</h2><p>功能:控制系统服务的启动关闭等</p>
|
||
<p>语法:<code>systemctl start | stop | restart | disable | enable | status 服务名</code></p>
|
||
<ul>
|
||
<li>start,启动</li>
|
||
<li>stop,停止</li>
|
||
<li>status,查看状态</li>
|
||
<li>disable,关闭开机自启</li>
|
||
<li>enable,开启开机自启</li>
|
||
<li>restart,重启</li>
|
||
</ul>
|
||
<h2 id="软链接"><a href="#软链接" class="headerlink" title="软链接"></a>软链接</h2><p>功能:创建文件、文件夹软链接(快捷方式)</p>
|
||
<p>语法:<code>ln -s 参数1 参数2</code></p>
|
||
<ul>
|
||
<li>参数1:被链接的</li>
|
||
<li>参数2:要链接去的地方(快捷方式的名称和存放位置)</li>
|
||
</ul>
|
||
<h2 id="日期"><a href="#日期" class="headerlink" title="日期"></a>日期</h2><p>语法:<code>date [-d] [+格式化字符串]</code></p>
|
||
<ul>
|
||
<li><p>-d 按照给定的字符串显示日期,一般用于日期计算</p>
|
||
</li>
|
||
<li><p>格式化字符串:通过特定的字符串标记,来控制显示的日期格式</p>
|
||
<ul>
|
||
<li>%Y 年%y 年份后两位数字 (00..99)</li>
|
||
<li>%m 月份 (01..12)</li>
|
||
<li>%d 日 (01..31)</li>
|
||
<li>%H 小时 (00..23)</li>
|
||
<li>%M 分钟 (00..59)</li>
|
||
<li>%S 秒 (00..60)</li>
|
||
<li>%s 自 1970-01-01 00:00:00 UTC 到现在的秒数</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p>示例:</p>
|
||
<ul>
|
||
<li><p>按照2022-01-01的格式显示日期</p>
|
||
<p><img src="/pictures/20221027220514.png" alt="image-20221027220514640"></p>
|
||
</li>
|
||
<li><p>按照2022-01-01 10:00:00的格式显示日期</p>
|
||
<p><img src="/pictures/20221027220525.png" alt="image-20221027220525625"></p>
|
||
</li>
|
||
<li><p>-d选项日期计算</p>
|
||
<p><img src="/pictures/20221027220429.png" alt="image-20221027220429831"></p>
|
||
<ul>
|
||
<li><p>支持的时间标记为:</p>
|
||
<p><img src="/pictures/20221027220449.png" alt="image-20221027220449312"></p>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h2 id="时区"><a href="#时区" class="headerlink" title="时区"></a>时区</h2><p>修改时区为中国时区</p>
|
||
<p><img src="/pictures/20221027220554.png" alt="image-20221027220554654"></p>
|
||
<h2 id="ntp"><a href="#ntp" class="headerlink" title="ntp"></a>ntp</h2><p>功能:同步时间</p>
|
||
<p>安装:<code>yum install -y ntp</code></p>
|
||
<p>启动管理:<code>systemctl start | stop | restart | status | disable | enable ntpd</code></p>
|
||
<p>手动校准时间:<code>ntpdate -u ntp.aliyun.com</code></p>
|
||
<h2 id="ip地址"><a href="#ip地址" class="headerlink" title="ip地址"></a>ip地址</h2><p>格式:a.b.c.d</p>
|
||
<ul>
|
||
<li>abcd为0~255的数字</li>
|
||
</ul>
|
||
<p>特殊IP:</p>
|
||
<ul>
|
||
<li>127.0.0.1,表示本机</li>
|
||
<li>0.0.0.0<ul>
|
||
<li>可以表示本机</li>
|
||
<li>也可以表示任意IP(看使用场景)</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<p>查看ip:<code>ifconfig</code></p>
|
||
<h2 id="主机名"><a href="#主机名" class="headerlink" title="主机名"></a>主机名</h2><p>功能:Linux系统的名称</p>
|
||
<p>查看:<code>hostname</code></p>
|
||
<p>设置:<code>hostnamectl set-hostname 主机名</code></p>
|
||
<h2 id="配置VMware固定IP"><a href="#配置VMware固定IP" class="headerlink" title="配置VMware固定IP"></a>配置VMware固定IP</h2><ol>
|
||
<li><p>修改VMware网络,参阅PPT,图太多</p>
|
||
</li>
|
||
<li><p>设置Linux内部固定IP</p>
|
||
<p>修改文件:<code>/etc/sysconfig/network-scripts/ifcfg-ens33</code></p>
|
||
<p>示例文件内容:</p>
|
||
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">TYPE="Ethernet"</span><br><span class="line">PROXY_METHOD="none"</span><br><span class="line">BROWSER_ONLY="no"</span><br><span class="line">BOOTPROTO="static" # 改为static,固定IP</span><br><span class="line">DEFROUTE="yes"</span><br><span class="line">IPV4_FAILURE_FATAL="no"</span><br><span class="line">IPV6INIT="yes"</span><br><span class="line">IPV6_AUTOCONF="yes"</span><br><span class="line">IPV6_DEFROUTE="yes"</span><br><span class="line">IPV6_FAILURE_FATAL="no"</span><br><span class="line">IPV6_ADDR_GEN_MODE="stable-privacy"</span><br><span class="line">NAME="ens33"</span><br><span class="line">UUID="1b0011cb-0d2e-4eaa-8a11-af7d50ebc876"</span><br><span class="line">DEVICE="ens33"</span><br><span class="line">ONBOOT="yes"</span><br><span class="line">IPADDR="192.168.88.131" # IP地址,自己设置,要匹配网络范围</span><br><span class="line">NETMASK="255.255.255.0" # 子网掩码,固定写法255.255.255.0</span><br><span class="line">GATEWAY="192.168.88.2" # 网关,要和VMware中配置的一致</span><br><span class="line">DNS1="192.168.88.2" # DNS1服务器,和网关一致即可</span><br></pre></td></tr></table></figure></li>
|
||
</ol>
|
||
<h2 id="ps命令"><a href="#ps命令" class="headerlink" title="ps命令"></a>ps命令</h2><p>功能:查看进程信息</p>
|
||
<p>语法:<code>ps -ef</code>,查看全部进程信息,可以搭配grep做过滤:<code>ps -ef | grep xxx</code></p>
|
||
<p><img src="/pictures/image-20230925200901791.png" alt="image-20230925200901791"></p>
|
||
<h2 id="kill命令"><a href="#kill命令" class="headerlink" title="kill命令"></a>kill命令</h2><p><img src="/pictures/20221027221303.png" alt="image-20221027221303037"></p>
|
||
<h2 id="nmap命令"><a href="#nmap命令" class="headerlink" title="nmap命令"></a>nmap命令</h2><p><img src="/pictures/20221027221241.png" alt="image-20221027221241123"></p>
|
||
<h2 id="netstat命令"><a href="#netstat命令" class="headerlink" title="netstat命令"></a>netstat命令</h2><p>功能:查看端口占用</p>
|
||
<p>用法:<code>netstat -anp | grep xxx</code></p>
|
||
<h2 id="ping命令"><a href="#ping命令" class="headerlink" title="ping命令"></a>ping命令</h2><p>测试网络是否联通</p>
|
||
<p>语法:<code>ping [-c num] 参数</code></p>
|
||
<p><img src="/pictures/20221027221129.png" alt="image-20221027221129782"></p>
|
||
<h2 id="wget命令"><a href="#wget命令" class="headerlink" title="wget命令"></a>wget命令</h2><p><img src="/pictures/20221027221149.png" alt="image-20221027221148964"></p>
|
||
<h2 id="curl命令"><a href="#curl命令" class="headerlink" title="curl命令"></a>curl命令</h2><p><img src="/pictures/20221027221201.png" alt="image-20221027221201079"></p>
|
||
<p><img src="/pictures/20221027221210.png" alt="image-20221027221210518"></p>
|
||
<h2 id="top命令"><a href="#top命令" class="headerlink" title="top命令"></a>top命令</h2><p>功能:查看主机运行状态</p>
|
||
<p>语法:<code>top</code>,查看基础信息</p>
|
||
<p>可用选项:</p>
|
||
<p><img src="/pictures/20221027221340.png" alt="image-20221027221340729"></p>
|
||
<p>交互式模式中,可用快捷键:</p>
|
||
<p><img src="/pictures/20221027221354.png" alt="image-20221027221354137"></p>
|
||
<p><img src="/pictures/image-20230925203631826.png" alt="image-20230925203631826"></p>
|
||
<p><img src="/pictures/image-20230925203743893.png" alt="image-20230925203743893"></p>
|
||
<h2 id="df命令"><a href="#df命令" class="headerlink" title="df命令"></a>df命令</h2><p>查看磁盘占用</p>
|
||
<p><img src="/pictures/20221027221413.png" alt="image-20221027221413787"></p>
|
||
<h2 id="iostat命令"><a href="#iostat命令" class="headerlink" title="iostat命令"></a>iostat命令</h2><p>查看CPU、磁盘的相关信息</p>
|
||
<p><img src="/pictures/20221027221440.png" alt="image-20221027221439990"></p>
|
||
<p><img src="/pictures/20221027221514.png" alt="image-20221027221514237"></p>
|
||
<h2 id="sar命令"><a href="#sar命令" class="headerlink" title="sar命令"></a>sar命令</h2><p>查看网络统计</p>
|
||
<p><img src="/pictures/20221027221545.png" alt="image-20221027221545822"></p>
|
||
<h2 id="环境变量"><a href="#环境变量" class="headerlink" title="环境变量"></a>环境变量</h2><ul>
|
||
<li>临时设置:export 变量名=变量值</li>
|
||
<li>永久设置:<ul>
|
||
<li>针对用户,设置用户HOME目录内:<code>.bashrc</code>文件</li>
|
||
<li>针对全局,设置 <code>/etc/profile</code></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<h3 id="PATH变量"><a href="#PATH变量" class="headerlink" title="PATH变量"></a>PATH变量</h3><p>记录了执行程序的搜索路径</p>
|
||
<p>可以将自定义路径加入PATH内,实现自定义命令在任意地方均可执行的效果</p>
|
||
<h2 id="符号"><a href="#符号" class="headerlink" title="$符号"></a>$符号</h2><p>可以取出指定的环境变量的值</p>
|
||
<p>语法:<code>$变量名</code></p>
|
||
<p>示例:</p>
|
||
<p><code>echo $PATH</code>,输出PATH环境变量的值</p>
|
||
<p><code>echo ${PATH}ABC</code>,输出PATH环境变量的值以及ABC</p>
|
||
<p>如果变量名和其它内容混淆在一起,可以使用${}</p>
|
||
<h2 id="RZ,SZ"><a href="#RZ,SZ" class="headerlink" title="RZ,SZ"></a>RZ,SZ</h2><p><img src="/pictures/image-20230925215103228.png" alt="image-20230925215103228"></p>
|
||
<h2 id="压缩解压"><a href="#压缩解压" class="headerlink" title="压缩解压"></a>压缩解压</h2><h3 id="压缩"><a href="#压缩" class="headerlink" title="压缩"></a>压缩</h3><p><code>tar -zcvf 压缩包 被压缩1...被压缩2...被压缩N</code></p>
|
||
<ul>
|
||
<li>-z表示使用gzip,可以不写</li>
|
||
</ul>
|
||
<p><code>zip [-r] 参数1 参数2 参数N</code></p>
|
||
<p><img src="/pictures/20221027221906.png" alt="image-20221027221906247"></p>
|
||
<p><img src="/pictures/image-20230925215409296.png" alt="image-20230925215409296"></p>
|
||
<h3 id="解压"><a href="#解压" class="headerlink" title="解压"></a>解压</h3><p><code>tar -zxvf 被解压的文件 -C 要解压去的地方</code></p>
|
||
<ul>
|
||
<li>-z表示使用gzip,可以省略</li>
|
||
<li>-C,可以省略,指定要解压去的地方,不写解压到当前目录</li>
|
||
</ul>
|
||
<p><code>unzip [-d] 参数</code></p>
|
||
<p><img src="/pictures/20221027221939.png" alt="image-20221027221939899"></p>
|
||
<h2 id="su命令"><a href="#su命令" class="headerlink" title="su命令"></a>su命令</h2><p>切换用户</p>
|
||
<p>语法:<code>su [-] [用户]</code></p>
|
||
<p><img src="/pictures/20221027222021.png" alt="image-20221027222021619"></p>
|
||
<h2 id="sudo命令"><a href="#sudo命令" class="headerlink" title="sudo命令"></a>sudo命令</h2><p><img src="/pictures/20221027222035.png" alt="image-20221027222035337"></p>
|
||
<p>比如:</p>
|
||
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">itheima ALL=(ALL) NOPASSWD: ALL</span><br></pre></td></tr></table></figure>
|
||
|
||
<p>在visudo内配置如上内容,可以让itheima用户,无需密码直接使用 <code>sudo</code></p>
|
||
<h2 id="chmod命令"><a href="#chmod命令" class="headerlink" title="chmod命令"></a>chmod命令</h2><p>修改文件、文件夹权限</p>
|
||
<p>语法:<code>chmod [-R] 权限 参数</code></p>
|
||
<p>权限可以用3位数字来代表,第一位数字表示用户权限,第二位表示用户组权限,第三位表示其它用户权限。数字的细节如下:r记为4,w记为2,x记为1,可以有:</p>
|
||
<ul>
|
||
<li><p>权限,要设置的权限,比如755,表示:<code>rwxr-xr-x</code></p>
|
||
<p><img src="/pictures/20221027222157.png" alt="image-20221027222157276"></p>
|
||
</li>
|
||
<li><p>参数,被修改的文件、文件夹</p>
|
||
</li>
|
||
<li><p>选项-R,设置文件夹和其内部全部内容一样生效</p>
|
||
</li>
|
||
</ul>
|
||
<p><strong>示例:</strong></p>
|
||
<p> • chmod u=rwx,g=rx,o=x hello.txt ,将文件权限修改为:rwxr-x–x</p>
|
||
<p> • 其中:u表示user所属用户权限,g表示group组权限,o表示other其它用户权限</p>
|
||
<p> • chmod -R u=rwx,g=rx,o=x test,将文件夹test以及文件夹内全部内容权限设置为:rwxr-x–x</p>
|
||
<p>除此之外,还有快捷写法:<strong>chmod 751 hello.txt</strong>,所以751表示: rwx(7) r-x(5) –x(1)[数字代表的含义见上面]</p>
|
||
<p><strong>rwx的含义</strong></p>
|
||
<p> • r表示读权限</p>
|
||
<p> • w表示写权限</p>
|
||
<p> • x表示执行权限</p>
|
||
<p><strong>针对文件、文件夹的不同,rwx的含义有细微差别</strong></p>
|
||
<p> •r,针对文件可以查看文件内容</p>
|
||
<p> •针对文件夹,可以查看文件夹内容,如ls命令</p>
|
||
<p> •w,针对文件表示可以修改此文件</p>
|
||
<p> •针对文件夹,可以在文件夹内:创建、删除、改名等操作</p>
|
||
<p> •x,针对文件表示可以将文件作为程序执行</p>
|
||
<p> •针对文件夹,表示可以更改工作目录到此文件夹,即cd进入</p>
|
||
<p><img src="/pictures/image-20230925112857636.png" alt="image-20230925112857636"></p>
|
||
<p>举例:drwxr-xr-x,表示:</p>
|
||
<p>•这是一个文件夹,首字母d表示</p>
|
||
<p>•所属用户(右上角图序号2)的权限是:有r有w有x,rwx</p>
|
||
<p>•所属用户组(右上角图序号3)的权限是:有r无w有x,r-x (-表示无此权限)</p>
|
||
<p>•其它用户的权限是:有r无w有x,r-x</p>
|
||
<h2 id="chown命令"><a href="#chown命令" class="headerlink" title="chown命令"></a>chown命令</h2><p>修改文件、文件夹所属用户、组</p>
|
||
<p>语法:<code>chown [-R] [用户][:][用户组] 文件或文件夹</code></p>
|
||
<p><img src="/pictures/20221027222326.png" alt="image-20221027222326192"></p>
|
||
<h2 id="用户组管理"><a href="#用户组管理" class="headerlink" title="用户组管理"></a>用户组管理</h2><p><img src="/pictures/20221027222354.png" alt="image-20221027222354498"></p>
|
||
<h2 id="用户管理"><a href="#用户管理" class="headerlink" title="用户管理"></a>用户管理</h2><p><img src="/pictures/20221027222407.png" alt="image-20221027222407618"></p>
|
||
<h2 id="genent命令"><a href="#genent命令" class="headerlink" title="genent命令"></a>genent命令</h2><ul>
|
||
<li><p><code>getent group</code>,查看系统全部的用户组</p>
|
||
<p><img src="/pictures/20221027222446.png" alt="image-20221027222446514"></p>
|
||
</li>
|
||
<li><p><code>getent passwd</code>,查看系统全部的用户</p>
|
||
<p><img src="/pictures/20221027222512.png" alt="image-20221027222512274"></p>
|
||
</li>
|
||
</ul>
|
||
<h2 id="env命令"><a href="#env命令" class="headerlink" title="env命令"></a>env命令</h2><p>查看系统全部的环境变量</p>
|
||
<p>语法:<code>env</code></p>
|
||
<h2 id="开启指定端口的防火墙限制"><a href="#开启指定端口的防火墙限制" class="headerlink" title="开启指定端口的防火墙限制"></a>开启指定端口的防火墙限制</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">永久性地在防火墙配置中打开TCP的9000端口</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">--permanent表示永久的</span></span><br><span class="line">sudo firewall-cmd --permanent --add-port=9000/tcp</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">刷新防火墙规则</span></span><br><span class="line">sudo firewall-cmd --reload</span><br></pre></td></tr></table></figure>
|
||
|
||
<h2 id="实用的小技巧"><a href="#实用的小技巧" class="headerlink" title="实用的小技巧"></a>实用的小技巧</h2><h3 id="history命令"><a href="#history命令" class="headerlink" title="history命令"></a>history命令</h3><p>用于查看历史输入的命令</p>
|
||
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">root@DESKTOP-PC4GEUR:/# history</span><br><span class="line"> 1 cd /</span><br><span class="line"> 2 ls</span><br><span class="line"> 3 clear</span><br><span class="line"> 4 ls</span><br><span class="line"> 5 cd /</span><br><span class="line"> 略略略</span><br><span class="line"> 51 clear</span><br><span class="line"> 52 hostory</span><br><span class="line"> 53 clear</span><br><span class="line"> 54 history</span><br><span class="line">root@DESKTOP-PC4GEUR:/#</span><br></pre></td></tr></table></figure>
|
||
|
||
<h3 id="光标移动的快捷键"><a href="#光标移动的快捷键" class="headerlink" title="光标移动的快捷键"></a>光标移动的快捷键</h3><p><img src="/pictures/image-20230925132050649.png" alt="image-20230925132050649"></p>
|
||
<h3 id="小技巧汇总"><a href="#小技巧汇总" class="headerlink" title="小技巧汇总"></a>小技巧汇总</h3><p><img src="/pictures/image-20230925133017257.png" alt="image-20230925133017257"></p>
|
||
</article><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Linux/">Linux</a></div><div class="post_share"><div class="social-share" data-image="/img/8.png" data-sites="wechat,weibo,qq"></div><link rel="stylesheet" href="/cdn/css/share.min.css" media="print" onload="this.media='all'"><script src="/cdn/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/img/wechat.jpg" target="_blank"><img class="post-qr-code-img" src="/img/wechat.jpg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/img/alipay.jpg" target="_blank"><img class="post-qr-code-img" src="/img/alipay.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><br/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="far fa-comment-alt fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="gitalk-container"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/img/avatar.jpg" onerror="this.onerror=null;this.src='/img/loading.gif'" alt="avatar"/></div><div class="author-info__name">Jason</div><div class="author-info__description">Debug the World!</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">60</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">39</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div><a id="card-info-btn"><i class="fab fa-microsoft"></i><span>Ctrl + D 收藏</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/JasonsGong" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin=2602183349&website=www.oicqzone.com" target="_blank" title="QQ"><i class="fab fa-qq"></i></a><a class="social-icon" href="mailto:2602183349@qq.com" target="_blank" title="Email"><i class="fas fa-envelope-open-text"></i></a><a class="social-icon" href="https://github.com/JasonsGong?tab=repositories" target="_blank" title="代码仓库"><i class="fas fa-database"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">本网站是静态网站,更新页面资源请使用Ctrl+F5;若网站内文章对你有帮助,请使用Ctrl+D收藏该网站!</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content is-expand"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%80-%E5%88%9D%E8%AF%86Linux"><span class="toc-text">一.初识Linux</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BA%8C-Linux%E7%9A%84%E5%AE%89%E8%A3%85%E5%92%8C%E9%85%8D%E7%BD%AE%E6%95%99%E7%A8%8B"><span class="toc-text">二.Linux的安装和配置教程</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E9%80%9A%E8%BF%87%E8%99%9A%E6%8B%9F%E6%9C%BA%E5%AE%89%E8%A3%85Linux"><span class="toc-text">1.通过虚拟机安装Linux</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E9%80%9A%E8%BF%87WSL%E8%8E%B7%E5%8F%96Linux%E7%8E%AF%E5%A2%83"><span class="toc-text">2.通过WSL获取Linux环境</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%89-Linux%E7%9A%84%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84"><span class="toc-text">三.Linux的目录结构</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%9B%9B-LInux%E5%9F%BA%E7%A1%80%E5%91%BD%E4%BB%A4"><span class="toc-text">四.LInux基础命令</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#ls%E5%91%BD%E4%BB%A4"><span class="toc-text">ls命令</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%9A%90%E8%97%8F%E6%96%87%E4%BB%B6%E3%80%81%E6%96%87%E4%BB%B6%E5%A4%B9"><span class="toc-text">隐藏文件、文件夹</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#pwd%E5%91%BD%E4%BB%A4"><span class="toc-text">pwd命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#cd%E5%91%BD%E4%BB%A4"><span class="toc-text">cd命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#HOME%E7%9B%AE%E5%BD%95"><span class="toc-text">HOME目录</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%9B%B8%E5%AF%B9%E8%B7%AF%E5%BE%84%E3%80%81%E7%BB%9D%E5%AF%B9%E8%B7%AF%E5%BE%84"><span class="toc-text">相对路径、绝对路径</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%89%B9%E6%AE%8A%E8%B7%AF%E5%BE%84%E7%AC%A6"><span class="toc-text">特殊路径符</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#mkdir%E5%91%BD%E4%BB%A4"><span class="toc-text">mkdir命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#touch%E5%91%BD%E4%BB%A4"><span class="toc-text">touch命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#cat%E5%91%BD%E4%BB%A4"><span class="toc-text">cat命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#more%E5%91%BD%E4%BB%A4"><span class="toc-text">more命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#cp%E5%91%BD%E4%BB%A4"><span class="toc-text">cp命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#mv%E5%91%BD%E4%BB%A4"><span class="toc-text">mv命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#rm%E5%91%BD%E4%BB%A4"><span class="toc-text">rm命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#which%E5%91%BD%E4%BB%A4"><span class="toc-text">which命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#find%E5%91%BD%E4%BB%A4"><span class="toc-text">find命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#grep%E5%91%BD%E4%BB%A4"><span class="toc-text">grep命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#wc%E5%91%BD%E4%BB%A4"><span class="toc-text">wc命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AE%A1%E9%81%93%E7%AC%A6"><span class="toc-text">管道符|</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#echo%E5%91%BD%E4%BB%A4"><span class="toc-text">echo命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8F%8D%E5%BC%95%E5%8F%B7"><span class="toc-text">`反引号</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#tail%E5%91%BD%E4%BB%A4"><span class="toc-text">tail命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#head%E5%91%BD%E4%BB%A4"><span class="toc-text">head命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%87%8D%E5%AE%9A%E5%90%91%E7%AC%A6"><span class="toc-text">重定向符</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#vi%E7%BC%96%E8%BE%91%E5%99%A8"><span class="toc-text">vi编辑器</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%91%BD%E4%BB%A4%E6%A8%A1%E5%BC%8F%E5%BF%AB%E6%8D%B7%E9%94%AE"><span class="toc-text">命令模式快捷键</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BA%95%E7%BA%BF%E5%91%BD%E4%BB%A4%E5%BF%AB%E6%8D%B7%E9%94%AE"><span class="toc-text">底线命令快捷键</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%91%BD%E4%BB%A4%E7%9A%84%E9%80%89%E9%A1%B9"><span class="toc-text">命令的选项</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E5%91%BD%E4%BB%A4%E7%9A%84%E5%B8%AE%E5%8A%A9"><span class="toc-text">查看命令的帮助</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9F%A5%E7%9C%8B%E5%91%BD%E4%BB%A4%E7%9A%84%E8%AF%A6%E7%BB%86%E6%89%8B%E5%86%8C"><span class="toc-text">查看命令的详细手册</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BA%94-Linux%E5%B8%B8%E7%94%A8%E6%93%8D%E4%BD%9C"><span class="toc-text">五.Linux常用操作</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85"><span class="toc-text">软件安装</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#systemctl"><span class="toc-text">systemctl</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BD%AF%E9%93%BE%E6%8E%A5"><span class="toc-text">软链接</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%97%A5%E6%9C%9F"><span class="toc-text">日期</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%97%B6%E5%8C%BA"><span class="toc-text">时区</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ntp"><span class="toc-text">ntp</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ip%E5%9C%B0%E5%9D%80"><span class="toc-text">ip地址</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%BB%E6%9C%BA%E5%90%8D"><span class="toc-text">主机名</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AEVMware%E5%9B%BA%E5%AE%9AIP"><span class="toc-text">配置VMware固定IP</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ps%E5%91%BD%E4%BB%A4"><span class="toc-text">ps命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#kill%E5%91%BD%E4%BB%A4"><span class="toc-text">kill命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#nmap%E5%91%BD%E4%BB%A4"><span class="toc-text">nmap命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#netstat%E5%91%BD%E4%BB%A4"><span class="toc-text">netstat命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ping%E5%91%BD%E4%BB%A4"><span class="toc-text">ping命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#wget%E5%91%BD%E4%BB%A4"><span class="toc-text">wget命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#curl%E5%91%BD%E4%BB%A4"><span class="toc-text">curl命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#top%E5%91%BD%E4%BB%A4"><span class="toc-text">top命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#df%E5%91%BD%E4%BB%A4"><span class="toc-text">df命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#iostat%E5%91%BD%E4%BB%A4"><span class="toc-text">iostat命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#sar%E5%91%BD%E4%BB%A4"><span class="toc-text">sar命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F"><span class="toc-text">环境变量</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#PATH%E5%8F%98%E9%87%8F"><span class="toc-text">PATH变量</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AC%A6%E5%8F%B7"><span class="toc-text">$符号</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#RZ%EF%BC%8CSZ"><span class="toc-text">RZ,SZ</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8E%8B%E7%BC%A9%E8%A7%A3%E5%8E%8B"><span class="toc-text">压缩解压</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8E%8B%E7%BC%A9"><span class="toc-text">压缩</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%A7%A3%E5%8E%8B"><span class="toc-text">解压</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#su%E5%91%BD%E4%BB%A4"><span class="toc-text">su命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#sudo%E5%91%BD%E4%BB%A4"><span class="toc-text">sudo命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#chmod%E5%91%BD%E4%BB%A4"><span class="toc-text">chmod命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#chown%E5%91%BD%E4%BB%A4"><span class="toc-text">chown命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%94%A8%E6%88%B7%E7%BB%84%E7%AE%A1%E7%90%86"><span class="toc-text">用户组管理</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%94%A8%E6%88%B7%E7%AE%A1%E7%90%86"><span class="toc-text">用户管理</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#genent%E5%91%BD%E4%BB%A4"><span class="toc-text">genent命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#env%E5%91%BD%E4%BB%A4"><span class="toc-text">env命令</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BC%80%E5%90%AF%E6%8C%87%E5%AE%9A%E7%AB%AF%E5%8F%A3%E7%9A%84%E9%98%B2%E7%81%AB%E5%A2%99%E9%99%90%E5%88%B6"><span class="toc-text">开启指定端口的防火墙限制</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%9E%E7%94%A8%E7%9A%84%E5%B0%8F%E6%8A%80%E5%B7%A7"><span class="toc-text">实用的小技巧</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#history%E5%91%BD%E4%BB%A4"><span class="toc-text">history命令</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%85%89%E6%A0%87%E7%A7%BB%E5%8A%A8%E7%9A%84%E5%BF%AB%E6%8D%B7%E9%94%AE"><span class="toc-text">光标移动的快捷键</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B0%8F%E6%8A%80%E5%B7%A7%E6%B1%87%E6%80%BB"><span class="toc-text">小技巧汇总</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最近更新</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/8957.html" title="Linux从入门到进阶"><img src="/img/8.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Linux从入门到进阶"/></a><div class="content"><a class="title" href="/posts/8957.html" title="Linux从入门到进阶">Linux从入门到进阶</a><time datetime="2024-05-10T05:31:11.691Z" title="更新于 2024-05-10 13:31:11">2024-05-10</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/35630.html" title="接口测试工具"><img src="/img/2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="接口测试工具"/></a><div class="content"><a class="title" href="/posts/35630.html" title="接口测试工具">接口测试工具</a><time datetime="2024-05-10T05:31:11.686Z" title="更新于 2024-05-10 13:31:11">2024-05-10</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/32246.html" title="SpringBoot中整合Swagger2"><img src="/img/3.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="SpringBoot中整合Swagger2"/></a><div class="content"><a class="title" href="/posts/32246.html" title="SpringBoot中整合Swagger2">SpringBoot中整合Swagger2</a><time datetime="2024-05-10T05:31:11.681Z" title="更新于 2024-05-10 13:31:11">2024-05-10</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/19306.html" title="Docker容器化技术"><img src="/img/1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Docker容器化技术"/></a><div class="content"><a class="title" href="/posts/19306.html" title="Docker容器化技术">Docker容器化技术</a><time datetime="2024-05-10T05:31:11.675Z" title="更新于 2024-05-10 13:31:11">2024-05-10</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/20683.html" title="Linux中开发环境的搭建"><img src="/img/8.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Linux中开发环境的搭建"/></a><div class="content"><a class="title" href="/posts/20683.html" title="Linux中开发环境的搭建">Linux中开发环境的搭建</a><time datetime="2024-05-10T05:31:11.669Z" title="更新于 2024-05-10 13:31:11">2024-05-10</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comment-alt"></i></a><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/cdn/js/medium-zoom.min.js"></script><script src="/cdn/js/instantpage.min.js" type="module"></script><script src="/cdn/js/snackbar.min.js"></script><div class="js-pjax"><script>function loadGitalk () {
|
||
function initGitalk () {
|
||
var gitalk = new Gitalk(Object.assign({
|
||
clientID: '00fb27b1e484536359c2',
|
||
clientSecret: 'be41a12281c68b6e228d1a27e8d08aeb91541145',
|
||
repo: 'BlogComment',
|
||
owner: 'JasonsGong',
|
||
admin: ['JasonsGong'],
|
||
id: '3f0788e7766a2ab1d80d36065a0ca954',
|
||
updateCountCallback: commentCount
|
||
},null))
|
||
|
||
gitalk.render('gitalk-container')
|
||
}
|
||
|
||
if (typeof Gitalk === 'function') initGitalk()
|
||
else {
|
||
getCSS('/cdn/css/gitalk.min.css')
|
||
getScript('/cdn/js/gitalk.min.js').then(initGitalk)
|
||
}
|
||
}
|
||
|
||
function commentCount(n){
|
||
let isCommentCount = document.querySelector('#post-meta .gitalk-comment-count')
|
||
if (isCommentCount) {
|
||
isCommentCount.textContent= n
|
||
}
|
||
}
|
||
|
||
if ('Gitalk' === 'Gitalk' || !true) {
|
||
if (true) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk)
|
||
else loadGitalk()
|
||
} else {
|
||
function loadOtherComment () {
|
||
loadGitalk()
|
||
}
|
||
}</script></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span> 数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><br/><div class="no-result" id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div><!-- hexo injector body_end start --><script data-pjax>
|
||
function butterfly_swiper_injector_config(){
|
||
var parent_div_git = document.getElementById('recent-posts');
|
||
var item_html = '<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" href="posts/19306.html" alt=""><img width="48" height="48" src="/img/1.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-04-21</span><a class="blog-slider__title" href="posts/19306.html" alt="">Docker容器化技术</a><div class="blog-slider__text">Docker</div><a class="blog-slider__button" href="posts/19306.html" alt="">详情 </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" href="posts/47003.html" alt=""><img width="48" height="48" src="/img/5.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-03-10</span><a class="blog-slider__title" href="posts/47003.html" alt="">常用正则表达式大全</a><div class="blog-slider__text">正则表达式</div><a class="blog-slider__button" href="posts/47003.html" alt="">详情 </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" href="posts/20683.html" alt=""><img width="48" height="48" src="/img/8.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-06-05</span><a class="blog-slider__title" href="posts/20683.html" alt="">Linux中开发环境的搭建</a><div class="blog-slider__text">环境搭建</div><a class="blog-slider__button" href="posts/20683.html" alt="">详情 </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" href="posts/63333.html" alt=""><img width="48" height="48" src="/img/10.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2023-06-03</span><a class="blog-slider__title" href="posts/63333.html" alt="">开发环境的搭建</a><div class="blog-slider__text">环境搭建</div><a class="blog-slider__button" href="posts/63333.html" alt="">详情 </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>';
|
||
if (parent_div_git !== null && typeof parent_div_git !== 'undefined') {
|
||
parent_div_git.insertAdjacentHTML("afterbegin",item_html)
|
||
}
|
||
}
|
||
var elist = 'undefined'.split(',');
|
||
var cpage = location.pathname;
|
||
var epage = 'all';
|
||
var flag = 0;
|
||
|
||
for (var i=0;i<elist.length;i++){
|
||
if (cpage.includes(elist[i])){
|
||
flag++;
|
||
}
|
||
}
|
||
|
||
if ((epage ==='all')&&(flag == 0)){
|
||
butterfly_swiper_injector_config();
|
||
}
|
||
else if (epage === cpage){
|
||
butterfly_swiper_injector_config();
|
||
}
|
||
</script><script defer src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js"></script><script defer data-pjax src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js"></script><!-- hexo injector body_end end --></body></html> |