资讯专栏INFORMATION COLUMN

1.2.linux.传智.命令过程学习

zhoutk / 3265人阅读

摘要:文件切换操作显示当前路径下的所有文件显示当前用户所处的路径进入根目录显

1.文件切换操作

[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#ll------------显示当前路径下的所有文件
total 92
-rw-------. 1 root root 3330 Feb 3 07:52 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Feb 3 08:16 Desktop
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Documents
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Downloads
-rw-r--r--. 1 root root 40279 Feb 3 07:52 install.log
-rw-r--r--. 1 root root 9272 Feb 3 07:50 install.log.syslog
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Music
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Pictures
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Public
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Templates
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Videos
[root@localhost ~]# pwd----------显示当前用户所处的路径
/root
[root@localhost ~]# cd /-----------进入根目录
[root@localhost /]# ll---------------显示根目录的所有内容
total 90
dr-xr-xr-x. 2 root root 4096 Feb 3 08:18 bin
dr-xr-xr-x. 5 root root 1024 Feb 3 07:52 boot
drwxr-xr-x. 18 root root 3920 Feb 3 07:56 dev
drwxr-xr-x. 98 root root 4096 Feb 3 08:18 etc
drwxr-xr-x. 3 root root 4096 Feb 3 07:52 home
dr-xr-xr-x. 10 root root 4096 Feb 3 07:48 lib
dr-xr-xr-x. 9 root root 12288 Feb 3 08:18 lib64
drwx------. 2 root root 16384 Feb 3 07:45 lost+found
drwxr-xr-x. 2 root root 4096 Sep 23 2011 media
drwxr-xr-x. 2 root root 4096 Sep 23 2011 mnt
drwxr-xr-x. 3 root root 4096 Feb 3 07:53 opt
dr-xr-xr-x. 159 root root 0 Feb 3 07:53 proc
dr-xr-x---. 27 root root 4096 Feb 3 08:16 root
dr-xr-xr-x. 2 root root 12288 Feb 3 08:18 sbin
drwxr-xr-x. 7 root root 0 Feb 3 07:53 selinux
drwxr-xr-x. 2 root root 4096 Sep 23 2011 srv
drwxr-xr-x. 13 root root 0 Feb 3 07:53 sys

16 root root 4096 Feb 3 08:17 tmp
drwxr-xr-x. 13 root root 4096 Feb 3 07:45 usr

drwxr-xr-x. 21 root root 4096 Feb 3 07:50 var
[root@localhost /]# cd--------进入主用户目录下,此处是root主用户
[root@localhost ~]# ll
total 92
-rw-------. 1 root root 3330 Feb 3 07:52 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Feb 3 08:16 Desktop
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Documents
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Downloads
-rw-r--r--. 1 root root 40279 Feb 3 07:52 install.log
-rw-r--r--. 1 root root 9272 Feb 3 07:50 install.log.syslog
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Music
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Pictures
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Public
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Templates
drwxr-xr-x. 2 root root 4096 Feb 3 07:57 Videos
[root@localhost ~]# pwd
/root

2.网络配置操作

[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ifconfig------查看所有网卡的配置

eth0

     Link encap:Ethernet  HWaddr 00:0C:29:52:C5:AF 
     inet addr:192.168.145.128  Bcast:192.168.145.255  Mask:255.255.255.0
     inet6 addr: fe80::20c:29ff:fe52:c5af/64 Scope:Link
     UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
     RX packets:100089 errors:0 dropped:0 overruns:0 frame:0
     TX packets:60058 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:135786210 (129.4 MiB)  TX bytes:6300628 (6.0 MiB)

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:16 errors:0 dropped:0 overruns:0 frame:0
     TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:0
     RX bytes:960 (960.0 b)  TX bytes:960 (960.0 b)

[root@localhost ~]# ipconfig eth0 192.168.145.129---eth0网卡的IP更改为192.168.145.129
[root@localhost ~]# ifconfig-----------------------------------同上
eth0

     Link encap:Ethernet  HWaddr 00:0C:29:52:C5:AF 
     inet addr:192.168.145.129  Bcast:192.168.145.255  Mask:255.255.255.0
     inet6 addr: fe80::20c:29ff:fe52:c5af/64 Scope:Link
     UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
     RX packets:100202 errors:0 dropped:0 overruns:0 frame:0
     TX packets:60093 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:135794420 (129.5 MiB)  TX bytes:6310735 (6.0 MiB)

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:16 errors:0 dropped:0 overruns:0 frame:0
     TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:0
     RX bytes:960 (960.0 b)  TX bytes:960 (960.0 b)

[root@localhost ~]#
[root@localhost ~]# ifconfig eth0-------查看网卡eth0的详细配置
eth0

     Link encap:Ethernet  HWaddr 00:0C:29:52:C5:AF 
     inet addr:192.168.145.129  Bcast:192.168.145.255  Mask:255.255.255.0
     inet6 addr: fe80::20c:29ff:fe52:c5af/64 Scope:Link
     UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
     RX packets:100388 errors:0 dropped:0 overruns:0 frame:0
     TX packets:60109 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:135806653 (129.5 MiB)  TX bytes:6311863 (6.0 MiB)

[root@localhost ~]# ifconfig eth0 down----将eth0网卡给关掉
[root@localhost ~]# ifconfig eth0----同上
[root@localhost ~]# ifconfig eth0 up----将eth0网卡给打开
[root@localhost ~]# ifconfig eth0----同上
eth0 Link encap:Ethernet HWaddr 00:0C:29:52:C5:AF

     inet6 addr: fe80::20c:29ff:fe52:c5af/64 Scope:Link
     UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
     RX packets:100494 errors:0 dropped:0 overruns:0 frame:0
     TX packets:60125 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:135814294 (129.5 MiB)  TX bytes:6313607 (6.0 MiB)

[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ifconfig----同上
eth0

      Link encap:Ethernet  HWaddr 00:0C:29:52:C5:AF 
     inet addr:192.168.145.128  Bcast:192.168.145.255  Mask:255.255.255.0
     inet6 addr: fe80::20c:29ff:fe52:c5af/64 Scope:Link
     UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
     RX packets:100552 errors:0 dropped:0 overruns:0 frame:0
     TX packets:60168 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:135823375 (129.5 MiB)  TX bytes:6322221 (6.0 MiB)

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:16 errors:0 dropped:0 overruns:0 frame:0
     TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:0
     RX bytes:960 (960.0 b)  TX bytes:960 (960.0 b)

[root@localhost ~]#
[root@localhost ~]# ifconfig eth0 netmask 255.255.0.0
[root@localhost ~]# ifconfig
eth0

     Link encap:Ethernet  HWaddr 00:0C:29:52:C5:AF 
     inet addr:192.168.145.128  Bcast:192.168.255.255  Mask:255.255.0.0
     inet6 addr: fe80::20c:29ff:fe52:c5af/64 Scope:Link
     UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
     RX packets:100630 errors:0 dropped:0 overruns:0 frame:0
     TX packets:60212 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:1000
     RX bytes:135828752 (129.5 MiB)  TX bytes:6329426 (6.0 MiB)

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:16 errors:0 dropped:0 overruns:0 frame:0
     TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
     collisions:0 txqueuelen:0
     RX bytes:960 (960.0 b)  TX bytes:960 (960.0 b)
3.ping操作

[root@localhost ~]#
[root@localhost ~]# ping 192.168.145.1-----ping主机IP
PING 192.168.145.1 (192.168.145.1) 56(84) bytes of data.
64 bytes from 192.168.145.1: icmp_seq=1 ttl=128 time=0.844 ms
64 bytes from 192.168.145.1: icmp_seq=2 ttl=128 time=0.437 ms
64 bytes from 192.168.145.1: icmp_seq=3 ttl=128 time=0.488 ms
64 bytes from 192.168.145.1: icmp_seq=4 ttl=128 time=0.625 ms
64 bytes from 192.168.145.1: icmp_seq=5 ttl=128 time=0.989 ms
64 bytes from 192.168.145.1: icmp_seq=6 ttl=128 time=0.597 ms
64 bytes from 192.168.145.1: icmp_seq=7 ttl=128 time=0.581 ms
64 bytes from 192.168.145.1: icmp_seq=8 ttl=128 time=0.625 ms
64 bytes from 192.168.145.1: icmp_seq=9 ttl=128 time=0.655 ms
64 bytes from 192.168.145.1: icmp_seq=10 ttl=128 time=0.318 ms
64 bytes from 192.168.145.1: icmp_seq=11 ttl=128 time=0.660 ms
64 bytes from 192.168.145.1: icmp_seq=12 ttl=128 time=0.387 ms
64 bytes from 192.168.145.1: icmp_seq=13 ttl=128 time=0.348 ms
64 bytes from 192.168.145.1: icmp_seq=14 ttl=128 time=0.898 ms
64 bytes from 192.168.145.1: icmp_seq=15 ttl=128 time=0.494 ms
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ping -n 3 192.168.145.1----ping3次后停止ping操作
[root@localhost ~]# ping -t 10 192.168.145.1------一直ping下去
[root@localhost ~]# ping -l 1024 192.168.145.1-----ping的包设置大小
PING 192.168.145.1 (192.168.145.1) 56(84) bytes of data.
64 bytes from 192.168.145.1: icmp_seq=10 ttl=128 time=1.07 ms
64 bytes from 192.168.145.1: icmp_seq=11 ttl=128 time=0.717 ms
64 bytes from 192.168.145.1: icmp_seq=12 ttl=128 time=0.978 ms
64 bytes from 192.168.145.1: icmp_seq=13 ttl=128 time=0.360 ms
64 bytes from 192.168.145.1: icmp_seq=14 ttl=128 time=0.321 ms
64 bytes from 192.168.145.1: icmp_seq=15 ttl=128 time=0.298 ms
64 bytes from 192.168.145.1: icmp_seq=16 ttl=128 time=0.364 ms
64 bytes from 192.168.145.1: icmp_seq=17 ttl=128 time=0.315 ms
^C
--- 192.168.145.1 ping statistics ---
17 packets transmitted, 8 received, 52% packet loss, time 7780ms
rtt min/avg/max/mdev = 0.298/0.553/1.078/0.304 ms

4.相关命令的总结

模块 编号 命令试用 命令解释
帮助命令

   1    man cd    使用帮助查看cd操作的相关参数

目录文件处理命令

2    ll    显示该路径目录下可以显示的文件
3    ls -l /home/abc    显示该路径目录下可以显示的文件
4    ls -a    显示该路径目录下所有的文件
5    ls -l     显示该路径目录下可以显示的文件
6    ls -la    显示该路径目录下所有的文件
7    pwd    显示该用户此时的路径位置
8    cd /    进入根目录
9    cd      进入该用户的主目录
10    cd ..    该用户回退一格目录
11    mkdir abc    创建文件夹abc
12    mkdir -p a/b/c    创建文件夹a/b/c
13    rm -rf abc    删除文件夹abc
14    touch abc    创建空文件夹abc

文本文件处理命令

15    cat t.txt    顺序查看t.txt文本的内容
16    tac t.txt    逆序查看t.txt文本的内容
17    cp t.txt /home/2.txt    复制t.txt文件到home路径下
18    mv t.txt /home/3.txt    移动t.txt文件到home路径下
19    touch a.txt    创建空文本a.txt
20    wc -l t.txt    查看文本有几行 
21    wc t.txt    查看文本有几行、几个单词、几个字符
22    ln -s t.txt /home/t    在home路径下创建文本t.txt的快捷键
23    more t.txt    分页显示文本t.txt
24    tail -f t.txt    分页显示文本t.txt

ping操作

25    ping -n 3 192.168.145.1    ping主机操作3次
26    ping -t 192.168.145.1    一直ping主机操作
27    ping -l 1024 192.168.145.1    限制包的大小
28    ping 192.168.145.1    ping主机操作

文件查找

29    find / -name profile    查找根目录下的profile文件
30    find /root -name 111.txt    查找root目录下的111.txt文件

系统信息显示

31    ps -ef    查看进程
32    ps -ef |grep sort    查看名称是sort的进程
33    state    主机属性
34    who    试用该系统有哪些用户
35    who an i    我当前用什么用户登录该系统
36    hostname    主用户名称
37    hostname 123    更改主用户名称
38    uname    系统名称
39    uname -a    更改系统名称
40    top    查询所有进程 
41    ps -aux    查询所有进程
42    ps -aux |more    查询所有进程,分页显示
43    ps -ef |top    查询top进程
44    kill -9  5859    杀死进程9859
45    clear    清屏

查看当前内存使用情况

46    du    查看当前目录下所有文件的使用情况
47    df    查看所有磁盘的使用情况

查看通信状况

  48    ntstat -ano |more    查看通信状况

备份压缩

49    tar -czvf 1.tar.gz 1.txt    压缩,以gz方式
50    tar -xzvf 1.tar.gz    解压缩
51    tar -cjvf 1.tar.biz2 1.txt    压缩,以biz2方式
52    tar -xjvf 1.tar.biz2    解压缩

文本内容编辑

 53    vi r.txt    编辑文件;i;ESC;w保存;q退出;q!强制

用户管理

54    chmod 777 m.txt    rwx421 更改文件的属性
55    addusr 123    增加用户123
56    su 123    切换到用户123

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/9537.html

相关文章

  • 1.3.linux.传智.目录功能、命令汇总

    摘要:目录功能存放最常用命令启动的核心文件设备特殊文件,即设备驱动程序系统管理文件系统配置文件其他用户主目录动态链接共享库系统非正常关机而留下无家可归的文件下叫什么就在这里让用户临时挂载其他的文件系统虚拟的目录,是系统内存的映射,可直接访问这个目 目录功能 1 bin 存放最常用命令 2 boot 启动Linux的核心文件 3 dev 设备特殊...

    mudiyouyou 评论0 收藏0
  • HTML

    摘要:目前,中关村黑马程序员训练营已成长为行业学员质量好课程内容深企业满意的移动开发高端训练基地,并被评为中关村软件园重点扶持人才企业。黑马程序员的学员筛选制度,远比现在以上的企业招聘流程更为严格。系统的学习可以参考w3c的教程 web概念概述 * JavaWeb: * 使用Java语言开发基于互联网的项目 * 软件架构: 1. C/S: Client/Server 客户端/服务...

    Snailclimb 评论0 收藏0
  • 1、Map接口 2、模拟斗地主洗牌发牌

    摘要:中的集合称为单列集合,中的集合称为双列集合。洗牌通过数字完成洗牌发牌发牌将每个人以及底牌设计为将最后张牌直接存放于底牌,剩余牌通过对取模依次发牌。存放的过程中要求数字大小与斗地主规则的大小对应。 01Map集合概述 A:Map集合概述: 我们通过查看Map接口描述,发现Map接口下的集合与Collection接口下的集合,它们存储数据的形式不同  a:Collection中的集...

    付伦 评论0 收藏0
  • 假如时光倒流,我会这么学习Java

    摘要:看起来没有集合框架,线程,等那么耀眼,但它可是很多框架的基础啊回复反射查看相关文章,先把基础学会,后面的得用到它。 回头看看, 我进入Java 领域已经快15个年头了, 虽然学的也一般, 但是分享下我的心得,估计也能帮大家少走点弯路。[入门]我在2001年之前是C/C++阵营, 有C和面向对象的基础, 后来转到Java ,发现没有指针的Java真是好简单, 另外Java 的类库好用的让...

    bladefury 评论0 收藏0
  • 工具使用-积累与发现

    摘要:一积累中如何快速查看包中的源码最常用的大开发快捷键技巧将对象保存到文件中从文件中读取对象中的用法的配置详解和代码的格式详解格式化内容设置生成详解注释规范中设置内存调试的小知识单步执行命令的区别的动态代理机制详解内容有瑕疵,楼指正泛型继承的几 一、积累 1.JAVA Eclipse中如何快速查看jar包中 的class源码 最常用的15大Eclipse开发快捷键技巧 Java将对象保存到...

    wangjuntytl 评论0 收藏0

发表评论

0条评论

zhoutk

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<