Unit 1.2 Beginning to Unix systems

Presenter Notes

本节幻灯片

Unit objectives

  • After completing this unit, you should be able to:
    • Log in and out of the system
    • State the structure of Unix commands
    • Execute basic Unix commands
    • Find help

Presenter Notes

在该单元学习结束时,需要会 -登录登出系统 -清楚Unix命令结构 -执行简单的Unix命令 -能够找到帮助

Unix is multiuser and multitasking

  • Unix is a multiuser, multitasking operating system.
    • Multiple users can run multiple tasks simultaneously, independent of each other.
  • You always need to log in before using the system.
    • Identify yourself with user name and password.
    • “root” is the superuser of the system.
  • There are multiple ways to log in to the system.
    • You can log in through the console: Directly attached keyboard, mouse, monitor.
    • Usually used for virtual terminals
    • You can log in through a network connection (for example, SSH or Telnet).

Presenter Notes

UNIX是多用户和多任务的操作系统 - 通常,必须要登录操作系统才能使用 - 登录Unit/Linux可以有多种方式 - 通过Console输入登录,例如:鼠标、键盘等外设 - 通过虚拟终端登录 - 网络连接登录,使用SSH或者Telnet登录

login and command prompt

  • Login with your username and password.

    Login:
    Password: < NO ECHO !!!>
    $

  • The command prompt indicates that the system is ready to accept commands.

    • The dollar sign ($) usually means you are logged in as a regular user.
    • The hash sign (#) usually means you are logged in as root.
  • To logout: exit / ctrl-d / logout

Presenter Notes

操作练习login与logout。Hint:与Windows不同,密码位数都被隐藏

Command syntax

  • Unix commands have the following format:

    $ command options arguments

    ls
    ls /home
    ls -l
    ls -l /home

  • Multiple options

    ls -a -l -h /home
    ls -alh /home

Presenter Notes

常用命令ls窥见Unix命令的语法,用help查看指令的syntax 错误例子: - mail - f personal - who-u - mail test root -s - -u who - who -m-u - who -m u

Basic commands

  • passwd: change your password.
  • date: show the current date and time.
  • cal: show the calender.
  • su / sudo : switch user (usu. root)
  • who: find out who is active on the system.
  • whoami / who am i : find out who you are.
  • write : write a message to a logged in user.
  • wall : broadcast a message to all logged in users.
  • mail : send/receive mail.
  • clear: clear the screen.
  • echo: write a message on the screen.

Presenter Notes

  • ls:列出当前目录下文件
  • cd:切换目录
  • find:通配符找文件
  • talk:与其他在该系统登录的用户对话
  • 常用快捷键

Help : man command

  • Man is most powerful!
  • With the man command, you can read the manual page of commands.
  • The manual page consists of:
    – Name: The name of the command and a one-line description
    – Synopsis: The syntax of the command
    – Description: Explanation of how the command works and what it does
    – Options: The options used by the command
    – Files: The files used by the command
    – Bugs: Known bugs and errors
    – See also: Other commands related to this one

Presenter Notes

帮助命令:man 格式:man 【命令】 作用:获取指定命令的帮助 例如查看ls的帮助命令 格式:man ls

man sections

  • The collection of manual pages is divided into nine sections:

    1. Executable or shell commands
    2. System calls
    3. Library calls
    4. Special files (usually found in /dev)
    5. File formats and conventions
    6. Games
    7. Miscellaneous (macro packages and so on)
    8. System administration commands
    9. Kernel routines (non-standard)

Presenter Notes

查看命令拥有哪个级别的帮助 格式:man -f 【命令】 相当于 whatis 【命令】 man的级别: 1 : 查看命令的帮助 2 : 查看可被内核调用的函数的帮助 3 : 查看函数和函数库的帮助 4 : 查看文件的帮助(主要是/dev目录下的文件) 5 : 查看配置文件的帮助 6 : 查看游戏的帮助 7 : 查看其它杂项的帮助 8 : 查看系统管理员可用命令的帮助 9 : 查看和内核相关文件的帮助

  • Certain subjects appear in multiple sections.

  • To select correct section, add section number:
    – man 1 passwd (about the passwd command)
    – man 5 passwd (about the passwd file)

  • The -k option of the man command or the apropos command prints out a description of all entries that match the given keyword.

Presenter Notes

  • $man -k print
  • arch (1) 打印机器的架构
  • date (1) 打印或者设置系统时间
  • logname (1) 打印登录用户名

Other help

  • info
  • the --help option
  • the Internet

Presenter Notes

info指令是man 指令的详细内容。但man 使用起来要方便的多。一个man 只有一页,而info总是将它们的内容组织成多个区段(节点),每个区段也可能包含子区段(子节点)。info工具可显示更完整的最新的GNU工具信息。通常man中若包含的信息概要在info中也有时,会有提示:“请参考info页更详细内容”。

Unit summary

  • Log in and out of the system
  • State the structure of Unix commands
  • Execute basic Unix commands
  • Find help

Presenter Notes

References

  • Unit 3. Using the system, Linux Basic and Installation , ERC 7.2, IBM
  • Unit 6. Linux documentation, Linux Basic and Installation , ERC 7.2, IBM

Presenter Notes