从头开始积累centos7系统运用

大牛博客:https://blog.51cto.com/yangrong/p5

1.查看命令帮助的方法:

--help 适用于一般命令,非内置命令

man  适用于一般命令,非内置命令

help 适用内置命令:

info 了解即可

2.pwd 当前工作目录:

[root@python01 ~]# cd /etc/init.d/

快捷方式  逻辑路径
[root@python01 init.d]# pwd -L
/etc/init.d

P显示源文件的初始目录:  物理路径
[root@python01 init.d]# pwd -P
/etc/rc.d/init.d

[root@python01 init.d]# ls -l /etc/init.d
lrwxrwxrwx. 1 root root 11 May 24 23:24 /etc/init.d -> rc.d/init.d

3.mkdir

创建目录:  -p 参数批量创建目录

4.echo

echo 1 2 3 4 5

[root@python01 ~]# echo {1..10}
1 2 3 4 5 6 7 8 9 10

[root@python01 test]# mkdir dir{1..5}
[root@python01 test]# tree
.
├── dir1
├── dir2
├── dir3
├── dir4
└── dir5

5 directories, 0 files

[root@python01 test]# echo {1..3}{4..6}
14 15 16 24 25 26 34 35 36

[root@python01 test]# mkdir dir{1..3}{4..6}
[root@python01 test]# tree
.
├── dir1
├── dir14
├── dir15
├── dir16
├── dir2
├── dir24
├── dir25
├── dir26
├── dir3
├── dir34
├── dir35
├── dir36
├── dir4
└── dir5

14 directories, 0 files

-pv查看创建过程 创建测试目录,创建多级子目录

[root@python01 test]# mkdir -pv dirls/{1..3}/{4..6}
mkdir: created directory ‘dirls’
mkdir: created directory ‘dirls/1’
mkdir: created directory ‘dirls/1/4’
mkdir: created directory ‘dirls/1/5’
mkdir: created directory ‘dirls/1/6’
mkdir: created directory ‘dirls/2’
mkdir: created directory ‘dirls/2/4’
mkdir: created directory ‘dirls/2/5’
mkdir: created directory ‘dirls/2/6’
mkdir: created directory ‘dirls/3’
mkdir: created directory ‘dirls/3/4’
mkdir: created directory ‘dirls/3/5’
mkdir: created directory ‘dirls/3/6’

4.cd 命令 内置命令

切换改变目录

路径:

相对路径:不从/根开始 test/a/b

绝对路径:从/根开始   /root/test/a/b

-a  参数显示隐藏目录:

.  当前目录

..  上级目录

-   上一次目录

[root@python01 test]# ls
dir1    dir115  dir124  dir126  dir135  dir14  dir16  dir24  dir26  dir34  dir36  dir5
dir114  dir116  dir125  dir134  dir136  dir15  dir2   dir25  dir3   dir35  dir4   dirls
[root@python01 test]# ls -a
.   dir1    dir115  dir124  dir126  dir135  dir14  dir16  dir24  dir26  dir34  dir36  dir5
..  dir114  dir116  dir125  dir134  dir136  dir15  dir2   dir25  dir3   dir35  dir4   dirls

pwd

[root@python01 etc]# echo $OLDPWD
/root/test

-

[root@python01 etc]# echo $PWD
/etc

~ 家目录home 目录

5.tree命令:

yun -y install tree

tree - list contents of directories in a tree-like format.

-L 指定显示的层级:

[root@python01 ~]# tree -L 1
.
├── anaconda-ks.cfg
├── epel-release-latest-7.noarch.rpm
└── test

- d 参数只看目录

[root@python01 ~]# tree test -dL 1
test
├── dir1
├── dir114
├── dir115
├── dir116
├── dir124
├── dir125
├── dir126
├── dir134
├── dir135
├── dir136
├── dir14
├── dir15
├── dir16
├── dir2
├── dir24
├── dir25
├── dir26
├── dir3
├── dir34
├── dir35
├── dir36
├── dir4
├── dir5
└── dirls

-f 参数 显示完整的目录结构

