一、实验目的

掌握Linux各类命令的使用方法。
熟悉Linux操作环境。

二、实验内容

1、系统信息类命令

l利用date命令显示系统当前时间,并修改系统的当前时间为2018年8月8日。

  1. [root@centos7-linux ~]# date
  2. 2021 03 26 星期五 10:23:52 CST
  3. [root@centos7-linux ~]# date -d 08/08/2018
  4. 2018 08 08 星期三 00:00:00 CST

l显示当前登录到系统的用户状态。

  1. [root@centos-linux ~]# who
  2. root :0 2021-03-27 09:27 (:0)
  3. root pts/0 2021-03-27 09:28 (:0)
  4. root pts/1 2021-03-27 09:28 (192.168.20.1)
  5. [root@centos-linux ~]#

l利用free命令显示内存的使用情况。

  1. [root@centos7-linux ~]# free
  2. total used free shared buff/cache available
  3. Mem: 2033552 621092 952048 10436 460412 1218104
  4. Swap: 0 0 0

l利用df命令显示系统的硬盘分区及使用状况。

  1. [root@centos7-linux ~]# df
  2. 文件系统 1K-块 已用 可用 已用% 挂载点
  3. /dev/sda2 10475520 71152 10404368 1% /
  4. devtmpfs 1002244 0 1002244 0% /dev
  5. tmpfs 1016776 88 1016688 1% /dev/shm
  6. tmpfs 1016776 9184 1007592 1% /run
  7. tmpfs 1016776 0 1016776 0% /sys/fs/cgroup
  8. /dev/sda6 8378368 3918940 4459428 47% /usr
  9. /dev/sda5 8378368 141756 8236612 2% /var
  10. /dev/sda3 8378368 37072 8341296 1% /home
  11. /dev/sda1 303788 130904 172884 44% /boot
  12. tmpfs 203356 4 203352 1% /run/user/42
  13. tmpfs 203356 16 203340 1% /run/user/0

l显示当前目录下的各级子目录的硬盘占用情况。

  1. [root@centos-linux ~]# du -sh *
  2. 4.0K 1.txt
  3. 1.3M 2˳4.docx
  4. 4.0K 2.txt
  5. 4.0K 3.txt
  6. 4.0K anaconda-ks.cfg
  7. 5.0M core.3751
  8. 0 file1.txt
  9. 0 user_file.txt
  10. 0 公共
  11. 0 模板
  12. 0 视频
  13. 0 图片
  14. 0 文档
  15. 0 下载
  16. 0 音乐
  17. 0 桌面

2、进程管理类命令

(1)使用ps命令查看和控制进程:
显示本用户的进程。

  1. [root@centos7-linux ~]# ps -a
  2. PID TTY TIME CMD
  3. 42501 pts/1 00:00:00 ps

显示所有用户的进程。

  1. [root@centos-linux ~]# ps -e | more
  2. PID TTY TIME CMD
  3. 1 ? 00:00:04 systemd
  4. 2 ? 00:00:00 kthreadd
  5. 3 ? 00:00:00 ksoftirqd/0
  6. 5 ? 00:00:00 kworker/0:0H
  7. 6 ? 00:00:00 kworker/u256:0
  8. 7 ? 00:00:00 migration/0
  9. 8 ? 00:00:00 rcu_bh
  10. 9 ? 00:00:00 rcuob/0
  11. 10 ? 00:00:00 rcuob/1
  12. 11 ? 00:00:00 rcuob/2
  13. 12 ? 00:00:00 rcuob/3
  14. 13 ? 00:00:00 rcuob/4
  15. 14 ? 00:00:00 rcuob/5
  16. 15 ? 00:00:00 rcuob/6
  17. 16 ? 00:00:00 rcuob/7
  18. 17 ? 00:00:00 rcuob/8
  19. 18 ? 00:00:00 rcuob/9
  20. 19 ? 00:00:00 rcuob/10
  21. 20 ? 00:00:00 rcuob/11
  22. 21 ? 00:00:00 rcuob/12
  23. 22 ? 00:00:00 rcuob/13
  24. --More--

