Fork me on GitHub

Linux命令02--系统管理

 <1>查看当前日历:cal

<2>显示或者设置时间

设置时间格式(需要管理员权限);一般都是有ntp服务的,你的系统会根据这个对照互联网时间

<3>查看进程信息:ps

所有和系统相关的 aux

[root@localhost ~]# ps -aux

 

<4>杀死进程kill

 

<5>关机重启:reboot、shutdown、init

windows是单用户,linux是多用户可以多人操作使用。

<6>检测磁盘空间:df

[root@localhost ~]# df
Filesystem              1K-blocks    Used Available Use% Mounted on
/dev/mapper/centos-root  17811456 1770616  16040840  10% /
devtmpfs                   486744       0    486744   0% /dev
tmpfs                      498976       0    498976   0% /dev/shm
tmpfs                      498976    7856    491120   2% /run
tmpfs                      498976       0    498976   0% /sys/fs/cgroup
/dev/sda1                 1038336  132616    905720  13% /boot
tmpfs                       99796       0     99796   0% /run/user/0
[root@localhost ~]# df -lh
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   17G  1.7G   16G  10% /
devtmpfs                 476M     0  476M   0% /dev
tmpfs                    488M     0  488M   0% /dev/shm
tmpfs                    488M  7.7M  480M   2% /run
tmpfs                    488M     0  488M   0% /sys/fs/cgroup
/dev/sda1               1014M  130M  885M  13% /boot
tmpfs                     98M     0   98M   0% /run/user/0

<7>检测目录所占磁盘空间:du

 

[root@localhost ~]# du
0    ./test
56    .
[root@localhost ~]# cd /bin/
[root@localhost bin]# du
105680    .
[root@localhost bin]# du -lh
110M    .
[root@localhost bin]# 
[root@localhost bin]# du -alh
152K    ./cp
144K    ./cpio
0    ./captoinfo
52K    ./csplit
8.0K    ./clear
44K    ./cut
...
...
48K    ./filterdiff
4.0K    ./fixcvsdiff
0    ./flipdiff
0    ./grepdiff
52K    ./interdiff
0    ./lsdiff
110M    .
[root@localhost bin]# cd -
/root
[root@localhost ~]# du -alh
4.0K    ./.bash_logout
4.0K    ./.bash_profile
4.0K    ./.bashrc
4.0K    ./.cshrc
4.0K    ./.tcshrc
4.0K    ./anaconda-ks.cfg
4.0K    ./.bash_history
12K    ./.123.py.swp
4.0K    ./ls.txt
4.0K    ./kris-1.tar.gz
4.0K    ./kris-2.tar.bz2
4.0K    ./mmmm.zip
0    ./test/123_2.py
0    ./test/345link_2.py
0    ./test/345link.py
0    ./test
56K    .
[root@localhost ~]# 

 <8>top显示运行中的进程

 

[root@localhost ~]# top
top - 17:49:54 up  2:03,  2 users,  load average: 0.00, 0.01, 0.05
Tasks:  99 total,   1 running,  98 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.3 us,  0.0 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :   997956 total,   709144 free,   135940 used,   152872 buff/cache
KiB Swap:  2097148 total,  2097148 free,        0 used.   692464 avail Mem 

   PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                      
     1 root      20   0  128236   6868   4080 S  0.0  0.7   0:02.73 systemd                                      
     2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd                                     
     3 root      20   0       0      0      0 S  0.0  0.0   0:00.16 ksoftirqd/0                                  
     5 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0H                                 
     6 root      20   0       0      0      0 S  0.0  0.0   0:00.17 kworker/u256:0                               
     7 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0                                  
[root@localhost ~]# q  按q结束

 <9>查看或配置网卡信息:ifconfig

 

 

 

 <10>测试远程主机连通性:ping

 

 

 
posted @ 2018-07-29 18:14  kris12  阅读(207)  评论(0编辑  收藏  举报
levels of contents