[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 syslinux
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
/rootide
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# ifconfig------查看全部網卡的配置oop
eth0code
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-----------------------------------同上
eth0ip
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的詳細配置
eth0get
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:AFit
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)
[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
模塊 編號 命令試用 命令解釋
幫助命令
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