在后台运行cat命令。

  1. [root@centos-linux ~]# cat /etc/profile | more&
  2. [1] 8289

查看进程cat。

  1. [root@centos-linux ~]# ps -ef | grep cat
  2. cyy 3985 3577 0 06:47 ? 00:00:00 /usr/bin/gnome-software --gapplication-service
  3. root 6203 5675 0 06:56 ? 00:00:00 /usr/bin/gnome-software --gapplication-service
  4. root 8288 8010 0 07:10 pts/4 00:00:00 cat /etc/profile
  5. root 8387 8010 0 07:10 pts/4 00:00:00 grep --color=auto cat
  6. [1]+ 已停止 cat /etc/profile | more

杀死进程cat。

  1. [root@centos-linux ~]# pidof cat
  2. 8288
  3. [root@centos-linux ~]# kill -9 8288

再次查看进程cat,看其是否已被杀死。

  1. [root@centos-linux ~]# ps -ef | grep cat
  2. cyy 3985 3577 0 06:47 ? 00:00:00 /usr/bin/gnome-software --gapplication-service
  3. root 6203 5675 0 06:56 ? 00:00:00 /usr/bin/gnome-software --gapplication-service
  4. root 8421 8010 0 07:12 pts/4 00:00:00 grep --color=auto cat

(2)使用top命令查看和控制进程:
用top命令动态显示当前的进程。

  1. [root@centos-linux ~]# top
  2. top - 10:24:52 up 1:05, 3 users, load average: 0.00, 0.01, 0.05
  3. Tasks: 446 total, 1 running, 445 sleeping, 0 stopped, 0 zombie
  4. %Cpu(s): 0.2 us, 0.2 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
  5. KiB Mem : 1868688 total, 159608 free, 576136 used, 1132944 buff/cache
  6. KiB Swap: 0 total, 0 free, 0 used. 1082740 avail Mem
  7. PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
  8. 1 root 20 0 191616 6876 3920 S 0.3 0.4 0:04.61 systemd
  9. 303 root 20 0 0 0 0 S 0.3 0.0 0:03.75 kworker/0:2
  10. 3332 root 20 0 377552 17920 14296 S 0.3 1.0 0:03.10 vmtoolsd
  11. 4725 root 20 0 146420 2376 1428 R 0.3 0.1 0:00.04 top
  12. 2 root 20 0 0 0 0 S 0.0 0.0 0:00.03 kthreadd
  13. 3 root 20 0 0 0 0 S 0.0 0.0 0:00.09 ksoftirqd/0
  14. 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
  15. 6 root 20 0 0 0 0 S 0.0 0.0 0:00.25 kworker/u256:0
  16. 7 root rt 0 0 0 0 S 0.0 0.0 0:00.04 migration/0
  17. 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
  18. 9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/0
  19. 10 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/1
  20. 11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/2
  21. 12 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/3
  22. 13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/4
  23. 14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/5
  24. 15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/6

(3)挂起和恢复进程:
执行命令cat。
按Ctrl+z组合键,挂起进程cat。

  1. [root@centos-linux ~]# cat /etc/profile | more
  2. # /etc/profile
  3. # System wide environment and startup programs, for login setup
  4. # Functions and aliases go in /etc/bashrc
  5. # It's NOT a good idea to change this file unless you know what you
  6. # are doing. It's much better to create a custom.sh shell script in
  7. # /etc/profile.d/ to make custom changes to your environment, as this
  8. # will prevent the need for merging in future updates.
  9. pathmunge () {
  10. case ":${PATH}:" in
  11. *:"$1":*)
  12. ;;
  13. *)
  14. if [ "$2" = "after" ] ; then
  15. PATH=$PATH:$1
  16. else
  17. PATH=$1:$PATH
  18. fi
  19. esac
  20. }
  21. if [ -x /usr/bin/id ]; then
  22. if [ -z "$EUID" ]; then
  23. # ksh workaround
  24. EUID=`id -u`
  25. UID=`id -ru`
  26. --More--
  27. [1]+ 已停止 cat /etc/profile | more

