随笔分类 -  linux常用命令说明

摘要:#文件权限备份 用getfacl 例子: getfacl -R /path/to/file > file_bak #文件权限恢复 用 setfacl 例子: setfacl --restore=file_bak /path/to/file 如果想要恢复到其他机器可以使用scp传输并恢复 阅读全文
posted @ 2023-03-01 16:46 运维小勾勾 阅读(315) 评论(0) 推荐(0)
摘要:##概念 nohup 英文全称 no hang up(不挂起),用于在系统后台不挂断地运行命令,退出终端不会影响脚本/程序的运行 在默认情况下为进行非重定向时,会输出一个 nohup.out 的文件到当前目录,如果当前目录的 nohup.out 文件不可写,输出重定向到 $HOME/nohup.ou 阅读全文
posted @ 2023-02-28 15:52 运维小勾勾 阅读(420) 评论(0) 推荐(0)
摘要:yum install -y bash-completion #增加更多命令tab自动补全 bash #自动补全生效 阅读全文
posted @ 2022-12-29 10:00 运维小勾勾 阅读(33) 评论(0) 推荐(0)
摘要:执行以下命令: echo "PS1='\[\033[01;37m\][\[\033[01;32m\]\u\[\033[01;33m\]@\[\033[01;31m\]\h\[\033[01;36m\] \w\[\033[01;37m\]]\[\033[01;35m\]\$ \[\033[0m\]'" 阅读全文
posted @ 2022-12-28 15:32 运维小勾勾 阅读(82) 评论(0) 推荐(0)
摘要:sed -i 's@#LoadModule rewrite_module@LoadModule rewrite_module@' $IN_DIR/apache/conf/httpd.conf 命令解析:@相当于/,因为命令中有"/",所以需要加@ 阅读全文
posted @ 2022-11-27 14:38 运维小勾勾 阅读(405) 评论(0) 推荐(0)
摘要:时间查看命令:date 1)查看系统时间 [root@hgg ~]# date ​ Sat Jul 10 22:50:46 +08 2021 2)时间显示格式 date +%F [root@hgg ~]# date +%F ​ 2021-07-10 date " +%F %T" [root@hgg 阅读全文
posted @ 2022-01-08 16:13 运维小勾勾 阅读(139) 评论(0) 推荐(0)
摘要:查看文件的详细信息: stat 文件/目录 文件数据时间类型: 01、访问时间 Access 02、修改时间 Modify 03、改变时间 Change 数据属性信息发生改变 阅读全文
posted @ 2022-01-08 16:09 运维小勾勾 阅读(299) 评论(0) 推荐(0)
摘要:###压缩命令:tar 压缩命令语法: tar zcvf 存放路径/压缩包名字 指定要压缩的文件 z 压缩的方式:zip c 创建压缩包文件 v 显示压缩过程 f 指定压缩包文件路径信息 [root@hgg ~]# tar zcvf /hgg/hgg.tar.gz /hgg/hgg.txt tar: 阅读全文
posted @ 2022-01-08 16:01 运维小勾勾 阅读(1125) 评论(0) 推荐(0)
摘要:1)tree 目录 指定显示所有数据结构信息 [root@hgg ~]# tree /hgg /hgg └── hgg01 └── hgg02 ├── hgg03 │ └── hgg04 ├── hggboy01.txt ├── hggboy02.txt ├── hggboy03.txt ├── h 阅读全文
posted @ 2022-01-08 16:00 运维小勾勾 阅读(123) 评论(0) 推荐(0)
摘要:1)精确查找 find 找寻的路径范围 -type 类型信息 -name "文件名称" [root@hgg ~]# find /etc -type f -name "ifcfg-eth0" ​ /etc/sysconfig/network-scripts/ifcfg-eth0 2)忽略大小写查找 忽 阅读全文
posted @ 2022-01-08 15:59 运维小勾勾 阅读(144) 评论(0) 推荐(0)
摘要:###一、查看CPU信息 利用文件查看:(/proc/cpuinfo) cat /proc/cpuinfo model name : AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx --CPU品牌型号 physical id:0 --表示CPU颗数 cpu 阅读全文
posted @ 2022-01-08 12:30 运维小勾勾 阅读(1475) 评论(0) 推荐(0)
摘要:1、和程序软件安装相关的目录(/usr/local) [root@hgg ~]# ll -d /usr/local drwxr-xr-x. 12 root root 131 Jun 25 11:41 /usr/local 2、系统中如何安装软件(吃饭) 01、订餐点外卖 (做好的饭 筷子) yum安 阅读全文
posted @ 2022-01-08 12:25 运维小勾勾 阅读(89) 评论(0) 推荐(0)
摘要:[root@hgg ~]# ls -l /etc/hosts -rw-r--r--. 1 root root 180 Jun 29 16:21 /etc/hosts [root@hgg ~]# ll /etc/hosts -rw-r--r--. 1 root root 180 Jun 29 16:2 阅读全文
posted @ 2022-01-08 12:20 运维小勾勾 阅读(184) 评论(0) 推荐(0)
摘要:move(移动)==mv 目录/文件 目标文件/目录 mv命令用法和cp命令类似 a.文件的数据剪切 [root@HGG ~]# mv /hgg/hgg.txt /tmp ​ [root@HGG ~]# ls -ld /tmp/hgg.txt -rw-r--r--. 1 root root 0 Ju 阅读全文
posted @ 2022-01-08 12:03 运维小勾勾 阅读(264) 评论(0) 推荐(0)
摘要:copy--cp 用法:cp 要复制的数据信息(文件/目录) 复制到什么位置(目录中) a.文件备份方法: [root@HGG ~]# cp /hgg/hgg.txt /tmp ​ •[root@HGG ~]# ls -l /tmp/hgg.txt ​ • -rw-r--r--. 1 root ro 阅读全文
posted @ 2022-01-08 12:02 运维小勾勾 阅读(90) 评论(0) 推荐(0)
摘要:将屏幕显示的信息保存到文件中 第一个步骤:将信息输出到屏幕 [root@HGG ~]# echo "hello linux" ​ • hello linux 第二个步骤:将屏幕输出的信息放入文件中 01.添加文件信息并覆盖清空原来的 [root@HGG ~]# echo "hello linux" 阅读全文
posted @ 2022-01-08 12:00 运维小勾勾 阅读(168) 评论(0) 推荐(0)
摘要:cat 文件名 --只能查看文件内容 cat -n 文件名 查看文件时显示行号 [root@HGG ~]# cat hgg.txt ​ • hello linux • my name is hgg less 文件/目录 --目录与文件内容都能查看 less -N 文件/目录 --内容加上行号 向下逐 阅读全文
posted @ 2022-01-08 12:00 运维小勾勾 阅读(458) 评论(0) 推荐(0)
摘要:vi 文件 用于打开编辑文件 [root@HGG ~]# vi hgg.txt 第一个步骤:进入编辑状态(插入状态) 按字母“i” 第二个步骤:编辑文件内容 第三个步骤:进行保存关闭文档 按esc退出编辑状态,输入“:wq”保存退出 :q(退出不保存) :w(保存不退出) :wq!(强制保存退出) 阅读全文
posted @ 2022-01-08 11:58 运维小勾勾 阅读(112) 评论(0) 推荐(0)