mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
1037f4a925
@ -1,96 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MFGJT)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (9 ways to save the planet)
|
||||
[#]: via: (https://opensource.com/article/19/4/save-planet)
|
||||
[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike/users/alanfdoss/users/jmpearce)
|
||||
|
||||
9 ways to save the planet
|
||||
======
|
||||
These ideas have an open source twist.
|
||||
![][1]
|
||||
|
||||
What can be done to help save the planet? The question can seem depressing at a time when it feels like an individual's contribution isn't enough. But, who are we Earth dwellers if not for a collection of individuals? So, I asked our writer community to share ways that open source software or hardware can be used to make a difference. Here's what I heard back.
|
||||
|
||||
### 9 ways to save the planet with an open source twist
|
||||
|
||||
**1.** **Disable the blinking cursor in your terminal.**
|
||||
|
||||
It might sound silly, but the trivial, blinking cursor can cause up to [2 watts per hour of extra power consumption][2]. To disable it, go to Terminal Settings: Edit > Preferences > Cursor > Cursor blinking > Disabled.
|
||||
|
||||
_Recommended by Mars Toktonaliev_
|
||||
|
||||
**2\. Reduce your consumption of animal products and processed foods.**
|
||||
|
||||
One way to do this is to add these open source apps to your phone: Daily Dozen, OpenFoodFacts, OpenVegeMap, and Food Restrictions. These apps will help you eat a healthy, plant-based diet, find vegan- and vegetarian-friendly restaurants, and communicate your dietary needs to others, even if they do not speak the same language. To learn more about these apps read [_4 open source apps to support eating a plant-based diet_][3].
|
||||
|
||||
_Recommendation by Joshua Allen Holm_
|
||||
|
||||
**3\. Recycle old computers.**
|
||||
|
||||
How? With Linux, of course. Pay it forward by giving creating a new computer for someone who can't one and keep a computer out of the landfill. Here's how we do it at [The Asian Penguins][4].
|
||||
|
||||
_Recommendation by Stu Keroff_
|
||||
|
||||
**4\. Turn off devices when you're not using them.**
|
||||
|
||||
Use "smart power strips" that have a "master" outlet and several "controlled" outlets. Plug your PC into the master outlet, and when you turn on the computer, your monitor, printer, and anything else plugged into the controlled outlets turns on too. A simpler, low-tech solution is a power strip with a timer. That's what I use at home. You can use switches on the timer to set a handy schedule to turn the power on and off at specific times. Automatically turn off your network printer when no one is at home. Or for my six-year-old laptop, extend the life of the battery with a schedule to alternate when it's running from wall power (outlet is on) and when it's running from the battery (outlet is off).
|
||||
|
||||
_Recommended by Jim Hall_
|
||||
|
||||
**5\. Reduce the use of your HVAC system.**
|
||||
|
||||
Sunlight shining through windows adds a lot of heat to your home during the summer. Use Home Assistant to [automatically adjust][5] window blinds and awnings [based on the time of day][6], or even based on the angle of the sun.
|
||||
|
||||
_Recommended by Michael Hrivnak_
|
||||
|
||||
**6\. Turn your thermostat off or to a lower setting while you're away.**
|
||||
|
||||
If your home thermostat has an "Away" feature, activating it on your way out the door is easy to forget. With a touch of automation, any connected thermostat can begin automatically saving energy while you're not home. [Stataway][7] is one such project that uses your phone's GPS coordinates to determine when it should set your thermostat to "Home" or "Away".
|
||||
|
||||
_Recommended by Michael Hrivnak_
|
||||
|
||||
**7\. Save computing power for later.**
|
||||
|
||||
I have an idea: Create a script that can read the power output from an alternative energy array (wind and solar) and begin turning on servers (taking them from a power-saving sleep mode to an active mode) in a computing cluster until the overload power is used (whatever excess is produced beyond what can be stored/buffered for later use). Then use the overload power during high-production times for compute-intensive projects like rendering. This process would be essentially free of cost because the power can't be buffered for other uses. I'm sure the monitoring, power management, and server array tools must exist to do this. Then, it's just an integration problem, making it all work together.
|
||||
|
||||
_Recommended by Terry Hancock_
|
||||
|
||||
**8\. Turn off exterior lights.**
|
||||
|
||||
Light pollution affects more than 80% of the world's population, according to the [World Atlas of Artificial Night Sky Brightness][8], published (Creative Commons Attribution-NonCommercial 4.0) in 2016 in the open access journal _Science Advances_. Turning off exterior lights is a quick way to benefit wildlife, human health, our ability to enjoy the night sky, and of course energy consumption. Visit [darksky.org][9] for more ideas on how to reduce the impact of your exterior lighting.
|
||||
|
||||
_Recommended by Michael Hrivnak_
|
||||
|
||||
**9\. Reduce your CPU count.**
|
||||
|
||||
For me, I remember I used to have a whole bunch of computers running in my basement as my IT playground/lab. I've become more conscious now of power consumption and so have really drastically reduced my CPU count. I like to take advantage of VMs, zones, containers... that type of technology a lot more these days. Also, I'm really glad that small form factor and SoC computers, such as the Raspberry Pi, exist because I can do a lot with one, such as run a DNS or Web server, without heating the room and running up my electricity bill.
|
||||
|
||||
P.S. All of these computers are running Linux, FreeBSD, or Raspbian!
|
||||
|
||||
_Recommended by Alan Formy-Duvall_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/4/save-planet
|
||||
|
||||
作者:[Jen Wike Huger ][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jen-wike/users/alanfdoss/users/jmpearce
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pixelated-world.png?itok=fHjM6m53
|
||||
[2]: https://www.redhat.com/archives/fedora-devel-list/2009-January/msg02406.html
|
||||
[3]: https://opensource.com/article/19/4/apps-plant-based-diets
|
||||
[4]: https://opensource.com/article/19/2/asian-penguins-close-digital-divide
|
||||
[5]: https://www.home-assistant.io/docs/automation/trigger/#sun-trigger
|
||||
[6]: https://www.home-assistant.io/components/cover/
|
||||
[7]: https://github.com/mhrivnak/stataway
|
||||
[8]: http://advances.sciencemag.org/content/2/6/e1600377
|
||||
[9]: http://darksky.org/
|
@ -1,97 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (cycoe)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Debugging in Emacs: The Grand Unified Debugger)
|
||||
[#]: via: (https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/)
|
||||
[#]: author: (Vineeth Kartha https://opensourceforu.com/author/vineeth-kartha/)
|
||||
|
||||
Debugging in Emacs: The Grand Unified Debugger
|
||||
======
|
||||
|
||||
[![][1]][2]
|
||||
|
||||
_This article briefly explores the features of the Grand Unified Debugger, a debugging tool for Emacs._
|
||||
|
||||
If you are a C/C++ developer, it is highly likely that you have crossed paths with GDB (the GNU debugger) which is, without doubt, one of the most powerful and unrivalled debuggers out there. Its only drawback is that it is command line based, and though that offers a lot of power, it is sometimes a bit restrictive as well. This is why smart people started coming up with IDEs to integrate editors and debuggers, and give them a GUI. There are still developers who believe that using the mouse reduces productivity and that mouse-click based GUIs are temptations by the devil.
|
||||
Since Emacs is one of the coolest text editors out there, I am going to show you how to write, compile and debug code without having to touch the mouse or move out of Emacs.
|
||||
|
||||
![Figure 1: Compile command in Emacs’ mini buffer][3]
|
||||
|
||||
![Figure 2: Compilation status][4]
|
||||
|
||||
The Grand Unified Debugger, or GUD as it is commonly known, is an Emacs mode in which GDB can be run from within Emacs. This provides all the features of Emacs in GDB. The user does not have to move out of the editor to debug the code written.
|
||||
|
||||
**Setting the stage for the Grand Unified Debugger**
|
||||
If you are using a Linux machine, then it is likely you will have GDB and gcc already installed. The next step is to ensure that Emacs is also installed. I am assuming that the readers are familiar with GDB and have used it at least for basic debugging. If not, please do check out some quick introductions to GDB that are widely available on the Internet.
|
||||
|
||||
For people who are new to Emacs, let me introduce you to some basic terminology. Throughout this article, you will see shortcut commands such as C-c, M-x, etc. C means the Ctrl key and M means the Alt key. C-c means the Ctrl + c keys are pressed. If you see C-c c, it means Ctrl + c is pressed followed by c. Also, in Emacs, the main area where you edit the text is called the main buffer, and the area at the bottom of the Emacs window, where commands are entered, is called the mini buffer.
|
||||
Start Emacs and to create a new file, press _C-x C-f_. This will prompt you to enter a file name. Let us call our file ‘buggyFactorial.cpp’. Once the file is open, type in the code shown below:
|
||||
|
||||
```
|
||||
#include<iostream>
|
||||
#include <assert.h>
|
||||
int factorial(int num) {
|
||||
int product = 1;
|
||||
while(num--) {
|
||||
product *= num;
|
||||
}
|
||||
return product;
|
||||
}
|
||||
int main() {
|
||||
int result = factorial(5);
|
||||
assert(result == 120);
|
||||
}
|
||||
```
|
||||
|
||||
Save the file with _C-x C-s_. Once the file is saved, it’s time to compile the code. Press _M-x_ and in the prompt that comes up, type in compile and hit Enter. Then, in the prompt, replace whatever is there with _g++ -g buggyFactorial.cpp_ and again hit _Enter_.
|
||||
|
||||
This will open up another buffer in Emacs that will show the status of the compile and, hopefully, if the code typed in is correct, you will get a buffer like the one shown in Figure 2.
|
||||
|
||||
To hide this compilation status buffer, make sure your cursor is in the compilation buffer (you can do this without the mouse using _C-x o_-this is used to move the cursor from one open buffer to the other), and then press _C-x 0_. The next step is to run the code and see if it works fine. Press M-! and in the mini buffer prompt, type _./a.out._
|
||||
|
||||
See the mini buffer that says the assertion is failed. Clearly, something is wrong with the code, because the factorial (5) is 120. So let’s debug the code now.
|
||||
|
||||
![Figure 3: Output of the code in the mini buffer][5]
|
||||
|
||||
![Figure 4: The GDB buffer in Emacs][6]
|
||||
|
||||
**Debugging the code using GUD**
|
||||
Now, since we have the code compiled, it’s time to see what is wrong with it. Press M-x and in the prompt, enter _gdb._ In the next prompt that appears, write _gdb -i=mi a.out_, which will start GDB in the Emacs buffer and if everything goes well, you should get the window that’s shown in Figure 4.
|
||||
At the gdb prompt, type break main and then r to run the program. This should start running the program and should break at the _main()_.
|
||||
|
||||
As soon as GDB hits the break point at main, a new buffer will open up showing the code that you are debugging. Notice the red dot on the left side, which is where your breakpoint was set. There will be a small indicator that shows which line of the code you are on. Currently, this will be the same as the break point itself (Figure 5).
|
||||
|
||||
![Figure 5: GDB and the code in split windows][7]
|
||||
|
||||
![Figure 6: Show the local variables in a separate frame in Emacs][8]
|
||||
|
||||
To debug the factorial function, we need to step into it. For this, you can either use the _gdb_ prompt and the gdb command step, or you can use the Emacs shortcut _C-c C-s_. There are other similar shortcuts, but I prefer using the GDB commands. So I will use them in the rest of this article.
|
||||
Let us keep an eye on the local variables while stepping through the factorial number. Check out Figure 6 for how to get an Emacs frame to show the local variables.
|
||||
|
||||
Step through the code in the GDB prompt and watch the value of the local variable change. In the first iteration of the loop itself, we see a problem. The value of the product should have been 5 and not 4.
|
||||
|
||||
This is where I leave you and now it’s up to the readers to explore and discover the magic land called GUD mode. Every gdb command works in the GUD mode as well. I leave the fix to this code as an exercise to readers. Explore and see how you can customise things to make your workflow simpler and become more productive while debugging.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/
|
||||
|
||||
作者:[Vineeth Kartha][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensourceforu.com/author/vineeth-kartha/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?resize=696%2C440&ssl=1 (Screenshot from 2019-09-25 15-39-46)
|
||||
[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?fit=800%2C506&ssl=1
|
||||
[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_1.png?resize=350%2C228&ssl=1
|
||||
[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_2.png?resize=350%2C228&ssl=1
|
||||
[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_3.png?resize=350%2C228&ssl=1
|
||||
[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_4.png?resize=350%2C227&ssl=1
|
||||
[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_5.png?resize=350%2C200&ssl=1
|
||||
[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_6.png?resize=350%2C286&ssl=1
|
@ -1,219 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (qianmingtian)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Install and Use Wireshark on Ubuntu Linux)
|
||||
[#]: via: (https://itsfoss.com/install-wireshark-ubuntu/)
|
||||
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
|
||||
|
||||
Install and Use Wireshark on Ubuntu Linux
|
||||
======
|
||||
|
||||
_**Brief: You’ll learn to install the latest Wireshark on Ubuntu and other Ubuntu-based distribution in this tutorial. You’ll also learn how to run Wireshark without sudo and how to set it up for packet sniffing.**_
|
||||
|
||||
[Wireshark][1] is a free and open-source network protocol analyzer widely used around the globe.
|
||||
|
||||
With Wireshark, you can capture incoming and outgoing packets of a network in real-time and use it for network troubleshooting, packet analysis, software and communication protocol development, and many more.
|
||||
|
||||
It is available on all major desktop operating systems like Windows, Linux, macOS, BSD and more.
|
||||
|
||||
In this tutorial, I will guide you to install Wireshark on Ubuntu and other Ubuntu-based distributions. I’ll also show a little about setting up and configuring Wireshark to capture packets.
|
||||
|
||||
### Installing Wireshark on Ubuntu based Linux distributions
|
||||
|
||||
![][2]
|
||||
|
||||
Wireshark is available on all major Linux distributions. You should check out the [official installation instructions][3]. because in this tutorial, I’ll focus on installing the latest Wireshark version on Ubuntu-based distributions only.
|
||||
|
||||
Wireshark is available in the Universe repository of Ubuntu. You can [enable universe repository][4] and then install it like this:
|
||||
|
||||
```
|
||||
sudo add-apt-repository universe
|
||||
sudo apt install wireshark
|
||||
```
|
||||
|
||||
One slight problem in this approach is that you might not always get the latest version of Wireshark.
|
||||
|
||||
For example, in Ubuntu 18.04, if you [use the apt command][5] to check the available version of Wireshark, it is 2.6.
|
||||
|
||||
```
|
||||
[email protected]:~$ apt show wireshark
|
||||
Package: wireshark
|
||||
Version: 2.6.10-1~ubuntu18.04.0
|
||||
Priority: optional
|
||||
Section: universe/net
|
||||
Origin: Ubuntu
|
||||
Maintainer: Balint Reczey <[email protected]>
|
||||
```
|
||||
|
||||
However, [Wireshark 3.2 stable version][6] has been released months ago. New release brings new features, of course.
|
||||
|
||||
So, what do you do in such case? Thankfully, Wiresshark developers provide an official PPA that you can use to install the latest stable version of Wireshark on Ubuntu and other Ubuntu-based distributions.
|
||||
|
||||
I hope you are acquainted with PPA. If not, please [read our excellent guide on PPA to understand it completely][7].
|
||||
|
||||
Open a terminal and use the following commands one by one:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:wireshark-dev/stable
|
||||
sudo apt update
|
||||
sudo apt install wireshark
|
||||
```
|
||||
|
||||
Even if you have an older version of Wireshark installed, it will be updated to the newer version.
|
||||
|
||||
While installing, you will be asked whether to allow non-superusers to capture packets. Select Yes to allow and No to restrict non-superusers to capture packets & finish the installation.
|
||||
|
||||
### Running Wireshark without sudo
|
||||
|
||||
If you have selected **No** in the previous installation, then run the following command as root:
|
||||
|
||||
```
|
||||
sudo dpkg-reconfigure wireshark-common
|
||||
```
|
||||
|
||||
And select **Yes** by pressing the tab key and then using enter key:
|
||||
|
||||
![][8]
|
||||
|
||||
Since you have allowed the non-superuser to capture packets, you have to add the user to wireshark group. Use the [usermod command][9] to add yourself to the wireshark group.
|
||||
|
||||
```
|
||||
sudo usermod -aG wireshark $(whoami)
|
||||
```
|
||||
|
||||
Finally, [restart your Ubuntu system][10] to make the necessary changes to your system.
|
||||
|
||||
Trivia
|
||||
|
||||
First released in 1998, Wireshark was initially known as Ethereal. Developers had to change its name to Wireshark in 2006 due to trademark issues.
|
||||
|
||||
### Starting Wireshark
|
||||
|
||||
Launching Wireshark application can be done from the application launcher or the CLI.
|
||||
|
||||
To start from CLI, just type **wireshark** on your console:
|
||||
|
||||
```
|
||||
wireshark
|
||||
```
|
||||
|
||||
From **GUI**, search for Wireshark application on the search bar and hit enter.
|
||||
|
||||
![][11]
|
||||
|
||||
Now let’s play with Wireshark.
|
||||
|
||||
### Capturing packets using Wireshark
|
||||
|
||||
When you start Wireshark, you will see a list of interfaces that you can use to capture packets to and from.
|
||||
|
||||
There are many types of interfaces available which you can monitor using Wireshark such as, Wired, External devices, etc. According to your preference, you can choose to show specific types of interfaces in the welcome screen from the marked area in the given image below.
|
||||
|
||||
![Select interface][12]
|
||||
|
||||
For instance, I listed only the **Wired** network interfaces.
|
||||
|
||||
![][13]
|
||||
|
||||
Next, to start capturing packets, you have to select the interface (which in my case is ens33) and click on the **Start capturing packets** icon as marked in the image below.
|
||||
|
||||
![Start capturing packets with Wireshark][14]
|
||||
|
||||
You can also capture packets to and from multiple interfaces at the same time. Just press and hold the **CTRL** button while clicking on the interfaces that you want to capture to and from and then hit the **Start capturing packets** icon as marked in the image below.
|
||||
|
||||
![][15]
|
||||
|
||||
Next, I tried using **ping google.com** command in the terminal and as you can see, many packets were captured.
|
||||
|
||||
![Captured packets][16]
|
||||
|
||||
Now you can select on any packet to check that particular packet. After clicking on a particular packet you can see the information about different layers of TCP/IP Protocol associated with it.
|
||||
|
||||
![Packet info][17]
|
||||
|
||||
You can also see the RAW data of that particular packet at the bottom as shown in the image below.
|
||||
|
||||
![Check RAW data in the captured packets][18]
|
||||
|
||||
This is why end-to-end encryption is important
|
||||
|
||||
Imagine you are logging into a website that doesn’t use HTTPS. Anyone on the same network as you can sniff the packets and see the user name and password in the RAW data.
|
||||
This is why most chat applications use end to end encryption and most websites these days use https (instead of http).
|
||||
|
||||
#### Stopping packet capture in Wireshark
|
||||
|
||||
You can click on the red icon as marked in the given image to stop capturing Wireshark packets.
|
||||
|
||||
![Stop packet capture in Wireshark][19]
|
||||
|
||||
#### Save captured packets to a file
|
||||
|
||||
You can click on the marked icon in the image below to save captured packets to a file for future use.
|
||||
|
||||
![Save captured packets by Wireshark][20]
|
||||
|
||||
**Note**: _Output can be exported to XML, PostScript®, CSV, or plain text._
|
||||
|
||||
Next, select a destination folder, and type the file name and click on **Save**.
|
||||
Then select the file and click on **Open**.
|
||||
|
||||
![][21]
|
||||
|
||||
Now you can open and analyze the saved packets anytime. To open the file, press **\ + o**
|
||||
or go to **File > Open** from Wireshark.
|
||||
|
||||
The captured packets should be loaded from the file.
|
||||
|
||||
![][22]
|
||||
|
||||
### Conclusion
|
||||
|
||||
Wireshark supports many different communication protocols. There are many options and features that provide you the power to capture and analyze the network packets in a unique way. You can learn more about Wireshark from their [official documentation][23].
|
||||
|
||||
I hope this detailed helped you to install Wireshark on Ubuntu. Please let me know your questions and suggestions.
|
||||
|
||||
![][24]
|
||||
|
||||
### Kushal Rai
|
||||
|
||||
A computer science student & Linux and open source lover. He likes sharing knowledge for he believes technology shapes the perception of modern world. Kushal also loves music and photography.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-wireshark-ubuntu/
|
||||
|
||||
作者:[Community][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/itsfoss/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.wireshark.org/
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/wireshark_ubuntu.png?ssl=1
|
||||
[3]: https://www.wireshark.org/docs/wsug_html_chunked/ChBuildInstallUnixInstallBins.html
|
||||
[4]: https://itsfoss.com/ubuntu-repositories/
|
||||
[5]: https://itsfoss.com/apt-command-guide/
|
||||
[6]: https://www.wireshark.org/news/20191218.html
|
||||
[7]: https://itsfoss.com/ppa-guide/
|
||||
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/yes.png?ssl=1
|
||||
[9]: https://linuxhandbook.com/usermod-command/
|
||||
[10]: https://itsfoss.com/schedule-shutdown-ubuntu/
|
||||
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/wire.png?ssl=1
|
||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/interfaces.jpg?ssl=1
|
||||
[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/intoption.jpg?ssl=1
|
||||
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/singleinterface.jpg?ssl=1
|
||||
[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/selint.jpg?ssl=1
|
||||
[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/capture.jpg?ssl=1
|
||||
[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/packetinfo.png?ssl=1
|
||||
[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/raw.png?ssl=1
|
||||
[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/stopcapture.png?ssl=1
|
||||
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/savepackets.jpg?ssl=1
|
||||
[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/savename.jpg?ssl=1
|
||||
[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/openpacket.png?ssl=1
|
||||
[23]: https://www.wireshark.org/docs/https://www.wireshark.org/docs/
|
||||
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/kushal_rai.jpg?ssl=1
|
99
translated/tech/20190422 9 ways to save the planet.md
Normal file
99
translated/tech/20190422 9 ways to save the planet.md
Normal file
@ -0,0 +1,99 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MFGJT)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (9 ways to save the planet)
|
||||
[#]: via: (https://opensource.com/article/19/4/save-planet)
|
||||
[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike/users/alanfdoss/users/jmpearce)
|
||||
|
||||
九种拯救地球的方法
|
||||
======
|
||||
这些主意都用到了有关开源的内容的技巧
|
||||
|
||||
![][1]
|
||||
|
||||
图片来源:Geralt. CC0.
|
||||
|
||||
人们可以做些什么来拯救地球?这个问题可能会让人感到压抑,因为有时我们感觉个人可以做的贡献太少了。但是作为地球公民,我们从来不是一个人。所以,我向我们的作家社区征集了一些开源软件或硬件可以帮助改变现状的方法。以下是他们的回复。
|
||||
|
||||
### 9种利用开源的内容来拯救地球的方法
|
||||
|
||||
**1.** **在你的终端禁用闪烁的光标。**
|
||||
|
||||
这听起来可能有点傻,但是那个无关紧要的闪烁的光标可能导致[每小时两瓦特的额外电力开销][2]。如果要禁用光标闪烁,可以通过更改终端设置:编辑(edit)>偏好设置(preferences)>光标>光标闪烁>禁用。
|
||||
|
||||
_由 Mars Toktonaliev 推荐_
|
||||
|
||||
**2\. 减少有关动物产品和加工食物的消费。**
|
||||
|
||||
一种拯救地球的方法是在你的手机中添加这些开源的 APP:Daily Dozen,OpenFoodFacts,OpenVegeMap,和 Food Restrictions。这些APP可以帮助你准备一份健康的素食饮食计划,为你找到素食主义者和严格素食主义者可以就餐的餐厅,还可以帮助你把你的饮食需求告诉别人,即使他们不和你讲同一种语言。如果想要了解更多有关这些的APP的信息,你可以阅读[_4款帮助你准备素食饮食的开源APP_][3].
|
||||
|
||||
_由J oshua Allen Holm 推荐_
|
||||
|
||||
**3\. 回收旧电脑。**
|
||||
|
||||
怎么回收?当然是用Linux。通过给一个没办法自己获得一台电脑的人一台新电脑的方式传递爱心,你可以避免让这台电脑进到垃圾填埋场。可以在 [The Asian Penguins][4] 看看我们是怎么做的。
|
||||
|
||||
_由 Stu Keroff 推荐_
|
||||
|
||||
**4\. 在你不使用设备时关闭它们**
|
||||
|
||||
你可以使用带有主插座和控制插座的“智能插座板”。把你的电脑连接到主插座上,这样的话当你打开电脑时所有你连接到控制插座上的设备如显示器,打印机等也都会打开。一个更简单的不那么先进的方法是使用一个带有计时器的插座板。我在家里就是用的这个。你可以用计时器上的开关设定一个定时开关电源的时间表。这样可以在没有人在家时自动关闭网络打印机。或者以我的用了六年的笔记本电脑为例,我通过一个在使用外接电源(外接电源打开)和使用电脑电池(外接电源关闭)的电源计划延长了电脑电池的寿命。
|
||||
|
||||
_由 Jim Hall 推荐_
|
||||
|
||||
**5\. 减少供暖通风系统的使用。**
|
||||
|
||||
在夏天,通过窗户的阳光可以为室内提供很多热量。使用 Home Assistant [自动调节][5]窗帘和遮阳棚,这可以是[基于一天中的时间的][6],甚至是基于太阳高度角的。
|
||||
|
||||
_由 Michael Hrivnak 推荐_
|
||||
|
||||
**6\. 当你不在家时,把你的温度调节器调到一个低一些的温度。**
|
||||
|
||||
如果你的家用温度调节器有“离开”功能,你很容易忘记在出门时启用它。通过一点自动化,任何连接到网络的温度调节器都可以在你不在家时自动节省能量。[Stataway][7] 就是一个这样项目。它通过调用你的手机的GPS坐标来决定是将你的温度调节器设置为“在家”还是“离开”。
|
||||
|
||||
_由 Michael Hrivnak 推荐_
|
||||
|
||||
**7\. 为未来储蓄算力**
|
||||
|
||||
我有一个主意:创建一个可以读取可选的能量阵列(如风能或太阳能)的输出的脚本。这个脚本应该将计算集群中的服务器从睡眠模式更改为激活模式直到过量的电能(超出可以储存的部分)被用尽。然后在高产能时段使用这些过量的电能来进行需要大量计算的项目,比如渲染。这个过程本质应该是免费的,因为使用的能量无法被储存起来挪作他用。我相信现有的监控、能量管理和服务器阵列工具一定可以实现这个功能。那么剩下的只是一些整合上的问题,好让整个系统工作。
|
||||
|
||||
_由 Terry Hancock 推荐_
|
||||
|
||||
**8\. 关掉你的灯**
|
||||
|
||||
根据 [World Atlas of Artificial Night Sky Brightness][8] 的说法,光污染影响了全世界超过80%的污染。这一结论在2016年被发表(遵循 Creative Commons Attribution-NonCommercial 4.0 协议)在公开权限的期刊 _Science Advances_ 上。关闭外部的灯是一个可以快速使野生生物、人类健康受益并让我们享受夜晚的天空的方法,而且可以减少能量消耗。访问 [darksky.org][9] 来查看更多减少你的外部灯光的影响的方法。
|
||||
|
||||
_由 Michael Hrivnak 推荐_
|
||||
|
||||
**9\. 减少你的CPU数量**
|
||||
|
||||
就我个人而言,我记得我以前有很多在地下室运行的电脑作为我的IT游乐场/实验室。我现在对于能量消耗更加注意了,所以真的大量地减少了我的CPU数量。我现在更喜欢利用虚拟机、区域和容器等科技。另外,我很高兴有小型电脑和SoC电脑这种东西,比如 Raspberry Pi。因为我可以用一台这样的电脑做很多事情,比如运行一个DNS或者网络服务器,而无需使整个屋子变热并积累昂贵的电费账单。
|
||||
|
||||
P.S. 这些电脑都运行于 Linux,FreeBSD,或者 Raspbian 系统!
|
||||
|
||||
_由 Alan Formy-Duvall 推荐_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/4/save-planet
|
||||
|
||||
作者:[Jen Wike Huger ][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MFGJT](https://github.com/MFGJT)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jen-wike/users/alanfdoss/users/jmpearce
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pixelated-world.png?itok=fHjM6m53
|
||||
[2]: https://www.redhat.com/archives/fedora-devel-list/2009-January/msg02406.html
|
||||
[3]: https://opensource.com/article/19/4/apps-plant-based-diets
|
||||
[4]: https://opensource.com/article/19/2/asian-penguins-close-digital-divide
|
||||
[5]: https://www.home-assistant.io/docs/automation/trigger/#sun-trigger
|
||||
[6]: https://www.home-assistant.io/components/cover/
|
||||
[7]: https://github.com/mhrivnak/stataway
|
||||
[8]: http://advances.sciencemag.org/content/2/6/e1600377
|
||||
[9]: http://darksky.org/
|
@ -0,0 +1,101 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (cycoe)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Debugging in Emacs: The Grand Unified Debugger)
|
||||
[#]: via: (https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/)
|
||||
[#]: author: (Vineeth Kartha https://opensourceforu.com/author/vineeth-kartha/)
|
||||
|
||||
Emacs 调试秘籍之——GUD 调试器
|
||||
======
|
||||
|
||||
[![][1]][2]
|
||||
|
||||
_本文简短地对 Emacs 的调试工具 GUD(译注:全称 Grand Unified Debugger,鉴于其缩写形式更为人熟知,以下全文将使用缩写替代此全称)的特性进行了探索。_
|
||||
|
||||
如果你是一个 C 或 C++ 开发者,你很可能已经使用过 GDB(GNU 调试器),毫无疑问,它是现今最强大、最无可匹敌的调试器之一。它唯一的缺点就是它基于命令行,虽然仍能提供许多强大的功能,但有时也会具有一些局限性。这也就是为什么聪明的人们开始追求整合了编辑器和调试器的<ruby>图形化<rt>GUI</rt>集成<rt>Integrated</rt>开发<rt>Development</rt>环境<rt>Environment</rt></ruby>。仍有些开发者坚信使用鼠标会降低工作效率,在 GUI 上用鼠标点~点~点~是来自恶魔的诱惑。
|
||||
|
||||
因为 Emacs 是现今最酷的文本编辑器之一,我将为你展示如何在不碰鼠标且不离开 Emacs 的情况下,实现写代码、编译代码、调试代码的过程。
|
||||
|
||||
![图 1: Emacs 迷你缓冲区中的编译命令][3]
|
||||
|
||||
![图 2: 编译状态][4]
|
||||
|
||||
GUD 是 Emacs 下的一个<ruby>模式<rt>mode</rt></ruby>,用于在 Emacs 中运行 GDB。它向 GDB 提供了 Emacs 的所有特性,使用户无需离开编辑器就可以对代码进行调试。
|
||||
|
||||
**使用 GUD 的前期准备**
|
||||
如果你正在使用一个 Linux 机器,很可能你已经安装了 GDB 和 gcc,接下来就是要确保已经安装了 Emacs。以下的内容我将假设读者熟悉 GDB 并且至少用它做过基本的调试。如果你未曾接触过 GDB,你可以做个快速入门,这些资料在网上随处可得。
|
||||
|
||||
对于那些 Emacs 新手,我将向你介绍一些基本术语。纵览整篇文章,你将看到诸如 _C-c M-x_ 等快捷键。此处 _C_ 代表 _Ctrl_ 键,_M_ 代表 _Alt_ 键。_C-c_ 代表 _Ctrl_ 键和 _c_ 键被同时按下。如果你看到 _C-c c_,它代表同时按下 _Ctrl_ 键和 _c_ 键,紧接着按下 _c_ 键。在 Emacs 中,编辑文本的主要区域被称为<ruby>主<rt>main</rt>缓冲区<rt>buffer</rt></ruby>,而在 Emacs 窗口下方用于输入命令的区域被称为<ruby>迷你<rt>mini</rt>缓冲区<rt>buffer</rt></ruby>。
|
||||
|
||||
启动 Emacs,并按下 _C-x C-f_ 来创建一个新文件。Emacs 将提示你输入一个文件名,此处让我们将文件命名为 `buggyFactorial.cpp`。一旦文件打开,输入如下代码:
|
||||
|
||||
```
|
||||
#include<iostream>
|
||||
#include <assert.h>
|
||||
|
||||
int factorial(int num) {
|
||||
int product = 1;
|
||||
while(num--) {
|
||||
product *= num;
|
||||
}
|
||||
return product;
|
||||
}
|
||||
int main() {
|
||||
int result = factorial(5);
|
||||
assert(result == 120);
|
||||
}
|
||||
```
|
||||
|
||||
使用 _C-x C-s_ 快捷键保存文件。文件保存完毕,是时候进行编译了。按下 _M-x_,在弹出的<ruby>提示符<rt>prompt</rt></ruby>后输入 _compile_ 并点击回车。然后在提示符后,将内容替换为 _g++ -g buggyFactorial.cpp_ 并再次点击回车。
|
||||
|
||||
这将在 Emacs 中开启另一个缓冲区,显示编译的状态。如果你的代码输入没有错误,你将预期得到如图 2 所示的缓冲区。
|
||||
|
||||
要想隐藏编译缓冲区,首先确保你的光标在编译缓冲区中(你可以不使用鼠标,而是通过 _C-x o_ 快捷键将光标从一个缓冲区移动到另一个),然后按下 _C-x 0_。下一步就是运行代码,并观察是否运行良好。按下 _M-!_ 快捷键并在迷你缓冲区的提示符后面输入 _./a.out_。
|
||||
|
||||
你可以看到迷你缓冲区中显示断言失败。很明显代码中有错误,因为 5 的阶乘是 120。那么让我们现在开始调试吧。
|
||||
|
||||
![图 3: 代码在迷你缓冲区中的输出][5]
|
||||
|
||||
![图 4: Emacs 中的 GDB 缓冲区][6]
|
||||
|
||||
**使用 GUD 调式代码**
|
||||
现在,我们的代码已经编译完成,是时候看看到底哪里出错了。按下 _M-x_ 快捷键并在提示符后输入 _gdb_。在接下来的提示符后,输入 _gdb -i=mi a.out_。如果一切顺利,GDB 会在 Emacs 缓冲区中启动,你会看到如图 4 所示的窗口。
|
||||
在 _gdb_ 提示符后,输入 _break main_ 来设置断点,并输入 _r_ 来运行程序。程序会开始运行并停在 _main()_ 函数处。
|
||||
|
||||
一旦 GDB 到达了 _main_ 处设置的断点,就会弹出一个新的缓冲区显示你正在调试的代码。注意左侧的红点,正是你设置断点的位置,同时会有一个小的标志提示你当前代码运行到了哪一行。当前,该标志就在断点处(如图 5)。
|
||||
|
||||
![图 5: GDB 与代码显示在两个分离的窗口][7]
|
||||
|
||||
![图 6: 在 Emacs 中使用独立帧显示局部变量][8]
|
||||
|
||||
为了调试 _factorial_ 函数,我们需要单步运行。想要达到此目的,你可以使用 _gdb_ 提示符和 GDB 命令 _step_,或者使用 Emacs 快捷键 _C-c C-s_。还有其它一些快捷键,但我更喜欢 GDB 命令。因此我将在本文的后续部分使用它们。
|
||||
|
||||
单步运行时让我们注意一下局部变量中的阶乘值。参考图 6 来设置在 Emacs 帧中显示局部变量值。
|
||||
|
||||
在 GDB 提示符中进行单步运行并观察局部变量值的变化。在循环的第一次迭代中,我们发现了一个问题。此处乘法的结果应该是 5 而不是 4。
|
||||
|
||||
本文到这里也差不多结束了,读者可以自行探索发现 GUD 模式这片新大陆。GDB 中的所有命令都可以在 GUD 模式中运行。我将此代码的修复留给读者作为一个练习。看看你在调试的过程中,可以做哪一些定制化,来使你的工作流更加简单和高效。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/
|
||||
|
||||
作者:[Vineeth Kartha][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[cycoe](https://github.com/cycoe)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensourceforu.com/author/vineeth-kartha/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?resize=696%2C440&ssl=1 (Screenshot from 2019-09-25 15-39-46)
|
||||
[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?fit=800%2C506&ssl=1
|
||||
[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_1.png?resize=350%2C228&ssl=1
|
||||
[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_2.png?resize=350%2C228&ssl=1
|
||||
[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_3.png?resize=350%2C228&ssl=1
|
||||
[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_4.png?resize=350%2C227&ssl=1
|
||||
[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_5.png?resize=350%2C200&ssl=1
|
||||
[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_6.png?resize=350%2C286&ssl=1
|
@ -0,0 +1,213 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (qianmingtian)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Install and Use Wireshark on Ubuntu Linux)
|
||||
[#]: via: (https://itsfoss.com/install-wireshark-ubuntu/)
|
||||
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
|
||||
|
||||
Ubuntu 上 Wireshark 的安装与使用
|
||||
======
|
||||
|
||||
_**简介:在本教程中,你将学习如何在 Ubuntu 和其他基于 Ubuntu 的发行版上安装最新的 Wireshark。同时你也将学习如何在没有 sudo 的情况下来运行 Wireshark ,以及如何设置它来进行数据包嗅探。**_
|
||||
|
||||
[Wireshark][1] 是一款免费开源网络协议分析器,它在全球被广泛使用。
|
||||
|
||||
通过使用 Wireshark ,你可以实时捕获网络的传入和传出数据包,并将其用于网络故障排除、数据包分析、软件和通信协议开发等。
|
||||
|
||||
它适用于所有主流的桌面操作系统,如 Windows 、 Linux 、 macOS 、 BSD 等。
|
||||
|
||||
在本教程中,我将指导你在 Ubuntu 和其他基于 Ubuntu 的发行版上安装 Wireshark 。我还将介绍如何设置和配置 Wireshark 来捕获数据包。
|
||||
|
||||
### 在基于 Ubuntu 的 Linux 发行版上安装 Wireshark
|
||||
![][2]
|
||||
|
||||
Wireshark 适用于所有主流 Linux 发行版。你应该查看[官方安装说明][3]。因为在本教程中,我将着重在仅基于 Ubuntu 的发行版上安装最新版本的 Wireshark 。
|
||||
|
||||
Wireshark 可以在 Ubuntu 的 Universe 存储库中找到。你可以[启用 universe 存储库][4],然后按如下方式安装:
|
||||
```
|
||||
sudo add-apt-repository universe
|
||||
sudo apt install wireshark
|
||||
```
|
||||
|
||||
这种方法的一个小问题是,你可能并不总是得到最新版本的 Wireshark 。
|
||||
|
||||
例如,在 Ubuntu 18.04 中,如果你使用 [apt][5] 命令检查 Wireshark 的可用版本,可用版本会显示是 2.6 。
|
||||
|
||||
```
|
||||
[email protected]:~$ apt show wireshark
|
||||
Package: wireshark
|
||||
Version: 2.6.10-1~ubuntu18.04.0
|
||||
Priority: optional
|
||||
Section: universe/net
|
||||
Origin: Ubuntu
|
||||
Maintainer: Balint Reczey <[email protected]>
|
||||
```
|
||||
|
||||
然而, [Wireshark 3.2 稳定版][6]已经在几个月前发布了。当然,新版本拥有新的特性。
|
||||
|
||||
那么在这种情况下,你应该怎么办呢?谢天谢地, Wireshark 开发者提供了一种官方 PPA 方式,你可以使用它在 Ubuntu 和其它基于 Ubuntu 的发行版上安装最新稳定版本的 Wireshark.
|
||||
|
||||
我希望你熟悉 PPA 。如果没有,请[阅读我们关于 PPA 的优秀指南,以便完全理解它][7]。
|
||||
|
||||
打开终端并逐个使用以下命令:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:wireshark-dev/stable
|
||||
sudo apt update
|
||||
sudo apt install wireshark
|
||||
```
|
||||
即使安装了旧版本的 Wireshark ,它也将更新为新版本。
|
||||
|
||||
安装时,系统将询问你是否允许非超级用户捕获数据包。选择“是”允许,选择“否”限制非超级用户捕获数据包,最后完成安装。
|
||||
|
||||
### 不使用 sudo 运行 Wireshark
|
||||
|
||||
如果在上一次安装中选择了**否**,则以root用户身份运行以下命令:
|
||||
```
|
||||
sudo dpkg-reconfigure wireshark-common
|
||||
```
|
||||
|
||||
然后按 tab 键并使用回车键选择**是**:
|
||||
![][8]
|
||||
|
||||
由于你允许非超级用户捕获数据包,因此你必须将该用户添加到 wireshark 组。使用[ usermod ][9]命令将自己添加到 wireshark 组。
|
||||
|
||||
```
|
||||
sudo usermod -aG wireshark $(whoami)
|
||||
```
|
||||
|
||||
最后,[重启你的 Ubuntu 系统][10]对你的系统进行必要的修改。
|
||||
|
||||
冷知识
|
||||
|
||||
Wireshark 于 1998 年首次发布,最初被称为 Ethereal 。2006 年,由于商标问题,开发商不得不将其名称改为 Wireshark 。
|
||||
|
||||
### 启动 Wireshark
|
||||
|
||||
你可以从应用程序启动器或者命令行启动 Wireshark 应用。
|
||||
|
||||
如果从命令行启动,只需要在你的控制台中输入 **wireshark** :
|
||||
|
||||
```
|
||||
wireshark
|
||||
```
|
||||
要是从**图形化界面**启动,需要在搜索栏搜索 Wireshark 应用,并按回车键。
|
||||
|
||||
![][11]
|
||||
|
||||
现在,让我们来玩玩 Wireshark 吧。
|
||||
|
||||
### 使用 Wireshark 捕获数据包
|
||||
|
||||
当你启动 Wireshark 的时候,你会看到一个接口列表,你可以使用它来捕获这个接口接收和发送的数据包。
|
||||
|
||||
你可以使用 Wireshark 监视许多类型的接口,例如,有线、外部设备等。根据你的偏好,你可以从下图中的标记区域选择在欢迎屏幕中显示特定类型的接口。
|
||||
|
||||
![Select interface][12]
|
||||
|
||||
|
||||
例如,我只列出了**有线**网络接口。
|
||||
![][13]
|
||||
|
||||
接下来,要开始捕获数据包,你必须选择接口(在我的示例中是 ens33 ),然后单击**开始捕获数据包**图标,如下图所示。
|
||||
![Start capturing packets with Wireshark][14]
|
||||
|
||||
|
||||
你还可以同时从多个接口捕获数据包。只需按住 **CTRL** 按钮,同时单击要捕获的接口,然后点击**开始捕获数据包**图标,如下图所示。
|
||||
![][15]
|
||||
|
||||
接下来,我尝试在终端中使用 **ping google.com** 命令,如你所见,捕获了许多数据包。
|
||||
|
||||
![Captured packets][16]
|
||||
|
||||
现在你可以选择任何数据包来检查该特定数据包。在点击一个特定的包之后,你可以看到与它相关的 TCP/IP 协议的不同层的信息。
|
||||
|
||||
![Packet info][17]
|
||||
|
||||
你还可以在底部看到该特定数据包的原始数据,如下图所示。
|
||||
|
||||
![Check RAW data in the captured packets][18]
|
||||
|
||||
这就是为什么端到端加密很重要。
|
||||
|
||||
假设你正在登录一个不使用 HTTPS 的网站。与你在同一网络上的任何人都可以嗅探数据包,并在原始数据中看到用户名和密码。
|
||||
|
||||
这就是为什么现在大多数聊天应用程序使用端到端加密,而大多数网站使用 https (而不是 http )。
|
||||
|
||||
#### 在 Wireshark 中停止数据包捕获
|
||||
|
||||
你可以点击如图所示的红色图标停止捕获数据包。
|
||||
|
||||
![Stop packet capture in Wireshark][19]
|
||||
|
||||
#### 将捕获的数据包保存成文件
|
||||
|
||||
你可以单击下图中标记的图标,将捕获的数据包保存到文件中以备将来使用。
|
||||
|
||||
![Save captured packets by Wireshark][20]
|
||||
|
||||
|
||||
**注意**:_输出可以导出为 XML 、 PostScript 、 CSV 或纯文本_
|
||||
|
||||
接下来,选择一个目标文件夹,键入文件名并单击**保存**。
|
||||
|
||||
然后选择文件并单击**打开**。
|
||||
|
||||
![][21]
|
||||
现在你可以随时打开和分析保存的数据包。要打开文件,请按 **\+o**
|
||||
或从Wireshark转到**文件 > 打开**。
|
||||
|
||||
捕获的数据包将从文件中加载。
|
||||
|
||||
![][22]
|
||||
|
||||
### 结语
|
||||
Wireshark 支持许多不同的通信协议。有许多选项和功能,使你能够以独特的方式捕获和分析网络数据包。你可以从 Wireshark 的[官方文档][23]了解更多关于 Wireshark 的信息。
|
||||
|
||||
我希望这个教程能帮助你在 Ubuntu 上安装 Wireshark 。请让我知道你的问题和建议。
|
||||
|
||||
![][24]
|
||||
### Kushal Rai
|
||||
|
||||
计算机科学专业的学生、Linux 和开源爱好者。他喜欢分享知识,因为他相信技术塑造了对现代世界的感知。 Kushal 也喜欢音乐和摄影。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-wireshark-ubuntu/
|
||||
|
||||
作者:[Community][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[qianmigntian][c]
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/itsfoss/
|
||||
[b]: https://github.com/lujun9972
|
||||
[c]: https://github.com/qianmigntian
|
||||
[1]: https://www.wireshark.org/
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/wireshark_ubuntu.png?ssl=1
|
||||
[3]: https://www.wireshark.org/docs/wsug_html_chunked/ChBuildInstallUnixInstallBins.html
|
||||
[4]: https://itsfoss.com/ubuntu-repositories/
|
||||
[5]: https://itsfoss.com/apt-command-guide/
|
||||
[6]: https://www.wireshark.org/news/20191218.html
|
||||
[7]: https://itsfoss.com/ppa-guide/
|
||||
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/yes.png?ssl=1
|
||||
[9]: https://linuxhandbook.com/usermod-command/
|
||||
[10]: https://itsfoss.com/schedule-shutdown-ubuntu/
|
||||
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/wire.png?ssl=1
|
||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/interfaces.jpg?ssl=1
|
||||
[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/intoption.jpg?ssl=1
|
||||
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/singleinterface.jpg?ssl=1
|
||||
[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/selint.jpg?ssl=1
|
||||
[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/capture.jpg?ssl=1
|
||||
[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/packetinfo.png?ssl=1
|
||||
[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/raw.png?ssl=1
|
||||
[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/stopcapture.png?ssl=1
|
||||
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/savepackets.jpg?ssl=1
|
||||
[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/savename.jpg?ssl=1
|
||||
[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/openpacket.png?ssl=1
|
||||
[23]: https://www.wireshark.org/docs/https://www.wireshark.org/docs/
|
||||
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/kushal_rai.jpg?ssl=1
|
Loading…
Reference in New Issue
Block a user