输入jobs命令,查看作业。

  1. [root@centos-linux ~]# jobs
  2. [1]+ 已停止 cat /etc/profile | more
  3. [root@centos-linux ~]#

输入bg,把cat切换到后台执行。

  1. [root@centos-linux ~]# bg %1
  2. [1]+ cat /etc/profile | more &

Ø输入fg,把cat切换到前台执行。

  1. [1]+ cat /etc/profile | more &
  2. [root@centos-linux ~]# fg %1
  3. cat /etc/profile | more
  4. fi

按Ctrl+c组合键,结束进程cat。

  1. [root@centos-linux ~]# bg %1
  2. [1]+ cat /etc/profile | more &
  3. [root@centos-linux ~]# fg %1
  4. cat /etc/profile | more
  5. fi
  6. USER="`id -un`"
  7. [root@centos-linux ~]#

(4)find命令的使用:
在/var/lib目录下查找其所有者是games用户的所有文件。

  1. [root@centos-linux ~]# find /var/lib -user games
  2. [root@centos-linux ~]#

在/var目录下查找其所有者是root用户的所有文件并用长格式显示。

  1. [root@centos-linux ~]# find /root -user root -exec ls -l {} \;
  2. 总用量 5100
  3. -rw-r--r--. 1 root root 24 3 20 15:21 1.txt
  4. -rw-r--r--. 1 root root 49 3 20 15:35 2.txt
  5. -rw-r--r--. 1 root root 73 3 20 15:36 3.txt
  6. -rw-------. 1 root root 1450 2 7 15:29 anaconda-ks.cfg
  7. -rw-------. 1 root root 5206016 3 19 09:25 core.3751
  8. -rw-r--r--. 1 root root 0 3 20 15:14 file1.txt
  9. -rw-r--r--. 1 root root 0 3 20 15:15 user_file.txt
  10. drwxr-xr-x. 2 root root 6 3 18 11:02 公共
  11. drwxr-xr-x. 2 root root 6 3 18 11:02 模板
  12. drwxr-xr-x. 2 root root 6 3 18 11:02 视频
  13. drwxr-xr-x. 2 root root 6 3 18 11:02 图片
  14. drwxr-xr-x. 2 root root 6 3 18 11:02 文档
  15. drwxr-xr-x. 2 root root 6 3 18 11:02 下载

