Linux常用命令集合

Linux常用命令集合

用户管理命令

  1. 添加用户 adduser或useradd
    例:adduser user_name -- 注意根据自己的真实需求修改user_name

  2. 修改用户账号的各种设定 usermod
    例:usermod -G sudo user_name -- 注意根据自己的真实需求修改user_name

  3. 删除用户 deluser或deluser
    例:deluser user_name

  4. 切换用户
    例:su - user_name -- 注意根据自己的真实需求修改user_name

  5. 修改密码
    例:passwd user_name -- 帮user_name这个用户修改密码,注意根据自己的真实需求修改user_name

  6. 获取管理员权限
    例: sudo

总结

这里简单列举用户管理相关的部分命令,其中还有一大系列相关命令,例如用户组管理的。

注意

在Ubuntu下useradd与adduser有所不同
1)useradd在使用该命令创建用户是不会在/home下自动创建与用户名同名的用户目录,而且不会自动选择shell版本,也没有设置密码,那么这个用户是不能登录的,需要使用passwd命令修改密码。
2)adduser在使用该命令创建用户是会在/home下自动创建与用户名同名的用户目录,系统shell版本,会在创建时会提示输入密码,更加友好。

Ubuntu与软件安装相关的命令

  1. apt (软件管家)

  2. apt update (同步软件信息:有那些软件可用,那些可以更新,那些可以卸载)

  3. apt upgrade (更新本地软件为最新的版本)

  4. apt-cache search xxx (搜索xxx软件)

  5. apt install xxx(安装xxx软件)

  6. apt remove xxx(卸载xxx软件)