[root@python01 ~]# tree test -dLf 1
test
├── test/dir1
├── test/dir114
├── test/dir115
├── test/dir116
├── test/dir124
├── test/dir125
├── test/dir126
├── test/dir134
├── test/dir135
├── test/dir136
├── test/dir14
├── test/dir15
├── test/dir16
├── test/dir2
├── test/dir24
├── test/dir25
├── test/dir26
├── test/dir3
├── test/dir34
├── test/dir35
├── test/dir36
├── test/dir4
├── test/dir5
└── test/dirls

-i 参数 去掉连接的树枝保留文件目录

-i            Don't print indentation lines.

[root@python01 ~]# tree  -dLfi 2
.
./test
./test/dir1
./test/dir114
./test/dir115
./test/dir116
./test/dir124
./test/dir125
./test/dir126
./test/dir134
./test/dir135
./test/dir136
./test/dir14
./test/dir15
./test/dir16
./test/dir2
./test/dir24
./test/dir25
./test/dir26
./test/dir3
./test/dir34
./test/dir35
./test/dir36
./test/dir4
./test/dir5
./test/dirls

6.touch 命令:

创建新文件

[root@python01 test]# touch oldboy.txt

[root@python01 test]# touch a.txt b.txt
[root@python01 test]# touch {c..f}.txt

更改就文件的时间戳

[root@python01 test]# stat oldboy.txt
  File: ‘oldboy.txt’
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d    Inode: 33575412    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-06-18 10:49:11.398749245 +0800
Modify: 2019-06-18 10:49:11.398749245 +0800
Change: 2019-06-18 10:49:11.398749245 +0800
 Birth: -

- a 代表创建时间
[root@python01 test]# touch -a oldboy.txt
[root@python01 test]# stat oldboy.txt     
  File: ‘oldboy.txt’
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d    Inode: 33575412    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-06-18 11:04:43.335778923 +0800
Modify: 2019-06-18 10:49:11.398749245 +0800
Change: 2019-06-18 11:04:43.335778923 +0800
 Birth: -

- m 代表修改时间

[root@python01 test]# touch -m oldboy.txt  
[root@python01 test]# stat oldboy.txt     
  File: ‘oldboy.txt’
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d    Inode: 33575412    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-06-18 11:04:43.335778923 +0800
Modify: 2019-06-18 11:12:23.581793580 +0800
Change: 2019-06-18 11:12:23.581793580 +0800
 Birth: -

关机的命令

shutdown -h now

halt

重启电脑的命令:

reboot

shutdown -r

shutdown --help

-r --reboot    Reboot the machine
-h             Equivalent to --poweroff, overridden by --halt

history 命令:属于22系统优化的内容

history历史命令记录

配合感叹号使用调取历史命令:

154  touch 谢国成.txt
  155  ls
  156  rm -f 谢国成.txt
  157  ls
  158  setup
  159  history
[root@python01 ~]# !155
ls
anaconda-ks.cfg  epel-release-latest-7.noarch.rpm  test

清空历史命令:

清空所有

history -c

保留5条历史命令记录

history -d -5

特殊变量:控制命令历史输出记录数量

export HISTSIZE=5

[root@python01 ~]# export HISTSIZE=5
[root@python01 ~]# history
  158  history
  159  ls
  160  export HISTFILESIZE=5
  161  export HISTSIZE=5
  162  history

export HISTFILESIZE=5

[root@python01 ~]# cat ~/.bash_history
runlever
runlevel
systemctl get-default
shutdown --help
systemctl status firewalld.service

free -m 查看内存命令

