前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【Linux】常用指令,带你快速上手

【Linux】常用指令,带你快速上手

作者头像
_小羊_
发布2024-10-16 15:21:20
550
发布2024-10-16 15:21:20
举报
文章被收录于专栏:C++

前言

承接上文,本文将继续补充介绍一些Linux基本指令,以及探讨指令究竟是什么,又什么是权限?权限是 Linux 系统中非常重要的一部分,它决定了谁可以读取、写入或执行文件或目录。


💥一、Linux基本指令

💥1.1 mv 指令

mv指令是move的缩写,用来移动或重命名文件、目录,经常用来备份文件或目录。

  • mv old_name new_name: 重命名文件或目录
  • mv file /path/to/directory: 移动文件到指定目录
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# ls -l
total 8
drwxr-xr-x 2 root root 4096 Sep 16 20:13 dir
-rw-r--r-- 1 root root   78 Sep 16 20:04 test.c
root@hcss-ecs-8f13:~/112# mv test.c name.c
root@hcss-ecs-8f13:~/112# mv dir mydir
root@hcss-ecs-8f13:~/112# ls -l
total 8
drwxr-xr-x 2 root root 4096 Sep 16 20:13 mydir
-rw-r--r-- 1 root root   78 Sep 16 20:04 name.c
root@hcss-ecs-8f13:~/112# mv name.c ../
root@hcss-ecs-8f13:~/112# ls -l ../
total 12
drwxr-xr-x 3 root root 4096 Sep 16 20:16 112
-rw-r--r-- 1 root root   78 Sep 16 20:04 name.c
drwx------ 3 root root 4096 Sep 16 11:32 snap
root@hcss-ecs-8f13:~/112# ls -l
total 4
drwxr-xr-x 2 root root 4096 Sep 16 20:13 mydir
root@hcss-ecs-8f13:~/112# mv mydir ../
root@hcss-ecs-8f13:~/112# ls -l ../
total 16
drwxr-xr-x 2 root root 4096 Sep 16 20:16 112
drwxr-xr-x 2 root root 4096 Sep 16 20:13 mydir
-rw-r--r-- 1 root root   78 Sep 16 20:04 name.c
drwx------ 3 root root 4096 Sep 16 11:32 snap
root@hcss-ecs-8f13:~/112# ls -l
total 0
root@hcss-ecs-8f13:~/112# 

💥1.2 cat 指令

语法: cat [选项] [文件] 功能: 读取文件内容并将其输出到标准输出设备(通常是终端或屏幕) 常用选项:

  1. -b 对非空行输出行编号
  2. -n 对输出的所有行编号
  3. -s 不输出多行空行
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# pwd
/root/112
root@hcss-ecs-8f13:~/112# touch test.c
root@hcss-ecs-8f13:~/112# ls
test.c
root@hcss-ecs-8f13:~/112# nano test.c
root@hcss-ecs-8f13:~/112# cat test.c
#include <stdio.h>

int main()
{
    printf("hello world\n");
    return 0;
}
root@hcss-ecs-8f13:~/112# cat -b test.c
     1	#include <stdio.h>

     2	int main()
     3	{
     4	    printf("hello world\n");
     5	    return 0;
     6	}
root@hcss-ecs-8f13:~/112# cat -n test.c
     1	#include <stdio.h>
     2	
     3	int main()
     4	{
     5	    printf("hello world\n");
     6	    return 0;
     7	}
root@hcss-ecs-8f13:~/112# cat -s test.c
#include <stdio.h>

int main()
{
    printf("hello world\n");
    return 0;
}
root@hcss-ecs-8f13:~/112# 

cat会把文件中的所有内容显示出来,因此cat不适合看大文本,适合看小文本。

如果cat后什么都不跟,则通常情况下我们从键盘输入什么,屏幕上就输出什么。

代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# cat
hello world
hello world
Are you ok?
Are you ok?

tac指令: 功能和cat相反,逆序打印文件内容。

