• Linux 常用命令


    1、打包命令:tar -cvf 目标名称.tar 源名称

    2、解压命令:tar xvf 压缩包名称

    3、查看cpu大小:cat /proc/cpuinfo | grep "model name" && cat /proc/cpuinfo | grep "physical id"

    4、查看内存大小:cat /proc/meminfo | grep MemTotal

    5、查看当前系统磁盘使用空间:df -h

    6、查看当前目录文件占用空间大小:du -sh

    7、启动nginx服务:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf //根据nginx.conf里的配置,启动nginx服务

    8、查找文件:whereis '文件名'

    9、查看当前目录:pwd

    10、ls 查看目录中的文件 
    11、ls -F 查看目录中的文件 
    12、ls -l 显示文件和目录的详细资料 
    13、ls -a 显示隐藏文件 
    14、ls *[0-9]* 显示包含数字的文件名和目录名 
    15、tree 显示文件和目录由根目录开始的树形结构
    16、lstree 显示文件和目录由根目录开始的树形结构
    17、mkdir dir1 创建一个叫做 'dir1' 的目录' 
    18、mkdir dir1 dir2 同时创建两个目录 
    19、mkdir -p /tmp/dir1/dir2 创建一个目录树 
    21、rm -f file1 删除一个叫做 'file1' 的文件' 
    22、rmdir dir1 删除一个叫做 'dir1' 的目录' 
    23、rm -rf dir1 删除一个叫做 'dir1' 的目录并同时删除其内容 
    24、rm -rf dir1 dir2 同时删除两个目录及它们的内容 
    25、mv dir1 new_dir 重命名/移动 一个目录 
    26、cp file1 file2 复制一个文件 
    27、cp dir/* . 复制一个目录下的所有文件到当前工作目录 
    28、cp -a /tmp/dir1 . 复制一个目录到当前工作目录 
    29、cp -a dir1 dir2 复制一个目录  cp -r dir1 dir2 复制一个目录及子目录

    30、find / -name file1 从 '/' 开始进入根文件系统搜索文件和目录 
    31、find / -user user1 搜索属于用户 'user1' 的文件和目录 
    32、find /home/user1 -name *.bin 在目录 '/ home/user1' 中搜索带有'.bin' 结尾的文件 
    33、find /usr/bin -type f -atime +100 搜索在过去100天内未被使用过的执行文件 
    34、find /usr/bin -type f -mtime -10 搜索在10天内被创建或者修改过的文件 
    35、find / -name *.rpm -exec chmod 755 '{}' ; 搜索以 '.rpm' 结尾的文件并定义其权限 
    36、find / -xdev -name *.rpm 搜索以 '.rpm' 结尾的文件,忽略光驱、捷盘等可移动设备 
    37、locate *.ps 寻找以 '.ps' 结尾的文件 - 先运行 'updatedb' 命令 
    38、whereis halt 显示一个二进制文件、源码或man的位置 
    39、which halt 显示一个二进制文件或可执行文件的完整路径

    40、退出vi编辑

      按ESC键 跳出vi的编辑命令,然后:
      :w 保存文件但不退出vi
      :w file 将修改另外保存到file中,不退出vi
      :w! 强制保存,不推出vi
      :wq 保存文件并退出vi
      :wq! 强制保存文件,并退出vi
      q: 不保存文件,退出vi
      :q! 不保存文件,强制退出vi
      :e! 放弃所有修改,从上次保存文件开始再编辑

    41、查看防火墙的运行状态firewall-cmd --state

      开启防火墙(重启服务器后又会重新关闭)systemctl start firewalld.service

      设置防火墙开机自动启动systemctl enable firewalld.service

      重启防火墙systemctl restart firewalld.service

      关闭防火墙:systemctl stop firewalld.service

      防火墙锁定(Unit is masked)解决办法:systemctl unmask firewalld

  • 相关阅读:
    Codeforces 834D The Bakery
    hdu 1394 Minimum Inversion Number
    Codeforces 837E Vasya's Function
    Codeforces 837D Round Subset
    Codeforces 825E Minimal Labels
    Codeforces 437D The Child and Zoo
    Codeforces 822D My pretty girl Noora
    Codeforces 799D Field expansion
    Codeforces 438D The Child and Sequence
    Codeforces Round #427 (Div. 2) Problem D Palindromic characteristics (Codeforces 835D)
  • 原文地址:https://www.cnblogs.com/vofill/p/13886159.html
Copyright © 2020-2023  润新知