JasonsGong.github.io/posts/8957.html

659 lines
68 KiB
HTML
Raw Permalink Normal View History

2024-05-10 13:32:25 +08:00
<!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工具软件、应用程序和网">
2023-09-22 21:57:28 +08:00
<meta property="og:type" content="article">
<meta property="og:title" content="Linux从入门到进阶">
2024-05-10 10:21:35 +08:00
<meta property="og:url" content="https://qingling.icu/posts/8957.html">
2023-09-22 21:57:28 +08:00
<meta property="og:site_name" content="The Blog">
2024-05-10 13:32:25 +08:00
<meta property="og:description" content="本篇博客转载于传智播客黑马程序员,只作在线笔记使用,详细的课程资料请关注黑马程序员! Linux相关的书籍: 技术书籍-Linux指令大全 | The Blog (qingling.icu) 一.初识Linux Linux是一套免费使用和自由传播的类Unix操作系统是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网">
2023-09-22 21:57:28 +08:00
<meta property="og:locale" content="zh_CN">
2024-06-14 22:00:25 +08:00
<meta property="og:image" content="https://qingling.icu/img/8.png">
2023-09-22 21:57:28 +08:00
<meta property="article:published_time" content="2023-09-19T13:41:55.000Z">
2024-05-10 13:32:25 +08:00
<meta property="article:modified_time" content="2024-05-10T05:31:11.691Z">
2023-09-22 21:57:28 +08:00
<meta property="article:author" content="Jason">
<meta property="article:tag" content="Linux">
<meta name="twitter:card" content="summary">
2024-06-14 22:00:25 +08:00
<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 = {
2023-09-22 21:57:28 +08:00
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',
2023-12-09 14:21:01 +08:00
Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#006650","bgDark":"#006650","position":"top-center"},
2023-09-22 21:57:28 +08:00
source: {
justifiedGallery: {
2023-09-30 18:36:25 +08:00
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'
2023-09-22 21:57:28 +08:00
}
},
isPhotoFigcaption: false,
islazyload: false,
2023-12-10 21:57:00 +08:00
isAnchor: true,
2023-09-22 21:57:28 +08:00
percent: {
toc: true,
rightside: false,
},
2023-12-09 19:59:36 +08:00
autoDarkmode: true
2023-09-22 21:57:28 +08:00
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: 'Linux从入门到进阶',
isPost: true,
isHome: false,
isHighlightShrink: false,
isToc: true,
2024-05-10 13:32:25 +08:00
postUpdate: '2024-05-10 13:31:11'
2023-09-22 21:57:28 +08:00
}</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')
2023-12-09 19:59:36 +08:00
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()
2023-09-22 21:57:28 +08:00
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()
2024-06-14 22:00:25 +08:00
})(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-c
2023-09-22 21:57:28 +08:00
</div>
2024-05-10 13:32:25 +08:00
<p>Linux相关的书籍: <a href="https://qingling.icu/posts/3661.html">技术书籍-Linux指令大全 | The Blog (qingling.icu)</a></p>
2023-09-22 21:57:28 +08:00
<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&amp;vd_source=aee5e475191b69e6c781059ab6662584</a></p>
2024-05-10 13:32:25 +08:00
<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>
2023-09-22 21:57:28 +08:00
<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>相对路径,&#x3D;&#x3D;&#x3D;&#x3D;<code>/</code>开头的称之为相对路径</p>
<p>相对路径表示以 <code>当前目录</code>作为起点,去描述路径,如 <code>test/a.txt</code>表示当前工作目录内的test文件夹内的a.txt文件</p>
</li>
<li><p>绝对路径,&#x3D;&#x3D;&#x3D;&#x3D;<code>/</code>开头的称之为绝对路径</p>
<p>绝对路径从 <code></code>开始描述路径</p>
</li>
</ul>
<h2 id="特殊路径符"><a href="#特殊路径符" class="headerlink" title="特殊路径符"></a>特殊路径符</h2><ul>
<li><code>.</code>,表示当前,比如.&#x2F;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&#x2F;复制当前目录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>
2023-09-23 18:19:47 +08:00
<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>
2023-09-22 21:57:28 +08:00
<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>
2023-09-23 18:19:47 +08:00
<p><img src="/pictures/image-20230923175004853.png" alt="image-20230923175004853"></p>
2023-09-22 21:57:28 +08:00
<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>
2023-09-23 18:19:47 +08:00
<p><img src="/pictures/image-20230923181041583.png" alt="image-20230923181041583"></p>
2023-09-22 21:57:28 +08:00
<h2 id="反引号"><a href="#反引号" class="headerlink" title="&#96;反引号"></a>&#96;反引号</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>
2023-09-23 18:19:47 +08:00
<li>选项, -num表示查看尾部多少行不填默认10行(tail -10 文件)</li>
2023-09-22 21:57:28 +08:00
</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>&gt;</code>,表示覆盖输出</li>
<li><code>&gt;&gt;</code>,表示追加输出</li>
</ul>
2023-09-23 18:19:47 +08:00
<p><img src="/pictures/image-20230923181307011.png" alt="image-20230923181307011"></p>
2023-09-22 21:57:28 +08:00
<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=&quot;Ethernet&quot;</span><br><span class="line">PROXY_METHOD=&quot;none&quot;</span><br><span class="line">BROWSER_ONLY=&quot;no&quot;</span><br><span class="line">BOOTPROTO=&quot;static&quot; # 改为static固定IP</span><br><span class="line">DEFROUTE=&quot;yes&quot;</span><br><span class="line">IPV4_FAILURE_FATAL=&quot;no&quot;</span><br><span class="line">IPV6INIT=&quot;yes&quot;</span><br><span class="line">IPV6_AUTOCONF=&quot;yes&quot;</span><br><span class="line">IPV6_DEFROUTE=&quot;yes&quot;</span><br><span class="line">IPV6_FAILURE_FATAL=&quot;no&quot;</span><br><span class="line">IPV6_ADDR_GEN_MODE=&quot;stable-privacy&quot;</span><br><span class="line">NAME=&quot;ens33&quot;</span><br><span class="line">UUID=&quot;1b0011cb-0d2e-4eaa-8a11-af7d50ebc876&quot;</span><br><span class="line">DEVICE=&quot;ens33&quot;</span><br><span class="line">ONBOOT=&quot;yes&quot;</span><br><span class="line">IPADDR=&quot;192.168.88.131&quot; # IP地址自己设置要匹配网络范围</span><br><span class="line">NETMASK=&quot;255.255.255.0&quot; # 子网掩码固定写法255.255.255.0</span><br><span class="line">GATEWAY=&quot;192.168.88.2&quot; # 网关要和VMware中配置的一致</span><br><span class="line">DNS1=&quot;192.168.88.2&quot; # 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>
2023-09-25 20:27:11 +08:00
<p><img src="/pictures/image-20230925200901791.png" alt="image-20230925200901791"></p>
2023-09-22 21:57:28 +08:00
<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>
2023-09-25 20:56:00 +08:00
<p><img src="/pictures/image-20230925203631826.png" alt="image-20230925203631826"></p>
<p><img src="/pictures/image-20230925203743893.png" alt="image-20230925203743893"></p>
2023-09-22 21:57:28 +08:00
<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 变量名&#x3D;变量值</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 $&#123;PATH&#125;ABC</code>输出PATH环境变量的值以及ABC</p>
<p>如果变量名和其它内容混淆在一起,可以使用${}</p>
2023-09-25 22:05:45 +08:00
<h2 id="RZSZ"><a href="#RZSZ" class="headerlink" title="RZSZ"></a>RZSZ</h2><p><img src="/pictures/image-20230925215103228.png" alt="image-20230925215103228"></p>
2023-09-22 21:57:28 +08:00
<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>
2023-09-25 22:05:45 +08:00
<p><img src="/pictures/image-20230925215409296.png" alt="image-20230925215409296"></p>
2023-09-22 21:57:28 +08:00
<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>
2023-09-25 16:20:19 +08:00
<p>权限可以用3位数字来代表第一位数字表示用户权限第二位表示用户组权限第三位表示其它用户权限。数字的细节如下r记为4w记为2x记为1可以有</p>
2023-09-22 21:57:28 +08:00
<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>
2023-09-25 16:20:19 +08:00
<p><strong>示例:</strong></p>
<p> • chmod u&#x3D;rwx,g&#x3D;rx,o&#x3D;x hello.txt 将文件权限修改为rwxr-xx</p>
<p> • 其中u表示user所属用户权限g表示group组权限o表示other其它用户权限</p>
<p> • chmod -R u&#x3D;rwx,g&#x3D;rx,o&#x3D;x test将文件夹test以及文件夹内全部内容权限设置为rwxr-xx</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有xrwx</p>
<p>•所属用户组(右上角图序号3)的权限是有r无w有xr-x -表示无此权限)</p>
<p>•其它用户的权限是有r无w有xr-x</p>
2023-09-22 21:57:28 +08:00
<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>
2023-09-25 16:20:19 +08:00
<h2 id="genent命令"><a href="#genent命令" class="headerlink" title="genent命令"></a>genent命令</h2><ul>
<li><p><code>getent group</code>,查看系统全部的用户组</p>
2023-09-22 21:57:28 +08:00
<p><img src="/pictures/20221027222446.png" alt="image-20221027222446514"></p>
</li>
2023-09-25 16:20:19 +08:00
<li><p><code>getent passwd</code>,查看系统全部的用户</p>
2023-09-22 21:57:28 +08:00
<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>
2024-01-05 22:14:34 +08:00
<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>
2023-09-25 16:20:19 +08:00
<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>
2024-06-14 22:00:25 +08:00
</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&amp;fromSubId=1&amp;subcmd=all&amp;uin=2602183349&amp;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></
2024-01-13 16:32:52 +08:00
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 {
2024-01-13 17:50:17 +08:00
getCSS('/cdn/css/gitalk.min.css')
getScript('/cdn/js/gitalk.min.js').then(initGitalk)
2024-01-13 16:32:52 +08:00
}
}
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>
2023-09-22 21:57:28 +08:00
function butterfly_swiper_injector_config(){
2024-01-13 22:42:28 +08:00
var parent_div_git = document.getElementById('recent-posts');
2024-06-14 22:00:25 +08:00
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>';
2024-01-13 22:42:28 +08:00
if (parent_div_git !== null && typeof parent_div_git !== 'undefined') {
parent_div_git.insertAdjacentHTML("afterbegin",item_html)
}
2023-09-22 21:57:28 +08:00
}
var elist = 'undefined'.split(',');
var cpage = location.pathname;
2023-10-28 10:47:20 +08:00
var epage = 'all';
2023-09-22 21:57:28 +08:00
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();
}
2024-01-13 22:10:58 +08:00
</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>