Ø 查找/usr/bin目录下所有大小超过1 000 000 B的文件并用长格式显示。

  1. [root@centos-linux ~]# find /usr/bin -size -1953 -exec ls -l {} \; | more
  2. 总用量 126032
  3. -rwxr-xr-x. 1 root root 41448 11 20 2015 [
  4. -rwxr-xr-x. 1 root root 107824 11 20 2015 a2p
  5. -rwxr-xr-x. 1 root root 11232 12 1 2015 abrt-action-analyze-backtrace
  6. -rwxr-xr-x. 1 root root 15312 12 1 2015 abrt-action-analyze-c
  7. -rwxr-xr-x. 1 root root 1345 12 1 2015 abrt-action-analyze-ccpp-local
  8. -rwxr-xr-x. 1 root root 6821 12 1 2015 abrt-action-analyze-core
  9. -rwxr-xr-x. 1 root root 11208 12 1 2015 abrt-action-analyze-oops
  10. -rwxr-xr-x. 1 root root 11216 12 1 2015 abrt-action-analyze-python
  11. -rwxr-xr-x. 1 root root 2814 12 1 2015 abrt-action-analyze-vmcore
  12. -rwxr-xr-x. 1 root root 1348 12 1 2015 abrt-action-analyze-vulnerability
  13. -rwxr-xr-x. 1 root root 11248 12 1 2015 abrt-action-analyze-xorg
  14. -rwxr-xr-x. 1 root root 5002 12 1 2015 abrt-action-check-oops-for-hw-error
  15. -rwxr-xr-x. 1 root root 11232 12 1 2015 abrt-action-generate-backtrace
  16. -rwxr-xr-x. 1 root root 11224 12 1 2015 abrt-action-generate-core-backtrace
  17. -rwxr-xr-x. 1 root root 8341 12 1 2015 abrt-action-install-debuginfo
  18. -rwxr-xr-x. 1 root root 3207 12 1 2015 abrt-action-list-dsos
  19. -rwxr-xr-x. 1 root root 8958 12 1 2015 abrt-action-notify
  20. -rwxr-xr-x. 1 root root 3535 12 1 2015 abrt-action-perform-ccpp-analysis
  21. -rwxr-xr-x. 1 root root 951 12 1 2015 abrt-action-save-kernel-data
  22. -rwxr-xr-x. 1 root root 19584 12 1 2015 abrt-action-save-package-data
  23. -rwxr-xr-x. 1 root root 15376 12 1 2015 abrt-action-trim-files
  24. -rwxr-xr-x. 1 root root 48608 12 1 2015 abrt-applet
  25. -rwxr-xr-x. 1 root root 27944 12 1 2015 abrt-cli
  26. -rwxr-xr-x. 1 root root 19448 12 1 2015 abrt-dump-oops
  27. -rwxr-xr-x. 1 root root 15344 12 1 2015 abrt-dump-xorg
  28. -rwxr-xr-x. 1 root root 9048 12 1 2015 abrt-handle-upload
  29. -rwxr-xr-x. 1 root root 11248 12 1 2015 abrt-merge-pstoreoops
  30. -rwxr-xr-x. 1 root root 44472 12 1 2015 abrt-retrace-client
  31. --More--

Ø 查找/tmp目录下属于student的所有普通文件,这些文件的修改时间为120 min以前,查询结果用长格式显示。

  1. [root@centos-linux ~]# find /tmp -type f -user root -atime +0.1 -exec ls -l {} \; | more
  2. -rw-------. 1 root root 1058607 3 14 09:05 /tmp/yum_save_tx.2021-03-14.09-05.rrhvmn.yumtx
  3. -rw-------. 1 root root 1058607 3 13 15:37 /tmp/yum_save_tx.2021-03-13.15-37.P1I6Sl.yumtx
  4. -rw-------. 1 root root 1058607 3 18 11:03 /tmp/yum_save_tx.2021-03-18.11-03.IdRQLw.yumtx
  5. -r--r--r--. 1 root root 11 3 22 14:36 /tmp/.X0-lock
  6. [root@centos-linux ~]#

Ø 对于查到的上述文件,用-ok选项删除。

  1. [root@centos-linux ~]# find /tmp -type f -user root -atime +0.1 -ok rm * {} \; | more
  2. < rm ... /tmp/yum_save_tx.2021-03-14.09-05.rrhvmn.yumtx > ?

三、实验作业

1、 查看/etc/httpd/conf/httpd.conf文件的前10行和后10行;

  1. [root@centos-linux ~]# head -n 10 /etc/profile
  2. # /etc/profile
  3. # System wide environment and startup programs, for login setup
  4. # Functions and aliases go in /etc/bashrc
  5. # It's NOT a good idea to change this file unless you know what you
  6. # are doing. It's much better to create a custom.sh shell script in
  7. # /etc/profile.d/ to make custom changes to your environment, as this
  8. # will prevent the need for merging in future updates.
  9. [root@centos-linux ~]# tail -n 10 /etc/profile
  10. if [ "${-#*i}" != "$-" ]; then
  11. . "$i"
  12. else
  13. . "$i" >/dev/null
  14. fi
  15. fi
  16. done
  17. unset i
  18. unset -f pathmunge
  19. [root@centos-linux ~]#

2、 实时查看最新日志文件;

  1. [root@centos-linux ~]# tail -f /var/log/messages
  2. Mar 28 07:10:01 centos-linux systemd: Started Session 13 of user root.
  3. Mar 28 07:10:01 centos-linux systemd: Starting Session 13 of user root.
  4. Mar 28 07:20:01 centos-linux systemd: Started Session 14 of user root.
  5. Mar 28 07:20:01 centos-linux systemd: Starting Session 14 of user root.
  6. Mar 28 07:30:01 centos-linux systemd: Started Session 15 of user root.
  7. Mar 28 07:30:01 centos-linux systemd: Starting Session 15 of user root.

3、 查看ls命令所在位置和命令简介;

  1. [root@centos-linux ~]# locate ls |more
  2. /boot/grub2/i386-pc/blscfg.mod
  3. /boot/grub2/i386-pc/cbls.mod
  4. /boot/grub2/i386-pc/command.lst
  5. /boot/grub2/i386-pc/crypto.lst
  6. /boot/grub2/i386-pc/fs.lst
  7. /boot/grub2/i386-pc/ls.mod
  8. /boot/grub2/i386-pc/lsacpi.mod
  9. /boot/grub2/i386-pc/lsapm.mod
  10. /boot/grub2/i386-pc/lsmmap.mod
  11. /boot/grub2/i386-pc/lspci.mod
  12. /boot/grub2/i386-pc/moddep.lst
  13. /boot/grub2/i386-pc/partmap.lst
  14. /boot/grub2/i386-pc/parttool.lst
  15. /boot/grub2/i386-pc/terminal.lst
  16. /boot/grub2/i386-pc/video.lst
  17. /etc/alsa
  18. /etc/cifs-utils
  19. /etc/lsm
  20. /etc/mtools.conf
  21. /etc/protocols
  22. /etc/pulse
  23. /etc/shells
  24. /etc/smartmontools
  25. /etc/vmware-tools
  26. /etc/alsa/alsactl.conf
  27. /etc/alsa/state-daemon.conf
  28. /etc/bash_completion.d/iprutils
  29. /etc/bash_completion.d/yum-utils.bash
  30. /etc/brltty/brl-bm-wheels.kti
  31. --More--
  32. [root@centos-linux ~]# man ls
  33. LS(1) User Commands LS(1)
  34. NAME
  35. ls - list directory contents
  36. SYNOPSIS
  37. ls [OPTION]... [FILE]...
  38. DESCRIPTION
  39. List information about the FILEs (the current directory by default). Sort entries alphabetically if
  40. none of -cftuvSUX nor --sort is specified.
  41. Mandatory arguments to long options are mandatory for short options too.
  42. -a, --all
  43. do not ignore entries starting with .
  44. -A, --almost-all
  45. do not list implied . and ..
  46. --author
  47. with -l, print the author of each file

4、 查看系统的信息;

  1. [root@centos-linux ~]# uname -a
  2. Linux centos-linux 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

5、 查看系统的内存使用情况

  1. [root@centos-linux ~]# free
  2. total used free shared buff/cache available
  3. Mem: 1868688 951940 379080 12040 537668 693264
  4. Swap: 0 0 0
  5. [root@centos-linux ~]#

6、 显示2019年10月日历;

  1. [root@centos-linux ~]# cal 10 2019
  2. 十月 2019
  3. 1 2 3 4 5
  4. 6 7 8 9 10 11 12
  5. 13 14 15 16 17 18 19
  6. 20 21 22 23 24 25 26
  7. 27 28 29 30 31

7、查看系统正在运行的进程;

  1. [root@centos-linux ~]# ps -aux | more
  2. USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
  3. root 1 0.0 0.3 191616 6868 ? Ss 06:20 0:03 /usr/lib/systemd/systemd --switched-root --s
  4. ystem --deserialize 21
  5. root 2 0.0 0.0 0 0 ? S 06:20 0:00 [kthreadd]
  6. root 3 0.0 0.0 0 0 ? S 06:20 0:00 [ksoftirqd/0]
  7. root 5 0.0 0.0 0 0 ? S< 06:20 0:00 [kworker/0:0H]
  8. root 6 0.0 0.0 0 0 ? S 06:20 0:00 [kworker/u256:0]
  9. root 7 0.0 0.0 0 0 ? S 06:20 0:00 [migration/0]
  10. root 8 0.0 0.0 0 0 ? S 06:20 0:00 [rcu_bh]
  11. root 9 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/0]
  12. root 10 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/1]
  13. root 11 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/2]
  14. root 12 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/3]
  15. root 13 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/4]
  16. root 14 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/5]
  17. root 15 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/6]
  18. root 16 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/7]
  19. root 17 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/8]
  20. root 18 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/9]
  21. root 19 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/10]
  22. root 20 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/11]
  23. root 21 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/12]
  24. root 22 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/13]
  25. root 23 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/14]
  26. root 24 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/15]
  27. root 25 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/16]
  28. root 26 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/17]
  29. root 27 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/18]
  30. root 28 0.0 0.0 0 0 ? S 06:20 0:00 [rcuob/19]
  31. --More--

