zoukankan      html  css  js  c++  java
  • linux基础命令篇二

    1.rmdir删除空目录

    [root@andy ~]# ls
    anaconda-ks.cfg
    [root@andy ~]# mkdir test
    [root@andy ~]# ls
    anaconda-ks.cfg test
    [root@andy ~]# rmdir test
    [root@andy ~]# ls
    anaconda-ks.cfg
    [root@andy ~]#

    2.cat查看文件内容(最少)

    cat -n显示多少行

    [root@andy ~]# ls
    anaconda-ks.cfg
    [root@andy ~]# touch test
    [root@andy ~]# echo "hello" >> test
    [root@andy ~]# cat test
    hello
    [root@andy ~]# cat -n test
    1 hello
    [root@andy ~]# echo -e "hello hello" >> test
    [root@andy ~]# cat -n test
    1 hello
    2 hello
    3 hello

    3.more查看文件(更多内容以百分比显示查看进度)不能向后移动,q退出查看

    4.less可以随意浏览文件(较少)

    5.head查看前10行

    [root@andy zabbix]# head zabbix_agentd.conf
    # This is a configuration file for Zabbix agent daemon (Unix)
    # To get more information about Zabbix, visit http://www.zabbix.com

    ############ GENERAL PARAMETERS #################

    ### Option: PidFile
    # Name of PID file.
    #
    # Mandatory: no
    # Default:

    head -n 3 查看前三行文件

    [root@andy zabbix]# head -n 3 zabbix_agentd.conf
    # This is a configuration file for Zabbix agent daemon (Unix)
    # To get more information about Zabbix, visit http://www.zabbix.com

    [root@andy zabbix]#

    6.tail查看后10行

    [root@andy zabbix]# tail zabbix_agentd.conf
    # Mandatory: no
    # Default:
    # TLSPSKIdentity=

    ### Option: TLSPSKFile
    # Full pathname of a file containing the pre-shared key.
    #
    # Mandatory: no
    # Default:
    # TLSPSKFile=
    [root@andy zabbix]#

    tail -f可以实时监控(一般用于监控日志)

    [root@andy zabbix]# tail -f zabbix_agentd.conf
    # Mandatory: no
    # Default:
    # TLSPSKIdentity=

    ### Option: TLSPSKFile
    # Full pathname of a file containing the pre-shared key.
    #
    # Mandatory: no
    # Default:
    # TLSPSKFile=

    7.clear清屏相当于crtl L(快捷键)

    8.poweroff或shutdown -h now关机

    9.reboot重启

    10.alias查看设置别名

    alias查看别名

    [root@andy ~]# alias
    alias cp='cp -i'
    alias egrep='egrep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias grep='grep --color=auto'
    alias l.='ls -d .* --color=auto'
    alias ll='ls -l --color=auto'
    alias ls='ls --color=auto'
    alias mv='mv -i'
    alias rm='rm -i'
    alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

    alias设置别名

    [root@andy ~]# alias rm='rm -rf'
    [root@andy ~]# alias
    alias cp='cp -i'
    alias egrep='egrep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias grep='grep --color=auto'
    alias l.='ls -d .* --color=auto'
    alias ll='ls -l --color=auto'
    alias ls='ls --color=auto'
    alias mv='mv -i'
    alias rm='rm -rf'
    alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
    [root@andy ~]# ls
    anaconda-ks.cfg test
    [root@andy ~]# rm test

    unalias取消别名

    [root@andy ~]# unalias rm
    [root@andy ~]# alias
    alias cp='cp -i'
    alias egrep='egrep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias grep='grep --color=auto'
    alias l.='ls -d .* --color=auto'
    alias ll='ls -l --color=auto'
    alias ls='ls --color=auto'
    alias mv='mv -i'
    alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

  • 相关阅读:
    各种版本控制器的作用
    mybatis的一些特殊符号标识(大于,小于,等于,不等于)
    struts2的作用是什么
    js中给数组添加元素的方法有哪些
    springmvc中拦截器配置格式
    js中require()的用法----JS如何连接数据库执行sql语句或者建立数据库连接池
    hover()函数的用法
    error和exception的不同与相同
    cookie和session的区别有哪些
    数据库连接池的工作机制是什么
  • 原文地址:https://www.cnblogs.com/yzandy/p/11759024.html
Copyright © 2011-2022 走看看