代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# ls 
mydir  name.c
root@hcss-ecs-8f13:~/112# tac name.c
}
    return 0;
    printf("hello world\n");
{
int main()

#include <stdio.h>
root@hcss-ecs-8f13:~/112# 

💥1.3 echo 指令

功能:

  • echo 文本: 在终端(命令行界面)上输出文本
  • echo 文本>文件(如果文件不存在则新建): 将文本写入到文件中
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# ls -l
total 4
drwxr-xr-x 2 root root 4096 Sep 16 20:13 mydir
root@hcss-ecs-8f13:~/112# echo "hello world"
hello world
root@hcss-ecs-8f13:~/112# echo "hello world">test.txt
root@hcss-ecs-8f13:~/112# ll
total 16
drwxr-xr-x 3 root root 4096 Sep 16 20:41 ./
drwx------ 7 root root 4096 Sep 16 20:23 ../
drwxr-xr-x 2 root root 4096 Sep 16 20:13 mydir/
-rw-r--r-- 1 root root   12 Sep 16 20:41 test.txt
root@hcss-ecs-8f13:~/112# cat test.txt
hello world
root@hcss-ecs-8f13:~/112# 

💥1.4 重定向

Linux下一切皆文件,Linux下,显示器、键盘、网卡、普通文件等都可以看作文件,只不过显示器只有写方法,向显示器打印,其实就是向显示器文件写入,无法从显示器读取数据。键盘只有读方法。而普通文件具有读写两个功能。 echo指令默认把后面跟的文本写入显示器文件中。cat指令后面如果没有跟任何文件,则默认从键盘文件中读取数据,然后写入到显示器文件中。

上面我们用echo 文本>(输出重定向)文件将文本写入到文件中,如果文件不存在则新建

代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# ll
total 12
drwxr-xr-x 3 root root 4096 Sep 16 22:47 ./
drwx------ 7 root root 4096 Sep 16 20:23 ../
drwxr-xr-x 2 root root 4096 Sep 16 21:57 dir/
root@hcss-ecs-8f13:~/112# echo "hello world">test.txt
root@hcss-ecs-8f13:~/112# cat test.txt
hello world
root@hcss-ecs-8f13:~/112# echo "Are you ok?" > test.txt
root@hcss-ecs-8f13:~/112# cat test.txt
Are you ok?
root@hcss-ecs-8f13:~/112# echo "aa" > test.txt
root@hcss-ecs-8f13:~/112# cat test.txt
aa
root@hcss-ecs-8f13:~/112# 

通过测试我们还可以得出,如果指定的文件里面有内容,则会先清空原内容,然后再写入(并不是覆盖)。

  • 当文件不存在时,>文件名可以新建空文件
  • 当文件存在时,>文件名可以清空文件内容
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# ll
total 12
drwxr-xr-x 3 root root 4096 Sep 16 22:58 ./
drwx------ 7 root root 4096 Sep 16 20:23 ../
drwxr-xr-x 2 root root 4096 Sep 16 21:57 dir/
root@hcss-ecs-8f13:~/112# >test.txt
root@hcss-ecs-8f13:~/112# ll
total 12
drwxr-xr-x 3 root root 4096 Sep 16 22:58 ./
drwx------ 7 root root 4096 Sep 16 20:23 ../
drwxr-xr-x 2 root root 4096 Sep 16 21:57 dir/
-rw-r--r-- 1 root root    0 Sep 16 22:58 test.txt
root@hcss-ecs-8f13:~/112# echo "Are you ok?" > test.txt
root@hcss-ecs-8f13:~/112# ll
total 16
drwxr-xr-x 3 root root 4096 Sep 16 22:58 ./
drwx------ 7 root root 4096 Sep 16 20:23 ../
drwxr-xr-x 2 root root 4096 Sep 16 21:57 dir/
-rw-r--r-- 1 root root   12 Sep 16 22:59 test.txt
root@hcss-ecs-8f13:~/112# cat test.txt
Are you ok?
root@hcss-ecs-8f13:~/112# >test.txt
root@hcss-ecs-8f13:~/112# ll
total 12
drwxr-xr-x 3 root root 4096 Sep 16 22:58 ./
drwx------ 7 root root 4096 Sep 16 20:23 ../
drwxr-xr-x 2 root root 4096 Sep 16 21:57 dir/
-rw-r--r-- 1 root root    0 Sep 16 22:59 test.txt
root@hcss-ecs-8f13:~/112# cat test.txt
root@hcss-ecs-8f13:~/112# 

>指定文件写入内容会把原内容删除掉,如果我们就不想删除原始内容,将新内容追加到原始内容后,可以用>>(追加重定向)实现。

代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# cat test.txt
root@hcss-ecs-8f13:~/112# echo "Are you ok?" > test.txt
root@hcss-ecs-8f13:~/112# cat test.txt
Are you ok?
root@hcss-ecs-8f13:~/112# echo "Hello" >> test.txt
root@hcss-ecs-8f13:~/112# cat test.txt
Are you ok?
Hello
root@hcss-ecs-8f13:~/112# 

除了>>>进行输出,还有输入重定向符号<。前面我们说了如果cat后面什么都不跟,则默认从键盘上取数据。所以如果我们用输入重定向符号<指定文件,则会输出文件中的内容。

代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# cat test.txt
Are you ok?
Hello
root@hcss-ecs-8f13:~/112# cat < test.txt
Are you ok?
Hello
root@hcss-ecs-8f13:~/112# 

💥1.5 more 指令

语法: more [选项] [文件] 功能: 分页显示文本文件内容,类似cat 常用选项:

  1. -n 对输出的所有行编号
  2. -s 将多个空行压缩成一个空行显示

快捷键:

  • 空格键: 显示下一页的内容
  • 回车键: 显示下一行的内容
  • b: 往回(向上)翻页,即显示上一页的内容
  • f: 往前(向下)翻页,功能与空格键相同
  • q: 退出 more

当我们想要查看一个文件的内容,但又不想一次性将整个文件内容全部加载到终端(或屏幕)上时,可以用more代替cat。

但是more指令我们也不太使用,因为我们更方便的指令来代替more。


💥1.6 less 指令

语法: less [参数] 文件 功能: less是一个功能强大的文本查看器,支持向前和向后滚动文本内容,以及搜索、跳转和复制等更多的功能。它特别适合用于查看大型文件或需要在文件的任意位置浏览内容的情况。 常用选项:

  1. -N 显示每行的行号
  2. / 字符串:向下搜索“字符串”的功能
  3. ?字符串:向上搜素字符串的功能
  4. n 重复前一个搜索
  5. N 反向重复前一个搜索

less指令也是按q退出,另外,less支持鼠标滑动来查看文件的上下内容, 相比之下less比more更好用。


💥1.7 head 指令

语法: head [参数]… 文件… 功能: 显示文本文件的头部内容,默认打印文件内容的前10行 常用选项:

  1. -n<行数> 显示的行数
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# head log.txt
hello 1
hello 2
hello 3
hello 4
hello 5
hello 6
hello 7
hello 8
hello 9
hello 10
root@hcss-ecs-8f13:~/112# head -n5 log.txt
hello 1
hello 2
hello 3
hello 4
hello 5
root@hcss-ecs-8f13:~/112# 

💥1.8 tail 指令

语法: tail [参数] 文件 功能: 与 head 相反,它默认显示文件的最后10行内容,但同样可以通过命令行选项来定制。不指定文件时,作为输入信息进行处理,常用查看日志文件 常用选项:

  1. -f 循环读取
  2. -n<行数> 显示行数
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# tail log.txt
hello 991
hello 992
hello 993
hello 994
hello 995
hello 996
hello 997
hello 998
hello 999
hello 1000
root@hcss-ecs-8f13:~/112# tail -n5 log.txt
hello 996
hello 997
hello 998
hello 999
hello 1000
root@hcss-ecs-8f13:~/112# 

| 管道举例:

管道符号| :它允许将一个命令的输出直接作为另一个命令的输入。

代码语言:javascript
复制
命令1 | 命令2 | 命令3 ...

问题: 文件log.txt有1000行内容,打印出第500行到510行之间的10行内容。

代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# head -n510 log.txt | tail -n10 log.txt
hello 991
hello 992
hello 993
hello 994
hello 995
hello 996
hello 997
hello 998
hello 999
hello 1000
root@hcss-ecs-8f13:~/112# 

💥1.9 时间相关的指令

| date命令

  • 功能: 用于显示和设置系统的日期和时间
  • 基本用法:
    • 查看当前时间: 直接在终端中输入date
    • 设置系统时间: 使用date -s后跟日期和时间字符串,格式为"YYYY-MM-DD HH:MM:SS",注意字符串需要用双引号括起来
    • 显示特定格式的日期和时间: 可以使用date +%F(显示年月日,等同于+%Y-%m-%d)等格式化选项
    • %H:小时
    • %M:分钟
    • %S:秒
    • %X:相当于%H:%M:%S
    • %d:日
    • %m:月
    • %Y:年
    • %F:相当于%Y-%m-%d
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# date
Wed Sep 18 11:19:19 PM CST 2024
root@hcss-ecs-8f13:~/112# date +%Y:%m:%d
2024:09:18
root@hcss-ecs-8f13:~/112# date +%Y:%m:%d:%H:%M:%S
2024:09:18:23:24:04
root@hcss-ecs-8f13:~/112# date +%F
2024-09-18
root@hcss-ecs-8f13:~/112# date +%X
11:27:49 PM
root@hcss-ecs-8f13:~/112# 

| 时间戳:

时间戳是指从某一特定时刻(通常是1970年1月1日 00:00:00 UTC,即协调世界时)起至现在的总秒数(或毫秒数、微秒数等,具体取决于系统和应用的精度需求)。这种时间表示方式是一种简单而有效的方法,用于在计算机系统和网络中记录时间信息。

  • 时间 -> 时间戳:date +%s
  • 时间戳 -> 时间:date -d@时间戳
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# date +%s
1726673405
root@hcss-ecs-8f13:~/112# date +%s
1726673436
root@hcss-ecs-8f13:~/112# date +%s
1726673452
root@hcss-ecs-8f13:~/112# date -d@1726673452
Wed Sep 18 11:30:52 PM CST 2024
root@hcss-ecs-8f13:~/112# 

💥1.10 find 指令

语法: find [路径] [选项] [操作] 功能: 在文件树中查找文件

  • 路径: 指定find命令开始搜索的目录路径。如果省略,find将从当前目录开始搜索
  • 选项: 用于指定搜索的条件或行为。选项可以是基于文件类型、名称、大小、时间戳等的过滤器
  • 操作: 对匹配的文件执行的操作。如果不指定操作,find将默认打印出所有匹配的文件路径 常用选项:
  1. -name:按文件名搜索。支持使用通配符(如*、?等)
  2. -iname:类似于-name,但搜索时不区分大小写
  3. -type:按文件类型搜索。例如,f表示普通文件,d表示目录
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# find -name test*
./test.txt
root@hcss-ecs-8f13:~/112# find -type d
.
./dir
root@hcss-ecs-8f13:~/112# 

💥1.11 grep 指令

语法: grep [选项]… 模式 [文件]… 功能: 在文件中搜索字符串,将找到的行打印出来 常用选项:

  1. -i: 忽略大小写
  2. -v: 反向选择,只显示不匹配的行
  3. -c: 计算匹配的行数,而不是显示匹配的行内容
  4. -l: 只列出包含匹配文本的文件名,而不显示匹配的行
  5. -L: 只列出不包含匹配文本的文件名
  6. -n: 显示匹配的行号及内
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# cat test.txt
hello world
hello World
hello WOrld
hello WORld
hello WORLd
hello WORLD
root@hcss-ecs-8f13:~/112# grep hello test.txt
hello world
hello World
hello WOrld
hello WORld
hello WORLd
hello WORLD
root@hcss-ecs-8f13:~/112# grep world test.txt
hello world
root@hcss-ecs-8f13:~/112# grep -i world test.txt
hello world
hello World
hello WOrld
hello WORld
hello WORLd
hello WORLD
root@hcss-ecs-8f13:~/112# grep -v world test.txt
hello World
hello WOrld
hello WORld
hello WORLd
hello WORLD
root@hcss-ecs-8f13:~/112# grep -iv world test.txt
root@hcss-ecs-8f13:~/112# grep -vn WORLD test.txt
1:hello world
2:hello World
3:hello WOrld
4:hello WORld
5:hello WORLd
root@hcss-ecs-8f13:~/112# 

实践中grep的使用率还是很高的,像查找进程等。


💥1.12 zip / unzip 指令

zip和unzip是两个非常常用的命令行工具,分别用于压缩文件和目录(打包成.zip格式)以及解压缩.zip文件。 语法: zip 压缩文件.zip 目录或文件 功能: 将目录或文件压缩成zip格式 常用选项:

  1. -r: 递归地将目录及子目录下的所有文件和目录都压缩到压缩文件中
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# ls -l
total 12
drwxr-xr-x 2 root root 4096 Sep 19 22:05 dir
drwxr-xr-x 2 root root 4096 Sep 19 22:09 mydir
-rw-r--r-- 1 root root   72 Sep 19 21:38 test.txt
root@hcss-ecs-8f13:~/112# tree dir
dir
├── test1
├── test2
└── test3

0 directories, 3 files
root@hcss-ecs-8f13:~/112# zip -r dir.zip dir
  adding: dir/ (stored 0%)
  adding: dir/test2 (stored 0%)
  adding: dir/test1 (stored 0%)
  adding: dir/test3 (stored 0%)
root@hcss-ecs-8f13:~/112# ls -l;
total 16
drwxr-xr-x 2 root root 4096 Sep 19 22:05 dir
-rw-r--r-- 1 root root  596 Sep 19 22:11 dir.zip
drwxr-xr-x 2 root root 4096 Sep 19 22:09 mydir
-rw-r--r-- 1 root root   72 Sep 19 21:38 test.txt
root@hcss-ecs-8f13:~/112# mv dir.zip ./mydir
root@hcss-ecs-8f13:~/112# cd mydir
root@hcss-ecs-8f13:~/112/mydir# pwd
/root/112/mydir
root@hcss-ecs-8f13:~/112/mydir# ls -l
total 4
-rw-r--r-- 1 root root 596 Sep 19 22:11 dir.zip
root@hcss-ecs-8f13:~/112/mydir# unzip dir.zip
Archive:  dir.zip
   creating: dir/
 extracting: dir/test2               
 extracting: dir/test1               
 extracting: dir/test3               
root@hcss-ecs-8f13:~/112/mydir# tree 
.
├── dir
│   ├── test1
│   ├── test2
│   └── test3
└── dir.zip

1 directory, 4 files
root@hcss-ecs-8f13:~/112/mydir# 

unzip默认是解压到当前目录,当然我们也可以加上-d选项后解压到指定目录下。

代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# ll
total 20
drwxr-xr-x 5 root root 4096 Sep 19 22:27 ./
drwx------ 7 root root 4096 Sep 19 21:28 ../
drwxr-xr-x 2 root root 4096 Sep 19 22:26 dir/
drwxr-xr-x 2 root root 4096 Sep 19 22:27 mydir/
drwxr-xr-x 2 root root 4096 Sep 19 22:18 otherdir/
root@hcss-ecs-8f13:~/112# zip -r dir.zip dir
  adding: dir/ (stored 0%)
  adding: dir/test2 (stored 0%)
  adding: dir/test1 (stored 0%)
  adding: dir/test3 (stored 0%)
root@hcss-ecs-8f13:~/112# ll
total 24
drwxr-xr-x 5 root root 4096 Sep 19 22:28 ./
drwx------ 7 root root 4096 Sep 19 21:28 ../
drwxr-xr-x 2 root root 4096 Sep 19 22:26 dir/
-rw-r--r-- 1 root root  596 Sep 19 22:28 dir.zip
drwxr-xr-x 2 root root 4096 Sep 19 22:27 mydir/
drwxr-xr-x 2 root root 4096 Sep 19 22:18 otherdir/
root@hcss-ecs-8f13:~/112# mv dir.zip ./mydir
root@hcss-ecs-8f13:~/112# ll
total 20
drwxr-xr-x 5 root root 4096 Sep 19 22:28 ./
drwx------ 7 root root 4096 Sep 19 21:28 ../
drwxr-xr-x 2 root root 4096 Sep 19 22:26 dir/
drwxr-xr-x 2 root root 4096 Sep 19 22:28 mydir/
drwxr-xr-x 2 root root 4096 Sep 19 22:18 otherdir/
root@hcss-ecs-8f13:~/112# cd mydir
root@hcss-ecs-8f13:~/112/mydir# ll
total 12
drwxr-xr-x 2 root root 4096 Sep 19 22:28 ./
drwxr-xr-x 5 root root 4096 Sep 19 22:28 ../
-rw-r--r-- 1 root root  596 Sep 19 22:28 dir.zip
root@hcss-ecs-8f13:~/112/mydir# unzip dir.zip
Archive:  dir.zip
   creating: dir/
 extracting: dir/test2               
 extracting: dir/test1               
 extracting: dir/test3               
root@hcss-ecs-8f13:~/112/mydir# tree
.
├── dir
│   ├── test1
│   ├── test2
│   └── test3
└── dir.zip

1 directory, 4 files
root@hcss-ecs-8f13:~/112/mydir# unzip dir.zip -d ../otherdir
Archive:  dir.zip
   creating: ../otherdir/dir/
 extracting: ../otherdir/dir/test2   
 extracting: ../otherdir/dir/test1   
 extracting: ../otherdir/dir/test3   
root@hcss-ecs-8f13:~/112/mydir# ll
total 16
drwxr-xr-x 3 root root 4096 Sep 19 22:29 ./
drwxr-xr-x 5 root root 4096 Sep 19 22:28 ../
drwxr-xr-x 2 root root 4096 Sep 19 22:26 dir/
-rw-r--r-- 1 root root  596 Sep 19 22:28 dir.zip
root@hcss-ecs-8f13:~/112/mydir# cd ..
root@hcss-ecs-8f13:~/112# cd otherdir
root@hcss-ecs-8f13:~/112/otherdir# ll
total 12
drwxr-xr-x 3 root root 4096 Sep 19 22:29 ./
drwxr-xr-x 5 root root 4096 Sep 19 22:28 ../
drwxr-xr-x 2 root root 4096 Sep 19 22:26 dir/
root@hcss-ecs-8f13:~/112/otherdir# tree
.
└── dir
    ├── test1
    ├── test2
    └── test3

1 directory, 3 files
root@hcss-ecs-8f13:~/112/otherdir# 

💥1.13 tar 指令

功能: 打包和解包文件 常用选项:

  1. -c :建立一个压缩文件的参数指令(create 的意思);
  2. -x :解开一个压缩文件的参数指令
  3. -z :是否同时具有 gzip 的属性?亦即是否需要用 gzip 压缩?
  4. -v :显示详细过程
  5. -f :指定归档文件的名称,在 f 之后要立即接档名
  6. -C : 解压到指定目录

示例:

  • tar czf dir.tgz dir:将目录dir打包成dir.zip文件
  • tar cvzf dir.tgz dir:在打包过程中显示详细过程
  • tar xzf dir.tgz:将文件dir.zip解压到当前目录
  • tar xzf dir.tgz -C otherdir:将文件dir.zip解压到指定目录

💥1.14 bc指令

一个任意精度的计算器语言,通常用于执行数学运算。

  • echo 1+2+3+4+5 | bc:把计算结果输出到屏幕上

💥1.15 uname 指令

语法: uname [选项] 功能: uname用来获取电脑和操作系统的相关信息 常用选项:

  1. -a : 显示所有信息,这通常包括内核名称、主机名、内核发行版、处理器类型、硬件平台、操作系统名称等
  2. -s :显示内核名称
  3. -n :显示主机名
  4. -r :显示内核发行版
代码语言:javascript
复制
root@hcss-ecs-8f13:~/112# uname -a
Linux hcss-ecs-8f13 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
root@hcss-ecs-8f13:~/112# uname -r
5.15.0-113-generic
root@hcss-ecs-8f13:~/112# uname -n
hcss-ecs-8f13
root@hcss-ecs-8f13:~/112# uname -s
Linux
root@hcss-ecs-8f13:~/112# 

💥1.16 几个重要的热键

  • [Tab]:命令补全和档案补齐的功能
  • [Ctrl + c]:停掉当前程序
  • [Ctrl + d]:关闭整个终端会话
  • [Ctrl + r]:历史命令搜索

本篇文章的分享就到这里了,如果您觉得在本文有所收获,还请留下您的三连支持哦~

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-09-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 前言
  • 💥一、Linux基本指令
    • 💥1.1 mv 指令
      • 💥1.2 cat 指令
        • 💥1.3 echo 指令
          • 💥1.4 重定向
            • 💥1.5 more 指令
              • 💥1.6 less 指令
                • 💥1.7 head 指令
                  • 💥1.8 tail 指令
                    • 💥1.9 时间相关的指令
                      • 💥1.10 find 指令
                        • 💥1.11 grep 指令
                          • 💥1.12 zip / unzip 指令
                            • 💥1.13 tar 指令
                              • 💥1.14 bc指令
                                • 💥1.15 uname 指令
                                  • 💥1.16 几个重要的热键
                                  相关产品与服务
                                  命令行工具
                                  腾讯云命令行工具 TCCLI 是管理腾讯云资源的统一工具。使用腾讯云命令行工具,您可以快速调用腾讯云 API 来管理您的腾讯云资源。此外,您还可以基于腾讯云的命令行工具来做自动化和脚本处理,以更多样的方式进行组合和重用。
                                  领券
                                  问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档