8、通过find命令在/路径下查找L开头的文件

  1. [root@centos-linux ~]# find / -name L* | more
  2. find: ‘/run/user/1000/gvfs’: 权限不够
  3. /run/media/cyy/CentOS 7 x86_64/LiveOS
  4. /run/media/cyy/CentOS 7 x86_64/Packages/LibRaw-0.14.8-5.el7.20120830git98d925.x86_64.rpm
  5. /sys/bus/acpi/devices/LNXCPU:00
  6. /sys/bus/acpi/devices/LNXCPU:01
  7. /sys/bus/acpi/devices/LNXCPU:02
  8. /sys/bus/acpi/devices/LNXCPU:03
  9. /sys/bus/acpi/devices/LNXCPU:04
  10. /sys/bus/acpi/devices/LNXCPU:05
  11. /sys/bus/acpi/devices/LNXCPU:06
  12. /sys/bus/acpi/devices/LNXCPU:07
  13. /sys/bus/acpi/devices/LNXCPU:08
  14. /sys/bus/acpi/devices/LNXCPU:09
  15. /sys/bus/acpi/devices/LNXCPU:10
  16. /sys/bus/acpi/devices/LNXCPU:11
  17. /sys/bus/acpi/devices/LNXCPU:12
  18. /sys/bus/acpi/devices/LNXCPU:13
  19. /sys/bus/acpi/devices/LNXCPU:14
  20. /sys/bus/acpi/devices/LNXCPU:15
  21. /sys/bus/acpi/devices/LNXCPU:16
  22. /sys/bus/acpi/devices/LNXCPU:17
  23. /sys/bus/acpi/devices/LNXCPU:18
  24. /sys/bus/acpi/devices/LNXCPU:19
  25. /sys/bus/acpi/devices/LNXCPU:20
  26. /sys/bus/acpi/devices/LNXCPU:21
  27. /sys/bus/acpi/devices/LNXCPU:22
  28. /sys/bus/acpi/devices/LNXCPU:23
  29. /sys/bus/acpi/devices/LNXCPU:24
  30. /sys/bus/acpi/devices/LNXCPU:25
  31. /sys/bus/acpi/devices/LNXCPU:26
  32. --More--