文件及目录相关命令

  1. 查看目录内容 -- ls
    例: ls -lah -- 查看某个目录下所有文件(包括以.开头的隐藏文件)的详细信息;其中选项a的作用输出包括隐藏文件,l是列出文件详细信息,h是以人类可读的友好形式输出信息。

  2. 目录跳转 -- cd
    例:
    cd xxx/ 跳转到xxx目录
    cd ~ 跳转到当前登陆用户的家目录
    cd 跳转到当前登陆用户的家目录
    cd - 跳转回上一次的工作目录
    cd ~xxx 跳转到xxx用户的家目录
    cd .. 返回上一级目录

  3. 打印工作目录 -- pwd 全称 print working directory
    例: pwd

  4. 拷贝文件 -- cp
    例:cp 1.c 2.c 用1.c拷贝一份新文件并命名2.c

  5. 移动文件及目录,也可以用于修改文件名字 -- mv
    例:
    mv 1.c ../ 把文件1.c移动到上一级目录
    mv 1.c 2.c 把文件1.c修改为名称2.c

  6. 删除文件 -- rm linux最神奇命令之一,删库跑路神器,慎用。
    例:rm /* -rf 从根目录开始,删除所有文件, 慎用,最好别执行

  7. 创建一个目录 -- mkdir
    例:
    mkdir test 在当前工作目录下创建一个新目录test
    mkdir -p all/test 在当前目录下创建一个在all目录下的新目录test,-p表示若创建的新目录的上一级all不存在,则创建all后再创建test,不加-p会失败。

  8. 删除一个空目录 -- rmdir
    例:rmdir test/ 删除当前目录下的一个空目录test,若目录test不是空目录,则删除失败,感觉这个命令有点没用,只能删除空目录,还不如直接用 rm xxx/ -r替代。

  9. 打印目录树 -- tree
    例:tree 打印当前目录下的目录树,某些系统可能没有该命令,若没有则根据系统自行安装,ubuntu则为 sudo apt install tee.

  10. 文件归档,压缩和解压等操作 -- tar
    这个命令非常好用且强大复杂,不止用于压缩和解压文件,这里我们简单介绍一下,首先要弄清两个概念:打包和压缩。打包是指将一大堆文件或目录变成一个总的文件;压缩则是将一个大的文件通过一些压缩算法变成一个小文件。
    详细使用例子。仔细阅读。

ydqun@VM-0-9-ubuntu trash % tar -cvf test.tar test.txt #把test.txt打包成一个tar包,注意不是压缩。
ydqun@VM-0-9-ubuntu trash % tar -zcvf test.tar.gz test.txt #把test.txt打包成一个tar包后,并以gzip去压缩,生成一个gz压缩包
ydqun@VM-0-9-ubuntu trash % ls -lah test.t* #查看大小,对比原文件和打包后的文件,压缩后的文件大小                                                                                                                                                               
-rw-r--r-- 1 ydqun root 150K Jan 14 13:47 test.tar  #可以看到打包后的tar包大小与原文件大小差不多
-rw-r--r-- 1 ydqun root  13K Jan 14 13:47 test.tar.gz #压缩后的gz包的大小明显比原文件小
-rwxrwxrwx 1 ydqun root 146K Jan 14 13:47 test.txt  #原文件
ydqun@VM-0-9-ubuntu trash % rm test.txt #刪除原文件                                                                                                                                                                  
ydqun@VM-0-9-ubuntu trash % ls -lah test.t*                                                                                                                                                               
-rw-r--r-- 1 ydqun root 150K Jan 14 13:47 test.tar
-rw-r--r-- 1 ydqun root  13K Jan 14 13:47 test.tar.gz
ydqun@VM-0-9-ubuntu trash % tar -xvf test.tar #从tar包中拿出原文件                                                                                                                                                            
test.txt
ydqun@VM-0-9-ubuntu trash % ls -lah test.t*                                                                                                                                                               
-rw-r--r-- 1 ydqun root 150K Jan 14 13:47 test.tar
-rw-r--r-- 1 ydqun root  13K Jan 14 13:47 test.tar.gz
-rwxr-xr-x 1 ydqun root 146K Jan 14 13:47 test.txt
ydqun@VM-0-9-ubuntu trash % rm test.txt                                                                                                                                                                   
ydqun@VM-0-9-ubuntu trash % tar -zxvf test.tar.gz  #从gz压缩包中解压出原文件                                                                                                                                                       
test.txt
ydqun@VM-0-9-ubuntu trash % ls -lah test.t*                                                                                                                                                               
-rw-r--r-- 1 ydqun root 150K Jan 14 13:47 test.tar
-rw-r--r-- 1 ydqun root  13K Jan 14 13:47 test.tar.gz
-rwxr-xr-x 1 ydqun root 146K Jan 14 13:47 test.txt

其他具体使用方法可以去看man手册或者google一下用法。

  1. 创建链接文件 -- ln
    Linux ln(英文全拼:link files)命令是一个非常重要命令,它的功能是为某一个文件在另外一个位置建立一个同步的链接。当我们需要在不同的目录,用到相同的文件时,我们不需要在每一个需要的目录下都放一个必须相同的文件,
    我们只要在某个固定的目录,放上该文件,然后在 其它的目录下用ln命令链接(link)它就可以,不必重复的占用磁盘空间。
    不论是硬链接或软链接都不会将原本的档案复制一份,只会占用非常少量的磁碟空间。

什么是软硬链接?

软链接:
1.软链接,以路径的形式存在。类似于Windows操作系统中的快捷方式
2.软链接可以 跨文件系统 ,硬链接不可以
3.软链接可以对一个不存在的文件名进行链接
4.软链接可以对目录进行链接
硬链接:
1.硬链接,以文件副本的形式存在。但不占用实际空间。
2.不允许给目录创建硬链接
3.硬链接只有在同一个文件系统中才能创建
ln命令非常重要,这里简单的列举一下用法,具体其他细节可以google
例:

建立软链接

ydqun@VM-0-9-ubuntu trash % cat hello_world.cpp                                                                                                                                                                                      [0]
#include <iostream>
using namespace std;

int main() {
    cout << "Hello world!" << endl;
    return 0;
}
ydqun@VM-0-9-ubuntu trash % g++ hello_world.cpp -o hello_world                                                                                                                                                                        [0]
ydqun@VM-0-9-ubuntu trash % ln -s hello_world soft  #为hello_world文件创建一个软链接   -s表示创建的链接是软连接                                                                                                                                                                                 [0]
ydqun@VM-0-9-ubuntu trash % ./soft #发现,这里可以执行hello_world对应的软链接soft                                                                                                                                                                                                  [0]
Hello world!
ydqun@VM-0-9-ubuntu trash % ls -l hello_world soft                                                                                                                                                                                    [0]
-rwxr-xr-x 2 ydqun root 8928 Jan 14 14:27 hello_world
lrwxrwxrwx 1 ydqun root   11 Jan 14 14:57 soft -> hello_world  #查看出来soft是一个软链接,对应的原文件hello_world,而且大小比原文件小,可以理解软链接就是windows上的快捷方式
ydqun@VM-0-9-ubuntu trash % rm hello_world  #删除原文件                                                                                                                                                                                        [0]
ydqun@VM-0-9-ubuntu trash % ./soft  #再次执行链接文件                                                                                                                                                                                                 [0]
zsh: no such file or directory: ./soft #执行失败
ydqun@VM-0-9-ubuntu trash % ls -l soft #再次查看软链接文件,发现输出信息变红(我这里无法在博客上把输出信息标红色,在Linux上删除原文件,链接文件查询时会输出红色)                                                                                                                                                                                            [127]
lrwxrwxrwx 1 ydqun root 11 Jan 14 14:57 soft -> hello_world

建立硬链接

ydqun@VM-0-9-ubuntu trash % g++ hello_world.cpp -o hello_world                                                                                                                                            
ydqun@VM-0-9-ubuntu trash % ln hello_world hard  #为hello_world 创建一个硬链接文件hard                                                                                                                                                         [0]
ydqun@VM-0-9-ubuntu trash % ./hard #发现可以执行硬链接文件                                                                                                                                                                       [0]
Hello world!
ydqun@VM-0-9-ubuntu trash % ls -l hello_world hard #对比原文件hello_world和硬链接文件hard,发现文件大小一样                                                                                                                                                       [0]
-rwxr-xr-x 2 ydqun root 8928 Jan 14 15:23 hard
-rwxr-xr-x 2 ydqun root 8928 Jan 14 15:23 hello_world
ydqun@VM-0-9-ubuntu trash % rm hello_world  #删除原文件文件                                                                                                                                                              [0]
ydqun@VM-0-9-ubuntu trash % ./hard #发现删除原文件后,硬链接文件还是可以执行。                                                                                                                                                                       [0]
Hello world!
ydqun@VM-0-9-ubuntu trash %  

文件的内容及修改相关的命令

  1. 创建空白文件 -- touch
ydqun@VM-0-9-ubuntu trash % touch hello                                                                                                                                                                   
ydqun@VM-0-9-ubuntu trash % cat hello                                                                                                                                                                     
ydqun@VM-0-9-ubuntu trash % ls -l hello                                                                                                                                                                   
-rw-r--r-- 1 ydqun root 0 Jan 14 15:30 hello
  1. 查看文件内容 -- cat
ydqun@VM-0-9-ubuntu trash % cat hello_world.cpp                                                                                                                                                           
#include <iostream>
using namespace std;

int main() {
    cout << "Hello world!" << endl;
    return 0;
}
  1. 文本编辑器 -- vim (用的好的话就是神器)
    ydqun@VM-0-9-ubuntu trash % vim hello_world.cpp
    这里不介绍了,具体用法可以去网上找资料。
  2. 打印文本 -- echo
ydqun@VM-0-9-ubuntu trash % echo ${SHELL}                                                                                                                                                                 
/bin/zsh
ydqun@VM-0-9-ubuntu trash % echo "hello world\!"   #注意,因为我这里用的是zsh不bash,所以!要用反斜杠\转义,用bash的不用,一般linux用户默认使用bash                                                                                                                                                      [130]
hello world!
  1. 分页查看文件 -- more
    例:
ydqun@VM-0-9-ubuntu trash % more /usr/include/stdio.h
  1. 加强版分页查看文件 -- less
    为啥less是加强版? 因为less支持搜索,高亮提示等,比more更加强大,在less的输出界面中按下/,再输入你要查找的内容,就可以定位到并高亮显示,按下小写n可以搜索下一个,按下N可以搜索上一个
    例:
ydqun@VM-0-9-ubuntu trash % less /usr/include/stdio.h
  1. 查看文件内容头部 -- head
    例:
ydqun@VM-0-9-ubuntu /home % head -n 2 /usr/include/stdio.h  #查看/usr/include/stdio.h的前2行, -n num 表示查看前num行,不加-n会默认查看前10行。                                                                                                                                              
/* Define ISO C stdio on top of C++ iostreams.
   Copyright (C) 1991-2018 Free Software Foundation, Inc.
  1. 查看文件内容尾部 -- tail(这个命令也是一个非常实用的神器,一般用来查看log文件,特别好用)
    例:

(1)普通玩家用法

ydqun@VM-0-9-ubuntu /home % tail -n 6 /usr/include/stdio.h  #查看/usr/include/stdio.h文件的最后6行,不加-n会默认查看最后10行                                                                                                                                              
# include <bits/stdio-ldbl.h>
#endif

__END_DECLS

#endif /* <stdio.h> included.  */

