• linux----关于定位和查找



    1.top --查看进程
    2.su --临时切换用户命令
    [root@tomato2 ~]# sudo su gongxijun
    [gongxijun@tomato2 root]$
    3.whoami ---我是谁 查看自己目前的用身份
    [gongxijun@tomato2 root]$ whoami
    gongxijun
    4.exit ---退出当前用户
    [gongxijun@tomato2 root]$ exit
    exit
    [root@tomato2 ~]#
    5.ifconfig ---查看用户的ip信息 mac,eth0 ,ip 等等信息
    [gongxijun@tomato2 root]$ ifconfig
    eth0 Link encap:Ethernet HWaddr D0:50:99:17:37:1F
    inet addr:192.168.0.155 Bcast:192.168.0.255 Mask:255.255.255.0
    inet6 addr: fe80::d250:99ff:fe17:371f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:1529804 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1549053 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:369566501 (352.4 MiB) TX bytes:1376257841 (1.2 GiB)

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:31 errors:0 dropped:0 overruns:0 frame:0
    TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:2130 (2.0 KiB) TX bytes:2130 (2.0 KiB)

    6.which --搜索命令(用于查找相关命令的位置)
    [gongxijun@tomato2 root]$ which cat
    /bin/cat
    如果想要验证:

    [gongxijun@tomato2 root]$ dir /bin/
    alsaunmute dnsdomainname lsblk rview
    arch domainname lscgroup sed
    awk dumpkeys lssubsys setfont
    basename echo mail setserial
    bash ed mailx sh
    cat egrep mkdir sleep
    cgclassify env mknod sort
    cgcreate ex mktemp stty
    cgdelete false more su
    cgexec fgrep mount sync
    cgget find mountpoint tar
    cgset findmnt mv taskset
    cgsnapshot gawk nano tcsh
    chgrp gettext netstat touch
    chmod grep nice tracepath
    chown gtar nisdomainname tracepath6
    cp gunzip ping traceroute
    cpio gzip ping6 traceroute6
    csh hostname plymouth true
    cut ipcalc ps umount
    dash iptables-xml pwd uname
    date iptables-xml-1.4.7 raw unicode_start
    dbus-cleanup-sockets kbd_mode readlink unicode_stop
    dbus-daemon keyctl red unlink
    dbus-monitor kill redhat_lsb_init usleep
    dbus-send link rm vi
    dbus-uuidgen ln rmdir view
    dd loadkeys rnano ypdomainname
    df login rpm zcat
    dmesg ls rvi

    7.locate ---文件搜索命令

    查找一个 iptables的文件 ,然后就可以搜索出这么多文件。
    [gongxijun@tomato2 root]$ locate iptables
    /bin/iptables-xml
    /bin/iptables-xml-1.4.7
    /etc/alternatives/bin-iptables-xml.x86_64
    /etc/alternatives/iptables.x86_64
    /etc/alternatives/man-iptables-restore.x86_64
    /etc/alternatives/man-iptables-save.x86_64
    /etc/alternatives/man-iptables-xml.x86_64
    /etc/alternatives/man-iptables.x86_64
    /etc/alternatives/sbin-iptables-multi.x86_64
    /etc/alternatives/sbin-iptables-restore.x86_64
    /etc/alternatives/sbin-iptables-save.x86_64
    /etc/rc.d/init.d/iptables
    在使用locate查找文件是,也可以使用星号表示所有字符,点号表示所有单字符。

    举列子: 要查找所有以字母ca开头的文档

    [gongxijun@tomato2 root]$ locate *a

    /var/lib/yum/yumdb/z/b8019061884a679c3b9b867b44c7b9c64182240d-zip-3.0-1.el6-
    x86_64/checksum_data
    /var/log/sa
    /var/log/samba
    [gongxijun@tomato2
    8. 手动更新数据库 --- updatedb
    9. whereis ----特殊文件搜索命令
    [gongxijun@tomato2 root]$ whereis cat
    cat: /bin/cat /usr/share/man/man1/cat.1.gz /usr/share/man/man1p/cat.1p.gz
    10. apropos --- 关键字搜索命令
    [gongxijun@tomato2 root]$ apropos process

  • 相关阅读:
    Django集成CAS
    JAVA命名规范
    Mybatis(5)——动态SQL
    Mybatis(4)——ResultMap
    Mybatis(3)——参数处理
    Mybatis(2)——Mapper映射文件
    Mybatis(1)——配置文件
    Gson(http://www.jianshu.com/p/e740196225a4)
    Gson中fromJson方法
    SessionAttributes和ModelAttribute
  • 原文地址:https://www.cnblogs.com/gongxijun/p/4346400.html
Copyright © 2020-2023  润新知