1.2 Getting Your System Ready for Effective Problem Determination

1.2. Getting Your System(s) Ready for Effective Problem Determination

The Linux problem determination tools and facilities are free, which begs the question: Why not install them? Without these tools, a simple problem can turn into a long and painful ordeal that can affect a business and/or your personal time. Before reading through the rest of the book, take some time to make sure the following tools are installed on your system(s). These tools are just waiting to make your life easier and/or your business more productive:

Linux debug工具是免费的, 这就引出了一个问题: 为什么不安装它们呢?如果没有这些工具, 一个简单的问题就会变成一个长期而痛苦的考验, 会影响企业和/或你的个人时间。在阅读完本书的其余部分之前, 请花点时间确保系统上安装了以下工具。这些工具只是让您的生活更轻松和/或您的业务更有效率:

  • strace: The strace tool traces the system calls, special functions that interact with the operating system. You can use this for many types of problems, especially those that relate to the operating system.
  • strace 工具跟踪系统调用, 与操作系统交互的专用函数。您可以对许多类型的问题使用此方法, 特别是与操作系统相关的情况。
  • ltrace: The ltrace tool traces the functions that a process calls. This is similar to strace, but the called functions provide more detail.
  • ltrace: ltrace 工具跟踪进程调用的函数。这与 strace 类似, 但所调用的函数提供了更详细的信息。
  • lsof: The lsof tool lists all of the open files on the operating system (OS). When a file is open, the OS returns a numeric file descriptor to the process to use. This tool lists all of the open files on the OS with their respective process IDs and file descriptors.
  • lsof: lsof 工具列出了操作系统 (OS) 上所有打开的文件。当文件打开时, OS 将向要使用的进程返回一个数字文件描述符。此工具列出 OS 上所有打开的文件及其各自的进程 id 和文件描述符。
  • top: This tool lists the “top” processes that are running on the system. By default it sorts by the amount of current CPU being consumed by a process.
  • top: 此工具列出了系统上运行的 "top" 进程。默认情况下, 它按进程消耗的当前 CPU 量进行排序。
  • traceroute/tcptraceroute: These tools can be used to trace a network route (or at least one direction of it).
  • traceroute/tcptraceroute: 这些工具可用于跟踪网络路由 (或至少一个方向)。
  • ping: Ping simply checks whether a remote system can respond. Sometimes firewalls block the network packets ping uses, but it is still very useful.
  • ping: ping 只是检查远程系统是否可以响应。有时防火墙会阻止 ping 使用的网络包, 但它仍然非常有用。
  • hexdump or equivalent: This is simply a tool that can display the raw contents of a file.
  • hexdump 或其它类似的工具: 这只是一个可以显示文件的原始内容的工具。
  • tcpdump and/or ethereal: Used for network problems, these tools can display the packets of network traffic.
  • tcpdump 和/或ethereal: 用于调试网络问题, 这些工具可以显示网络流量的包
  • GDB: This is a powerful debugger that can be used to investigate some of the more difficult problems.
  • GDB: 这是一个强大的调试器, 可以用来调查一些更困难的问题。
  • readelf: This tool can read and display information about various sections of an Executable and Linking Format (ELF) file
  • readelf: 此工具可以读取和显示有关可执行文件和链接格式 (ELF) 的各个部分的信息。

These tools (and many more) are listed in Appendix A, “The Toolbox,” along with information on where to find these tools. The rest of this book assumes that your systems have these basic Linux problem determination tools installed. These tools and facilities are free, and they won’t do much good sitting quietly on an installation CD (or on the Internet somewhere). In fact, this book will self-destruct in five minutes if these tools are not installed.

这些工具 (以及更多) 列在附录 A "工具箱" 中, 以及有关在何处查找这些工具的信息。本书的其余部分假定您的系统安装了这些基本的 Linux debug工具。这些工具和应用是免费的, 他们在安装光盘 (或在互联网上某处)可以找到。事实上, 如果这些工具没有安装, 这本书所讲的内容将毫无用处。

Now of course, just because you have a tool in your toolbox, it doesn’t mean you know how to use it in a particular situation. Imagine a toolbox with lots of very high quality tools sitting on your desk. Suddenly your boss walks into your office and asks you to fix a car engine or TV. You know you have the tools. You might even know what the tools are used for (that is, a wrench is used for loosening and tightening bolts), but could you fix that car engine? A toolbox is not a substitute for a good understanding of how and when to use the tools. Understanding how and when to use these tools is the main focus of this book.

当然, 即使在工具箱中有工具, 这并不意味着您知道在特定的情况下如何使用它。想象一下, 一个有很多非常高品质的工具的工具箱在你的办公桌上。突然, 你的老板走进你的办公室, 要求你修理汽车发动机或电视。你知道你有工具。你甚至可能知道工具是用来做什么 (即, 扳手是用来松动和收紧螺栓), 但你能修好那辆汽车引擎吗?工具箱不是一个好理解如何和何时使用工具的替代品。了解如何以及何时使用这些工具是本书的主要重点。

发布了234 篇原创文章 · 获赞 12 · 访问量 24万+

猜你喜欢

转载自blog.csdn.net/mounter625/article/details/102583856