BypResearch Common Linux Commands IT_LINUX BYP 20180611 2021-04-04 20:17:50 e728c055-6d82-11e8-b84d-00163e089d7a TrueCommon Linux Commands
Common Linux Commands
du -h --max-depth=1 /home/* 列出home下面所有一级目录的一级目录文件大小。
查看硬盘空间:df -hl (可以查询加挂的硬盘)
du -hsx * | sort -rh | head -10
压缩文件夹:tar -zcvf ./xahot.tar.gz xahot/ 如果需要关闭终端后台执行可以在前面增加使用nohup(no hungup)命令
远称传输命令:
scp -r assets.tar.gz root@120.120.120.120:/home/HYYB20191219/ 系统会提示输入目标服务器连接密码
更新升级:
sudo apt-get update 更新源
sudo apt-get upgrade 更新已安装的包
sudo apt-get dist-upgrade 升级系统
(Ubuntu)
#cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
.......
#compgen -u
root
bin
......只显示用户名称
#getent passwd
root:x:0:0:root:/root:/bin/bash
......显示每个用户的权限和目录地址
*******:x:65561:65536:*******:/share/*******:/bin/bash
#id
uid=0(root) gid=0(root) 组=0(root)
[*******@mgt ~]$ id
uid=65561(*******) gid=65536(default_os_group) 组=65536(default_os_group)
root@mgt:~#whoami
root
[*******@mgt ~]$ who
(unknown) :0 2022-08-02 09:43 (:0)
root pts/0 2022-08-20 21:34 (116.22.***.***)
******* pts/1 2022-08-20 21:34 (116.22.***.***)
[*******@mgt ~]$ rpm -qa | grep libffi
libffi-3.0.13-19.el7.x86_64
libffi-devel-3.0.13-19.el7.x86_64
[*******@mgt ~]$ yum list installed | grep libffi
libffi.x86_64 3.0.13-19.el7 @base
libffi-devel.x86_64 3.0.13-19.el7 @base
[*******@mgt ~]$ whereis python