(2)聪明玩家用法

ydqun@VM-0-9-ubuntu trash % cat 4.c                                                                                                                                                                     
/*************************************************************************
        > File Name: 4.c
        > Author: yudongqun
        > Mail: qq2841015@163.com
        > Created Time: Thu 14 Jan 2021 04:34:14 PM CST
 ************************************************************************/
//4.c 一个一直每0.5秒往1.txt不断累加重定向hello字符的程序
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(void) {
    while (1) {
        usleep(500000);
        system("echo hello >> 1.txt");
    }
    return 0;
}                                                                                                                                                                       
ydqun@VM-0-9-ubuntu trash % gcc 4.c                                                                                                                                                                        
ydqun@VM-0-9-ubuntu trash % ./a.out  &                                                                                                                                                                   
[1] 2897
ydqun@VM-0-9-ubuntu trash % tail -f 1.txt                                                                                                                                                                 
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
hello
^C
ydqun@VM-0-9-ubuntu trash % pkill a.out                                                                                                                                                                  
[1]  + 2897 terminated  ./a.out
ydqun@VM-0-9-ubuntu trash %   

由上面的例子,我们可以看到,利用tail -f去查看某些日志文件非常好用,特别是配合Linux命令三剑客grep,sed,awk一起食用,香的一批。

  1. 对比文件 -- diff