9、查看在后台运行的进程;

  1. [root@centos-linux ~]# jobs
  2. [1]+ 已停止 cat /etc/profile | more

10、列出命令shutdown的帮助手册;

  1. [root@centos-linux ~]# man shutdown
  2. SHUTDOWN(8) shutdown SHUTDOWN(8)
  3. NAME
  4. shutdown - Halt, power-off or reboot the machine
  5. SYNOPSIS
  6. shutdown [OPTIONS...] [TIME] [WALL...]

11、查看系统中已定义的别名,设置ifconfig命令的别名为ipconfig;

  1. [root@centos-linux ~]# alias ipconfig=ifconfig
  2. [root@centos-linux ~]# alias
  3. alias cp='cp -i'
  4. alias egrep='egrep --color=auto'
  5. alias fgrep='fgrep --color=auto'
  6. alias grep='grep --color=auto'
  7. alias ipconfig='ifconfig'
  8. alias l.='ls -d .* --color=auto'
  9. alias ll='ls -l --color=auto'
  10. alias ls='ls --color=auto'
  11. alias mv='mv -i'
  12. alias rm='rm -i'
  13. alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

12、取消ipconfig别名的设置;

  1. [root@centos-linux ~]# unalias ipconfig
  2. [root@centos-linux ~]# ipconfig
  3. bash: ipconfig: 未找到命令...