[root@python01 ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           3771          84        3380          11         306        3431

19.centos7基础学习与积累-005-命令总结01的更多相关文章

  1. 17.centos7基础学习与积累-003-命令练习01

    1.从头开始积累centos7系统运用 大牛博客:https://blog.51cto.com/yangrong/p5 linux命令的学习: 创建目录:mkdir mkdir /data mkdir ...

  2. 25.centos7基础学习与积累-011-课前考试二-命令练习

    从头开始积累centos7系统运用 大牛博客:https://blog.51cto.com/yangrong/p5 取IP地址: 6的命令:ifconfig eth0 7的命令 [root@pytho ...

  3. 24.centos7基础学习与积累-010-上机考核命令练习

    从头开始积累centos7系统运用 大牛博客:https://blog.51cto.com/yangrong/p5 1.创建目录/data/oldboy,并且在该目录下创建文件oldboy.txt,然 ...

  4. 22.centos7基础学习与积累-008-系统调优及安全设置

    从头开始积累centos7系统运用 大牛博客:https://blog.51cto.com/yangrong/p5 1.关闭selinux功能: SELinux(Securety-EnhancedLi ...

  5. 26.centos7基础学习与积累-012-文件和目录的属性

    从头开始积累centos7系统运用 大牛博客:https://blog.51cto.com/yangrong/p5 1.文件的属性(文件的信息描述): [root@python01 ~]# ls -l ...

  6. 20.centos7基础学习与积累-006-软实力-画图

    从头开始积累centos7系统运用 亿图是用指南 安装亿图软件 修改基础配置 路径:文件==>选项==>常规 需要修改的参数: 撤销次数:256 自动保存间隔:2分钟 路径:文件==> ...

  7. 27.centos7基础学习与积累-013-文件和目录的权限

    从头开始积累centos7系统运用 大牛博客: https://blog.51cto.com/yangrong/p5 https://blog.oldboyedu.com/ 文件的权限 rw-r--r ...

  8. 23.centos7基础学习与积累-009-linux目录

    从头开始积累centos7系统运用 大牛博客:https://blog.51cto.com/yangrong/p5 linux目录的特点: 1. /是所有目录的顶点. 2. 目录结构像一颗倒挂的树. ...

  9. 18.centos7基础学习与积累-004-分区理论

    1.从头开始积累centos7系统运用 大牛博客:https://blog.51cto.com/yangrong/p5 1.常规分区:数据不是特别重要的业务(集群的某个节点) /boot  引导分区 ...

随机推荐

  1. winform调用webservice假死怎么解决

    主线程调用外部web service,没有返回时,主线程阻塞了,界面肯定假死耗时操作都是要在工作线程里面执行的.一般情况下winform调用webservice时步骤1添加服务引用---高级----添 ...

  2. java Random 随机密码

    /** * Created by xc on 2019/11/23 * 生成随机密码:6位数字 */public class Test7_4 { public static void main(Str ...

  3. 【论文阅读】PBA-Population Based Augmentation:Efficient Learning of Augmentation Policy Schedules

    参考 1. PBA_paper; 2. github; 3. Berkeley_blog; 4. pabbeel_berkeley_EECS_homepage; 完

  4. 【Spring Boot学习之八】发布打包

    环境 eclipse 4.7 jdk 1.8 Spring Boot 1.5.2 一.打jar类型1.指定主程序入口,否则运行报错:没有主清单属性pom.xml: <build> < ...

  5. [UE4] Adding a custom shading model

    转自:https://blog.felixkate.net/2016/05/22/adding-a-custom-shading-model-1/ This was written in Februa ...

  6. python综合作业要求

    要求: 1.课程成绩数据(学号尾数为0,1同学完成) 至少要完成内容:分析每年不同班级平均成绩情况.不同年份总体平均成绩情况.不同性别学生成绩情况,并用一定图表展示. 2.集美大学各省录取分数数据(学 ...

  7. Java生成二进制文件与Postman以二进制流的形式发送请求

    业务描述: 模拟终端(智能家居)发送HTTP POST请求,请求参数为二进制流:而且,二进制流是加密后的数据,因此调试分两步: 1.Java代码生成加密后数据,并保存为二进制流文件 (电脑上的图片就是 ...

  8. day13——重要内置函数、匿名函数、闭包

    day13 内置函数2 重要的 abs():求绝对值--返回的都是正数 # lst = [-1,-2,-3] # for i in lst: # print(abs(i)) # print([abs( ...

  9. DRF框架(九)——drf偏移分页组件、drf游标分页组件(了解)、自定义过滤器、过滤器插件django-filter

    drf偏移分页组件 paginations.py from rest_framework.pagination import LimitOffsetPagination class MyLimitOf ...

  10. GIL全局解释锁,死锁,信号量,event事件,线程queue,TCP服务端实现并发

    一.GIL全局解释锁 在Cpython解释器才有GIL的概念,不是python的特点 在Cpython解释器中,同一个进程下开启的多线程,同一时刻只能有一个线程执行,无法利用多核优势. 1.GIL介绍 ...