ydqun@VM-0-9-ubuntu trash % cat 4.c                                                                                                                                                                       
/*************************************************************************
        > File Name: 4.c
        > Author: yudongqun
        > Mail: qq2841015@163.com
        > Created Time: Thu 14 Jan 2021 04:34:14 PM CST
 ************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(void) {
    while (1) {
        usleep(500000);
        system("echo hello world!>> 1.txt");
    }
    return 0;
}

ydqun@VM-0-9-ubuntu trash % cat 4.c.bk                                                                                                                                                                    
/*************************************************************************
        > File Name: 4.c
        > Author: yudongqun
        > Mail: qq2841015@163.com
        > Created Time: Thu 14 Jan 2021 04:34:14 PM CST
 ************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(void) {
    while (1) {
        usleep(500000);
        system("echo hello >> 1.txt");
    }
    return 0;
}
ydqun@VM-0-9-ubuntu trash % diff 4.c 4.c.bk  #对比两个文件的内容那里不同,可以看到第14行有存在不同的内容。                                                                                                                                                             
14c14
<         system("echo hello world!>> 1.txt");
---
>         system("echo hello >> 1.txt");
ydqun@VM-0-9-ubuntu trash %  
  1. 信息检索 -- grep
    这个命令特别强大,学会了可以提高你使用linux的效率,建立google或必应这个命令去学习一下。
    例:
ydqun@VM-0-9-ubuntu trash % grep "hello" 4.c                                                                                                                                                              
        system("echo hello world!>> 1.txt");
  1. 计数 -- wc
    例:
ydqun@VM-0-9-ubuntu trash % last  | wc -l  #last单独执行用于查看最近登录你的系统的记录,配合管道|和wc就可以算出你最近一共登录了多少次你的系统。                                                                                                                                                  
139

文件的查找与定位

这一部分命令特别常用,掌握了这些命令可以在Linux上找到你任何感兴趣的文件。

  1. 查找文件 -- find
    Linux find 命令用来在指定目录下查找文件,如果指定的目录文件很多,查找效率会很低下,可以用下面介绍的命令代替。
    例:
ydqun@VM-0-9-ubuntu workspace % find /usr/  -name "stdio.h"                                                                                                                                        
find: ‘/usr/local/qcloud/YunJing’: Permission denied
/usr/include/x86_64-linux-gnu/bits/stdio.h
/usr/include/stdio.h
/usr/include/c++/7/tr1/stdio.h
  1. 查找可执行文件 -- which
    which 专门用来查找可执行文件,效率很快,但不能查找其他类型文件,例如,可能你会好奇linux的某些命令究竟存放在那些目录,这时候你就可以用which查找了,因为这些命令本质上也是可执行文件。
    例:
ydqun@VM-0-9-ubuntu workspace % which wc                                                                                                                                                                  
/usr/bin/wc
ydqun@VM-0-9-ubuntu workspace % which find                                                                                                                                                                
/usr/bin/find
ydqun@VM-0-9-ubuntu workspace %  
  1. 查找可执行、源码、帮助手册等 -- whereis
    whereis 查找可执行、源码、帮助手册等,相对于which来说,查找的范围比较大。
ydqun@VM-0-9-ubuntu workspace % whereis vim                                                                                                                                                               
vim: /usr/bin/vim /usr/bin/vim.basic /usr/bin/vim.gtk3 /usr/bin/vim.tiny /etc/vim /usr/share/vim /usr/share/man/man1/vim.1.gz
  1. 定位任何文件 -- locate
    locate 可以定位任何文件,但是属于模糊匹配,可能会定位出很多你不想要看到的结果,通常可以在配合一些文本处理命令,例如grep来一起使用。另外,locate查询效率特别高,因为它会利用系统空闲时间进行扫描,建立搜索索引。
ydqun@VM-0-9-ubuntu workspace % locate curl                                                                                                                                                               
/usr/bin/curl
/usr/lib/python2.7/macurl2path.py
/usr/lib/python2.7/macurl2path.pyc
/usr/lib/python3.6/macurl2path.py
/usr/lib/python3.6/__pycache__/macurl2path.cpython-36.pyc
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.3
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.5.0

进程相关命令

这一部分命令特别重要,需要重点掌握。

  1. 打印正在运行的进程 -- ps
  2. 向进程发送信号 -- kill (常用于杀死进程)
  3. 批量杀死进程 -- pkill
  4. 批量杀死进程 -- killall
  5. 挂起前台进程 -- ctrl+z (这个是直接按键盘就可以,不是输入命令)
  6. 将进程调至前台运行 -- fg
  7. 让挂起的进程后台执行 -- bg
  8. 查看挂起和在后台执行的进程 -- jobs

系统信息获取命令

  1. 查看时间 -- date
    例:
date +"%Y-%m-%d %H:%M:%S"
  1. 查看文件系统 -- df
    例:
ydqun@VM-0-9-ubuntu workspace % df  -h                                                                                                                                                                    [0]
Filesystem      Size  Used Avail Use% Mounted on
udev            1.9G  4.0K  1.9G   1% /dev
tmpfs           379M  6.9M  372M   2% /run
/dev/vda1        50G  8.2G   39G  18% /
tmpfs           1.9G   24K  1.9G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs           379M     0  379M   0% /run/user/1000
tmpfs           379M     0  379M   0% /run/user/1002
  1. 获取目录文件大小 -- du
ydqun@VM-0-9-ubuntu trash % du -h                                                                                                                                                                         [0]
4.0K    ./all/test
8.0K    ./all
236K    .
  1. 查看内存使用情况 -- free
ydqun@VM-0-9-ubuntu trash % free  -h                                                                                                                                                                      [0]
              total        used        free      shared  buff/cache   available
Mem:           3.7G        257M        268M        6.9M        3.2G        3.2G
Swap:            0B          0B          0B
  1. 查看系统资源信息 -- top
ydqun@VM-0-9-ubuntu trash % top  
top - 18:19:24 up 105 days,  1:37,  6 users,  load average: 1.13, 0.99, 0.96
Tasks: 116 total,   1 running,  73 sleeping,   3 stopped,   0 zombie
%Cpu(s):  0.3 us,  0.3 sy,  0.0 ni, 98.3 id,  1.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3875632 total,   274644 free,   264480 used,  3336508 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  3317676 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 3066 root      20   0 1006876  56676  13916 S  0.3  1.5  84:53.81 YDService
 8434 root      20   0  511216  16852   4300 S  0.3  0.4 106:08.56 barad_agent
20379 ydqun     20   0   41164   3844   3212 R  0.3  0.1   0:00.06 top
    1 root      20   0  225584   9316   6712 S  0.0  0.2   5:46.86 systemd
    2 root      20   0       0      0      0 S  0.0  0.0   0:02.27 kthreadd
    4 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 kworker/0:0H
    6 root       0 -20       0      0      0 I  0.0  0.0   0:00.00 mm_percpu_wq
    7 root      20   0       0      0      0 S  0.0  0.0  12:35.24 ksoftirqd/0
    8 root      20   0       0      0      0 I  0.0  0.0  23:04.84 rcu_sched
    9 root      20   0       0      0      0 I  0.0  0.0   0:00.00 rcu_bh
   10 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0
   11 root      rt   0       0      0      0 S  0.0  0.0   0:26.37 watchdog/0
   12 root      20   0       0      0      0 S  0.0  0.0   0:00.00 cpuhp/0
......
  1. 查看,配置网络接口信息 -- ifconfig
ydqun@VM-0-9-ubuntu trash % ifconfig                                                                                                                                                                      [0]
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.9  netmask 255.255.240.0  broadcast 172.17.15.255
        inet6 fe80::5054:ff:feaa:83d9  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:aa:83:d9  txqueuelen 1000  (Ethernet)
        RX packets 58688780  bytes 6893873919 (6.8 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 65432228  bytes 11605248336 (11.6 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1847187  bytes 150829854 (150.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1847187  bytes 150829854 (150.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  1. 查看操作系统信息 -- uname
ydqun@VM-0-9-ubuntu trash %  uname -a                                                                                                                                                                     
Linux VM-0-9-ubuntu 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  1. 查看最近登录记录 -- last
ydqun@VM-0-9-ubuntu trash % last  | head -n 3                                                                                                                                                             [0]
cjj      pts/4        47.101.137.128   Thu Jan 14 16:06   still logged in
cjj      pts/4        47.101.137.128   Thu Jan 14 16:04 - 16:06  (00:01)
ydqun    pts/1        47.101.137.128   Thu Jan 14 16:00   still logged in
  1. 查看当前登陆的用户 -- who
ydqun@VM-0-9-ubuntu trash % who                                                                                                                                                                           [0]
ydqun    tty1         2020-12-28 13:52
ydqun    pts/1        2021-01-14 16:00 (47.101.137.128)
root     pts/2        2020-12-18 08:47 (tmux(18542).%2)
root     pts/3        2020-12-21 15:51 (tmux(18542).%5)
cjj      pts/4        2021-01-14 16:06 (47.101.137.128)
root     pts/5        2020-12-29 10:09 (tmux(18542).%6)

其他命令

  1. 远程连接 -- ssh
  2. 远程拷贝 -- scp
  3. 获取http文件 -- wget
  4. 测试远程主机 -- ping
  5. 关机 -- poweroff
  6. 重启 -- reboot
posted @ 2021-01-13 21:48  ydqun  阅读(61)  评论(0编辑  收藏  举报