mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
e70aeeb4b9
@ -1,21 +1,24 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (laingke)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-11462-1.html)
|
||||
[#]: subject: (Viewing files and processes as trees on Linux)
|
||||
[#]: via: (https://www.networkworld.com/article/3444589/viewing-files-and-processes-as-trees-on-linux.html)
|
||||
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
|
||||
|
||||
在 Linux 上以树状查看文件和进程
|
||||
======
|
||||
介绍三个 Linux 命令:ps、pstree 和 tree 以类似树的格式查看文件和进程。
|
||||
|
||||
[Linux][3] 提供了一些方便的命令,用于以树状分支形式查看文件和进程,从而易于查看它们之间的关系。在本文中,我们将介绍 **ps**,**pstree** 和 **tree** 命令以及它们提供的一些选项,这些选项可帮助您将焦点集中在要查看的内容上。
|
||||
> 介绍三个 Linux 命令:ps、pstree 和 tree 以类似树的格式查看文件和进程。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/201910/15/093202rwm5k9pnpntgbtpr.jpg)
|
||||
|
||||
[Linux][3] 提供了一些方便的命令,用于以树状分支形式查看文件和进程,从而易于查看它们之间的关系。在本文中,我们将介绍 `ps`、`pstree` 和 `tree` 命令以及它们提供的一些选项,这些选项可帮助你将注意力集中在要查看的内容上。
|
||||
|
||||
### ps
|
||||
|
||||
我们用来列出进程的 **ps** 命令有一些有趣的选项,但是很多人从来没有利用过。虽然常用的 **ps -ef** 提供了正在运行的进程的完整列表,但是 **ps -ejH** 命令增加了一个不错的效果。它缩进了相关的进程以使这些进程之间的关系在视觉上更加清晰——就像这个片段:
|
||||
我们用来列出进程的 `ps` 命令有一些有趣的选项,但是很多人从来没有利用过。虽然常用的 `ps -ef` 提供了正在运行的进程的完整列表,但是 `ps -ejH` 命令增加了一个不错的效果。它缩进了相关的进程以使这些进程之间的关系在视觉上更加清晰——就像这个片段:
|
||||
|
||||
```
|
||||
$ ps -ejH
|
||||
@ -28,9 +31,9 @@ $ ps -ejH
|
||||
30968 30968 28410 pts/0 00:00:00 ps
|
||||
```
|
||||
|
||||
可以看到,正在运行的 ps 进程是在 bash 中运行的,而 bash 是在 ssh 会话中运行的。
|
||||
可以看到,正在运行的 `ps` 进程是在 `bash` 中运行的,而 `bash` 是在 ssh 会话中运行的。
|
||||
|
||||
**-exjf** 选项字符串提供了类似的视图,但是带有一些其它细节和符号以突出显示进程的层次结构性质:
|
||||
`-exjf` 选项字符串提供了类似的视图,但是带有一些其它细节和符号以突出显示进程的层次结构性质:
|
||||
|
||||
```
|
||||
$ ps -exjf
|
||||
@ -46,14 +49,14 @@ PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
|
||||
命令中使用的这些选项表示:
|
||||
|
||||
```
|
||||
-e select all processes
|
||||
-j use the jobs format
|
||||
-f provide a full format listing
|
||||
-H show the process hierarchy (i.e., the "forest format")
|
||||
-x lift the "must be associated with a tty" restriction
|
||||
-e 选择所有进程
|
||||
-j 使用工作格式
|
||||
-f 提供完整格式列表
|
||||
-H 分层显示进程(如,树状格式)
|
||||
-x 取消“必须与 tty 相关联”的限制
|
||||
```
|
||||
|
||||
命令同时也有一个 **\--forest** 选项提供了类似的视图。
|
||||
同时,该命令也有一个 `--forest` 选项提供了类似的视图。
|
||||
|
||||
```
|
||||
$ ps -ef --forest
|
||||
@ -66,11 +69,11 @@ shs 28410 28409 0 12:56 pts/0 00:00:00 \_ -bash
|
||||
shs 32351 28410 0 14:39 pts/0 00:00:00 \_ ps -ef --forest
|
||||
```
|
||||
|
||||
注意,这些示例只是这些命令如何使用的示例。您可以选择最适合您的流程视图的任何选项组合。
|
||||
注意,这些示例只是这些命令如何使用的示例。你可以选择最适合你的进程视图的任何选项组合。
|
||||
|
||||
### pstree
|
||||
|
||||
使用 **pstree** 命令可以获得类似的进程视图。尽管 **pstree** 具备了许多选项,但是该命令本身就提供了非常有用的显示。注意,许多父子进程关系显示在单行而不是后续行上。
|
||||
使用 `pstree` 命令可以获得类似的进程视图。尽管 `pstree` 具备了许多选项,但是该命令本身就提供了非常有用的显示。注意,许多父子进程关系显示在单行而不是后续行上。
|
||||
|
||||
```
|
||||
$ pstree
|
||||
@ -86,7 +89,7 @@ $ pstree
|
||||
│ └─xdg-permission-───2*[{xdg-permission-}]
|
||||
```
|
||||
|
||||
通过 **-n** 选项,**pstree** 以数值(按进程 ID)顺序显示进程:
|
||||
通过 `-n` 选项,`pstree` 以数值(按进程 ID)顺序显示进程:
|
||||
|
||||
```
|
||||
$ pstree -n
|
||||
@ -117,17 +120,17 @@ systemd─┬─systemd-journal
|
||||
├─sshd───sshd───sshd───bash───pstree
|
||||
```
|
||||
|
||||
使用 **pstree** 时要考虑的一些选项包括 **-a**(包括命令行参数)和 **-g**(包括进程组)。
|
||||
使用 `pstree` 时可以考虑的一些选项包括 `-a`(包括命令行参数)和 `-g`(包括进程组)。
|
||||
|
||||
以下是一些简单的示例(片段)。
|
||||
|
||||
命令 **pstree -a** 的输出内容:
|
||||
命令 `pstree -a` 的输出内容:
|
||||
|
||||
```
|
||||
└─wpa_supplicant -u -s -O /run/wpa_supplicant
|
||||
```
|
||||
|
||||
命令 **pstree -g** 的输出内容:
|
||||
命令 `pstree -g` 的输出内容:
|
||||
|
||||
```
|
||||
├─sshd(1396)───sshd(28281)───sshd(28281)───bash(28410)───pstree(1115)
|
||||
@ -135,9 +138,10 @@ systemd─┬─systemd-journal
|
||||
|
||||
### tree
|
||||
|
||||
虽然 **tree** 命令听起来与 **pstree** 非常相似,但这是用于查看文件而非进程的命令。它提供了一个漂亮的树状目录和文件视图。
|
||||
虽然 `tree` 命令听起来与 `pstree` 非常相似,但这是用于查看文件而非进程的命令。它提供了一个漂亮的树状目录和文件视图。
|
||||
|
||||
如果你使用 `tree` 命令查看 `/proc` 目录,你显示的开头部分将类似于这个:
|
||||
|
||||
如果你使用 **tree** 命令查看 **/proc** 目录,你显示的开头将类似于这个:
|
||||
```
|
||||
$ tree /proc
|
||||
/proc
|
||||
@ -164,9 +168,9 @@ $ tree /proc
|
||||
...
|
||||
```
|
||||
|
||||
如果以 root 权限运行这条命令(**sudo tree /proc**),你将会看到更多详细信息,因为 **/proc** 目录的许多内容对于普通用户而言是无法访问的。
|
||||
如果以 root 权限运行这条命令(`sudo tree /proc`),你将会看到更多详细信息,因为 `/proc` 目录的许多内容对于普通用户而言是无法访问的。
|
||||
|
||||
命令 **tree -d** 将会限制仅显示目录。
|
||||
命令 `tree -d` 将会限制仅显示目录。
|
||||
|
||||
```
|
||||
$ tree -d /proc
|
||||
@ -191,7 +195,7 @@ $ tree -d /proc
|
||||
...
|
||||
```
|
||||
|
||||
使用 **-f** 选项,**tree** 命令会显示完整的路径。
|
||||
使用 `-f` 选项,`tree` 命令会显示完整的路径。
|
||||
|
||||
```
|
||||
$ tree -f /proc
|
||||
@ -214,7 +218,7 @@ $ tree -f /proc
|
||||
...
|
||||
```
|
||||
|
||||
分层显示通常可以使进程和文件之间的关系更容易理解。可用选项的数量很多,而你总可能会找到一些视图,帮助你查看所需的内容。
|
||||
分层显示通常可以使进程和文件之间的关系更容易理解。可用选项的数量很多,而你总可以找到一些视图,帮助你查看所需的内容。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -223,7 +227,7 @@ via: https://www.networkworld.com/article/3444589/viewing-files-and-processes-as
|
||||
作者:[Sandra Henry-Stocker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[laingke](https://github.com/laingke)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
160
sources/talk/20191014 Pros and cons of event-driven security.md
Normal file
160
sources/talk/20191014 Pros and cons of event-driven security.md
Normal file
@ -0,0 +1,160 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Pros and cons of event-driven security)
|
||||
[#]: via: (https://opensource.com/article/19/10/event-driven-security)
|
||||
[#]: author: (Yuriy Andamasov https://opensource.com/users/yuriy-andamasov)
|
||||
|
||||
Pros and cons of event-driven security
|
||||
======
|
||||
Event-driven security is not an impenetrable wall, but it may be cheaper
|
||||
and better than what you've been doing to prevent data breaches.
|
||||
![Three closed doors][1]
|
||||
|
||||
Great news, everyone! Forrester Research says that [95% of all recorded breaches][2] in 2016 came from only three industries: government, technology, and retail. Everyone else is safe... ish, right?
|
||||
|
||||
Hold on for a moment. Tech? Retail? What kind of industry diversification is this? We are, after all, living in 2019, where every business is a tech business. And all of us are continuously selling something, whether it’s an innovative product or an amazing service.
|
||||
|
||||
So what the report should have said is that 95% of all recorded breaches came from attacks on 95% of all businesses both online and offline. And some of the attackers went for the .gov.
|
||||
|
||||
More on the matter, [43% of attackers target small businesses][3]—and that’s a lot considering that, on average, a hack attempt takes place every 39 seconds.
|
||||
|
||||
To top things off, the average cost of a data breach in 2020 is expected to exceed [$150 million][4]. These stats sound a bit more terrifying out of context, but the threat is still very much real. Ouch.
|
||||
|
||||
What are our options then?
|
||||
|
||||
Well, either the developers, stakeholders, decision-makers, and business owners willingly risk the integrity and security of their solutions by doing nothing, or they can consider fortifying their digital infrastructure.
|
||||
|
||||
Sure, the dilemma doesn’t seem like it offers too many options, and that’s only because it doesn’t. That said, establishing efficient network security is easier said than done.
|
||||
|
||||
### The cost of safety
|
||||
|
||||
Clearly, security is an expensive endeavor, a luxury even.
|
||||
|
||||
* Cybersecurity costs increased by 22.7% in only a year from 2016 to 2017.
|
||||
* According to Gartner, organizations spent a total of $81.6 billion on cybersecurity, a $17.7 billion increase!
|
||||
* And the worst part yet—the problem doesn’t seem like it’s going away regardless of how much money we throw at it.
|
||||
|
||||
|
||||
|
||||
Perhaps we are doing something wrong? Maybe it’s the way that we perceive network security that’s flawed? Maybe, just maybe, there’s a cheaper AND better solution?
|
||||
|
||||
### Scalability: Bad?
|
||||
|
||||
Software, network, and architecture development have evolved dramatically over the last decade. We’ve moved from the age-old monolithic approach to leaner, more dynamic methodologies that allow faster reactions to the ever-shifting demands of the modern market.
|
||||
|
||||
That said, flexibility comes at a cost. A monolith is a solid, stable element of infrastructure where a small change can crash the whole thing like a house of cards. But said change—regardless of its potential danger—is easily traceable.
|
||||
|
||||
Today, the architecture is mostly service-based, where every single piece of functionality is like a self-contained Lego block. An error in one of the blocks won’t discard the entire system. It may not even affect the blocks standing near it.
|
||||
|
||||
This approach, while adding scalability, has a downside—it’s really hard to trace a single malicious change, especially in an environment where every element is literally bombarded with new data coming anywhere from an HR or security update to, well, a malicious code attack.
|
||||
|
||||
Does this mean it’s best if we sacrifice scalability in favor of security?
|
||||
|
||||
Not at all. We’ve moved away from the monolith for a reason. Going back now will probably cost you your entire project. The tricky part is in effectively identifying what is and what isn’t a threat, as this is where the flaw of microservices lies.
|
||||
|
||||
We need preventive measures.
|
||||
|
||||
### Events, alerts, and incidents
|
||||
|
||||
Everything that happens within your network can be described in one of three words: event, alert, or incident.
|
||||
|
||||
An **event** is any observed change taking place in a network, environment, or workflow. So, for example, when a new firewall policy is pushed, you may consider that the event has happened. When the routers are updated, another event has happened, and so on and so forth.
|
||||
|
||||
An **alert** is an event that requires action. In simpler words, if you or your team need to do something due to the event taking place, it is considered an alert.
|
||||
|
||||
According to the CERT NISTT 800-61 definition, an **incident** is an event that violates your security policies. Or, in simpler words, it is an event that negatively impacts the business like a worm spreading through the network, a phishing attempt, or the loss of sensitive data.
|
||||
|
||||
By this logic, your infrastructure developers, security officers, and net admins are tasked with a very simple mission: establishing efficient preventive measures against any and all incidents.
|
||||
|
||||
Again, easier said than done.
|
||||
|
||||
There are simply too many different events taking place at one time. Every change, shift, or update differs, one from another, resulting in dozens of false-positive incidents. Add the fact that the mischievous events are very keen on disguising themselves, and you’ll get why your net admins look like they’ve lived on coffee and Red Bull for (at least) the past few weeks.
|
||||
|
||||
Is there anything we, as a responsible community of developers, managers, stakeholders, product, and business owners, can do?
|
||||
|
||||
### Event-driven security in a nutshell
|
||||
|
||||
What’s the one thing everything you ignore, act upon, or react to shares in common?
|
||||
|
||||
An event.
|
||||
|
||||
Something needs to happen for you to respond to it in any shape or form. Additionally, many events are similar to one another and can be categorized as a stream.
|
||||
|
||||
Here’s an example.
|
||||
|
||||
Let’s say you have an e-commerce store. One of your clients adds an item to his cart (event) and then removes it (event) or proceeds with the purchase (event).
|
||||
|
||||
Need I say that, other than simply categorizing them, we can analyze these events to identify behavioral patterns, and this makes it easier to identify threats in real time (or even empower HR/dev/marketing teams with additional data)?
|
||||
|
||||
#### Event vs. command
|
||||
|
||||
So event-driven security is essentially based on following up events. Were we ever _not_ following up on them? Didn’t we have commands for that?
|
||||
|
||||
Yes, yes, we have, and that’s partially the problem. Here’s an example of an event versus a command:
|
||||
|
||||
_> Event: I sit on the couch, and the TV turns on._
|
||||
_> Command: I sit on the couch and turn on the TV._
|
||||
|
||||
See the difference? I had to perform an action in the second scenario; in the first, the TV reacted to the event (me sitting on the couch generated the TV turning on) on its own.
|
||||
|
||||
The first approach ensures the integrity of your network through efficient use of automation, essentially allowing the software to operate on its own and decide whether to launch the next season of _Black Mirror_ on Netflix or to quarantine an upcoming threat.
|
||||
|
||||
#### Isolation
|
||||
|
||||
Any event is essentially a trigger that launches the next application in the architecture. A user inputs his login, and the system validates its correctness, requests confirmation from the database, and tests the input for the presence of code.
|
||||
|
||||
So far, so good. Not much has changed, right?
|
||||
|
||||
Here’s the thing—every process and every app run autonomously like separate events, each triggering their own chains. None of the apps know if other apps have been triggered and whether they are running any processes or not.
|
||||
|
||||
Think of them as separate, autonomous clusters. If one is compromised, it will not affect the entirety of the system, as it simply doesn’t know if anything else exists. That said, a malfunction in one of the clusters will trigger an alert, thus preventing the incident.
|
||||
|
||||
#### An added bonus
|
||||
|
||||
Isolated apps are not dependent on one another, meaning you’ll be able to plug in as many of them as you need without any of them risking or affecting the rest of the system.
|
||||
|
||||
Call it scalability out of the box, if you will.
|
||||
|
||||
### Pros of the event-driven approach
|
||||
|
||||
We’ve already discussed most of the pros of the event-driven approach. Let’s summarize them here in the form of short bullet points.
|
||||
|
||||
* **Encapsulation:** Every process has a set of clear, easily executed boundaries.
|
||||
* **Decoupling:** The processes are independent and unaware of one another.
|
||||
* **Scalability:** It’s easy to add new functionality, apps, and processes.
|
||||
* **Data generation:** Event strings generate predictable data patterns you can easily analyze.
|
||||
|
||||
|
||||
|
||||
### Cons of the event-driven approach
|
||||
|
||||
Sadly, despite an impressive array of benefits to the business, event-driven architecture and security are not silver bullets. The approach has its flaws.
|
||||
|
||||
For starters, developing any architecture with an insane level of scalability is hard, expensive, and time-consuming.
|
||||
|
||||
Event-driven security is far from being a truly impenetrable wall. Hackers evolve and adapt rather quickly. They’ll likely find a breach in any system if they put their mind to it, whether through coding or through phishing.
|
||||
|
||||
Luckily, you don’t have to build a Fort Knox. All you need is a solid system that’s hard enough to crack for the hacker to give up and move to an easier target. The event-driven approach to network security does just that.
|
||||
|
||||
Moreover, it minimizes your losses if an incident actually happens, so you have that going for you, which is nice.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/10/event-driven-security
|
||||
|
||||
作者:[Yuriy Andamasov][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/yuriy-andamasov
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_UnspokenBlockers_1110_A.png?itok=x8A9mqVA (Three closed doors)
|
||||
[2]: https://www.techrepublic.com/article/forrester-what-can-we-learn-from-a-disastrous-year-of-hacks-and-breaches/
|
||||
[3]: https://www.cybintsolutions.com/industries-likely-to-get-hacked/
|
||||
[4]: https://www.cybintsolutions.com/cyber-security-facts-stats/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -0,0 +1,163 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server)
|
||||
[#]: via: (https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/)
|
||||
[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/)
|
||||
|
||||
How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server
|
||||
======
|
||||
|
||||
**EPEL** Stands for Extra Packages for Enterprise Linux, it is a free and opensource additional packages repository available for **CentOS** and **RHEL** servers. As the name suggests, EPEL repository provides extra and additional packages which are not available in the default package repositories of [CentOS 8][1] and [RHEL 8][2].
|
||||
|
||||
In this article we will demonstrate how to enable and use epel repository on CentOS 8 and RHEL 8 Server.
|
||||
|
||||
[![EPEL-Repo-CentOS8-RHEL8][3]][4]
|
||||
|
||||
### Prerequisites of EPEL Repository
|
||||
|
||||
* Minimal CentOS 8 and RHEL 8 Server
|
||||
* Root or sudo admin privileges
|
||||
* Internet Connection
|
||||
|
||||
|
||||
|
||||
### Install and Enable EPEL Repository on RHEL 8.x Server
|
||||
|
||||
Login or ssh to your RHEL 8.x server and execute the following dnf command to install EPEL rpm package,
|
||||
|
||||
```
|
||||
[root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
|
||||
```
|
||||
|
||||
Output of above command would be something like below,
|
||||
|
||||
![dnf-install-epel-repo-rehl8][3]
|
||||
|
||||
Once epel rpm package is installed successfully then it will automatically enable and configure its yum / dnf repository. Run following dnf or yum command to verify whether EPEL repository is enabled or not,
|
||||
|
||||
```
|
||||
[root@linuxtechi ~]# dnf repolist epel
|
||||
Or
|
||||
[root@linuxtechi ~]# dnf repolist epel -v
|
||||
```
|
||||
|
||||
![epel-repolist-rhel8][3]
|
||||
|
||||
### Install and Enable EPEL Repository on CentOS 8.x Server
|
||||
|
||||
Login or ssh to your CentOS 8 server and execute following dnf or yum command to install ‘**epel-release**‘ rpm package. In CentOS 8 server, epel rpm package is available in its default package repository.
|
||||
|
||||
```
|
||||
[root@linuxtechi ~]# dnf install epel-release -y
|
||||
Or
|
||||
[root@linuxtechi ~]# yum install epel-release -y
|
||||
```
|
||||
|
||||
Execute the following commands to verify the status of epel repository on CentOS 8 server,
|
||||
|
||||
```
|
||||
[root@linuxtechi ~]# dnf repolist epel
|
||||
Last metadata expiration check: 0:00:03 ago on Sun 13 Oct 2019 04:18:05 AM BST.
|
||||
repo id repo name status
|
||||
*epel Extra Packages for Enterprise Linux 8 - x86_64 1,977
|
||||
[root@linuxtechi ~]#
|
||||
[root@linuxtechi ~]# dnf repolist epel -v
|
||||
……………………
|
||||
Repo-id : epel
|
||||
Repo-name : Extra Packages for Enterprise Linux 8 - x86_64
|
||||
Repo-status : enabled
|
||||
Repo-revision: 1570844166
|
||||
Repo-updated : Sat 12 Oct 2019 02:36:32 AM BST
|
||||
Repo-pkgs : 1,977
|
||||
Repo-size : 2.1 G
|
||||
Repo-metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=stock&content=centos
|
||||
Updated : Sun 13 Oct 2019 04:28:24 AM BST
|
||||
Repo-baseurl : rsync://repos.del.extreme-ix.org/epel/8/Everything/x86_64/ (34 more)
|
||||
Repo-expire : 172,800 second(s) (last: Sun 13 Oct 2019 04:28:24 AM BST)
|
||||
Repo-filename: /etc/yum.repos.d/epel.repo
|
||||
Total packages: 1,977
|
||||
[root@linuxtechi ~]#
|
||||
```
|
||||
|
||||
Above command’s output confirms that we have successfully enabled epel repo. Let’s perform some basic operations on EPEL repo.
|
||||
|
||||
### List all available packages from epel repository
|
||||
|
||||
If you want to list all the packages from epel repository then run the following dnf command,
|
||||
|
||||
```
|
||||
[root@linuxtechi ~]# dnf repository-packages epel list
|
||||
……………
|
||||
Last metadata expiration check: 0:38:18 ago on Sun 13 Oct 2019 04:28:24 AM BST.
|
||||
Installed Packages
|
||||
epel-release.noarch 8-6.el8 @epel
|
||||
Available Packages
|
||||
BackupPC.x86_64 4.3.1-2.el8 epel
|
||||
BackupPC-XS.x86_64 0.59-3.el8 epel
|
||||
CGSI-gSOAP.x86_64 1.3.11-7.el8 epel
|
||||
CGSI-gSOAP-devel.x86_64 1.3.11-7.el8 epel
|
||||
Field3D.x86_64 1.7.2-16.el8 epel
|
||||
Field3D-devel.x86_64 1.7.2-16.el8 epel
|
||||
GraphicsMagick.x86_64 1.3.33-1.el8 epel
|
||||
GraphicsMagick-c++.x86_64 1.3.33-1.el8 epel
|
||||
…………………………
|
||||
zabbix40-web-mysql.noarch 4.0.12-1.el8 epel
|
||||
zabbix40-web-pgsql.noarch 4.0.12-1.el8 epel
|
||||
zerofree.x86_64 1.1.1-3.el8 epel
|
||||
zimg.x86_64 2.8-4.el8 epel
|
||||
zimg-devel.x86_64 2.8-4.el8 epel
|
||||
zstd.x86_64 1.4.2-1.el8 epel
|
||||
zvbi.x86_64 0.2.35-9.el8 epel
|
||||
zvbi-devel.x86_64 0.2.35-9.el8 epel
|
||||
zvbi-fonts.noarch 0.2.35-9.el8 epel
|
||||
[root@linuxtechi ~]#
|
||||
```
|
||||
|
||||
### Search a package from epel repository
|
||||
|
||||
Let’s assume if we want to search Zabbix package in epel repository, execute the following dnf command,
|
||||
|
||||
```
|
||||
[root@linuxtechi ~]# dnf repository-packages epel list | grep -i zabbix
|
||||
```
|
||||
|
||||
Output of above command would be something like below,
|
||||
|
||||
![epel-repo-search-package-centos8][3]
|
||||
|
||||
### Install a package from epel repository
|
||||
|
||||
Let’s assume we want to install htop package from epel repo, then issue the following dnf command,
|
||||
|
||||
Syntax:
|
||||
|
||||
# dnf –enablerepo=”epel” install <pkg_name>
|
||||
|
||||
```
|
||||
[root@linuxtechi ~]# dnf --enablerepo="epel" install htop -y
|
||||
```
|
||||
|
||||
**Note:** If we don’t specify the “**–enablerepo=epel**” in above command then it will look for htop package in all available package repositories.
|
||||
|
||||
That’s all from this article, I hope above steps helps you to enable and configure EPEL repository on CentOS 8 and RHEL 8 Server, please don’t hesitate to share your comments and feedback in below comments section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/
|
||||
|
||||
作者:[Pradeep Kumar][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://www.linuxtechi.com/author/pradeep/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.linuxtechi.com/centos-8-installation-guide-screenshots/
|
||||
[2]: https://www.linuxtechi.com/install-configure-kvm-on-rhel-8/
|
||||
[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2019/10/EPEL-Repo-CentOS8-RHEL8.jpg
|
@ -0,0 +1,188 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to make a Halloween lantern with Inkscape)
|
||||
[#]: via: (https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape)
|
||||
[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake)
|
||||
|
||||
How to make a Halloween lantern with Inkscape
|
||||
======
|
||||
Use open source tools to make a spooky and fun decoration for your
|
||||
favorite Halloween haunt.
|
||||
![Halloween - backlit bat flying][1]
|
||||
|
||||
The spooky season is almost here! This year, decorate your haunt with a unique Halloween lantern made with open source!
|
||||
|
||||
Typically, a portion of a lantern's structure is opaque to block the light from within. What makes a lantern a lantern are the parts that are missing: windows cut from the structure so that light can escape. While it's impractical for lighting, a lantern with windows in spooky shapes and lurking silhouettes can be atmospheric and a lot of fun to create.
|
||||
|
||||
This article demonstrates how to create your own lantern using [Inkscape][2]. If you don't have Inkscape, you can install it from your software repository on Linux or download it from the [Inkscape website][3] on MacOS and Windows.
|
||||
|
||||
### Supplies
|
||||
|
||||
* Template ([A4][4] or [Letter][5] size)
|
||||
* Cardstock (black is traditional)
|
||||
* Tracing paper (optional)
|
||||
* Craft knife, ruler, and cutting mat (a craft cutting machine/laser cutter can be used instead)
|
||||
* Craft glue
|
||||
* LED tea-light "candle"
|
||||
_Safety note:_ Only use battery-operated candles for this project.
|
||||
|
||||
|
||||
|
||||
### Understanding the template
|
||||
|
||||
To begin, download the correct template for your region (A4 or Letter) from the links above and open it in Inkscape.
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
**![Lantern template screen][6]**
|
||||
|
||||
The gray-and-white checkerboard background is see-through (in technical terms, it's an _alpha channel_.)
|
||||
|
||||
The black base forms the lantern. Right now, there are no windows for light to shine through; the lantern is a solid black base. You will use the **Union** and **Difference** options in Inkscape to design the windows digitally.
|
||||
|
||||
The dotted blue lines represent fold scorelines. The solid orange lines represent guides. Windows for light should not be placed outside the orange boxes.
|
||||
|
||||
To the left of the template are a few pre-made objects you can use in your design.
|
||||
|
||||
### To create a window or shape
|
||||
|
||||
1. Create an object that looks like the window style you want. Objects can be created using any of the shape tools in Inkscape's left toolbar. Alternately, you can download Creative Commons- or Public Domain-licensed clipart and import the PNG file into your project.
|
||||
2. When you are happy with the shape of the object, turn it into a **Path** (rather than a **Shape**, which Inkscape sees as two different kinds of objects) by selecting **Object > Object to Path** in the top menu.
|
||||
|
||||
|
||||
|
||||
![Object to path menu][7]
|
||||
|
||||
3. Place the object on top of the base shape.
|
||||
4. Select both the object and the black base by clicking one, pressing and holding the Shift key, then selecting the other.
|
||||
5. Select **Object > Difference** from the top menu to remove the shape of the object from the base. This creates what will become a window in your lantern.
|
||||
|
||||
|
||||
|
||||
![Object > Difference menu][8]
|
||||
|
||||
### To add an object to a window
|
||||
|
||||
After making a window, you can add objects to it to create a scene.
|
||||
|
||||
**Tips:**
|
||||
|
||||
* All objects, including text, must be connected to the base of the lantern. If not, they will fall out after cutting and leave a blank space.
|
||||
* Avoid small, intricate details. These are difficult to cut, even when using a machine like a laser cutter or a craft plotter.
|
||||
|
||||
|
||||
1. Create or import an object.
|
||||
2. Place the object inside the window so that it is touching at least two sides of the base.
|
||||
3. With the object selected, choose **Object > Object to Path** from the top menu.
|
||||
|
||||
|
||||
|
||||
![Object to path menu][9]
|
||||
|
||||
4. Select the object and the black base by clicking on each one while holding the Shift key).
|
||||
5. Select **Object > Union** to join the object and the base.
|
||||
|
||||
|
||||
|
||||
### Add text
|
||||
|
||||
Text can either be cut out from the base to create a window (as I did with the stars) or added to a window (which blocks the light from within the lantern). If you're creating a window, only follow steps 1 and 2 below, then use **Difference** to remove the text from the base layer.
|
||||
|
||||
1. Select the Text tool from the left sidebar to create text. Thick, bold fonts work best.
|
||||
|
||||
![Text tool][10]
|
||||
|
||||
2. Select your text, then choose **Path > Object to Path** from the top menu. This converts the text object to a path. Note that this step means you can no longer edit the text, so perform this step _only after_ you're sure you have the word or words you want.
|
||||
|
||||
3. After you have converted the text, you can press **F2** on your keyboard to activate the **Node Editor** tool to clearly show the nodes of the text when it is selected with this tool.
|
||||
|
||||
|
||||
|
||||
|
||||
![Text selected with Node editor][11]
|
||||
|
||||
4. Ungroup the text.
|
||||
5. Adjust each letter so that it slightly overlaps its neighboring letter or the base.
|
||||
|
||||
|
||||
|
||||
![Overlapping the text][12]
|
||||
|
||||
6. To connect all of the letters to one another and to the base, re-select all the text and the base, then select **Path > Union**.
|
||||
|
||||
![Connecting letters and base with Path > Union][13]
|
||||
|
||||
|
||||
|
||||
|
||||
### Prepare for printing
|
||||
|
||||
The following instructions are for hand-cutting your lantern. If you're using a laser cutter or craft plotter, follow the techniques required by your hardware to prepare your files.
|
||||
|
||||
1. In the **Layer** panel, click the **Eye** icon beside the **Safety** layer to hide the safety lines. If you don't see the Layer panel, reveal it by selecting **Layer > Layers** from the top menu.
|
||||
2. Select the black base. In the **Fill and Stroke** panel, set the fill to **X** (meaning _no fill_) and the **Stroke** to solid black (that's #000000ff to fans of hexes).
|
||||
|
||||
|
||||
|
||||
![Setting fill and stroke][14]
|
||||
|
||||
3. Print your pattern with **File > Print**.
|
||||
|
||||
4. Using a craft knife and ruler, carefully cut around each black line. Lightly score the dotted blue lines, then fold.
|
||||
|
||||
![Cutting out the lantern][15]
|
||||
|
||||
5. To finish off the windows, cut tracing paper to the size of each window and glue it to the inside of the lantern.
|
||||
|
||||
![Adding tracing paper][16]
|
||||
|
||||
6. Glue the lantern together at the tabs.
|
||||
|
||||
7. Turn on a battery-powered LED candle and place it inside your lantern.
|
||||
|
||||
|
||||
|
||||
|
||||
![Completed lantern][17]
|
||||
|
||||
Now your lantern is complete and ready to light up your haunt. Happy Halloween!
|
||||
|
||||
How to make Halloween bottle labels with Inkscape, GIMP, and items around the house.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape
|
||||
|
||||
作者:[Jess Weichler][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/cyanide-cupcake
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/halloween_bag_bat_diy.jpg?itok=24M0lX25 (Halloween - backlit bat flying)
|
||||
[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners
|
||||
[3]: http://inkscape.org
|
||||
[4]: https://www.dropbox.com/s/75qzjilg5ak2oj1/papercraft_lantern_A4_template.svg?dl=0
|
||||
[5]: https://www.dropbox.com/s/8fswdge49jwx91n/papercraft_lantern_letter_template%20.svg?dl=0
|
||||
[6]: https://opensource.com/sites/default/files/uploads/lanterntemplate_screen.png (Lantern template screen)
|
||||
[7]: https://opensource.com/sites/default/files/uploads/lantern1.png (Object to path menu)
|
||||
[8]: https://opensource.com/sites/default/files/uploads/lantern2.png (Object > Difference menu)
|
||||
[9]: https://opensource.com/sites/default/files/uploads/lantern3.png (Object to path menu)
|
||||
[10]: https://opensource.com/sites/default/files/uploads/lantern4.png (Text tool)
|
||||
[11]: https://opensource.com/sites/default/files/uploads/lantern5.png (Text selected with Node editor)
|
||||
[12]: https://opensource.com/sites/default/files/uploads/lantern6.png (Overlapping the text)
|
||||
[13]: https://opensource.com/sites/default/files/uploads/lantern7.png (Connecting letters and base with Path > Union)
|
||||
[14]: https://opensource.com/sites/default/files/uploads/lantern8.png (Setting fill and stroke)
|
||||
[15]: https://opensource.com/sites/default/files/uploads/lantern9.jpg (Cutting out the lantern)
|
||||
[16]: https://opensource.com/sites/default/files/uploads/lantern10.jpg (Adding tracing paper)
|
||||
[17]: https://opensource.com/sites/default/files/uploads/lantern11.jpg (Completed lantern)
|
@ -0,0 +1,48 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (My Linux story: I grew up on PC Magazine not candy)
|
||||
[#]: via: (https://opensource.com/article/19/10/linux-journey-newb-ninja)
|
||||
[#]: author: (Michael Zamot https://opensource.com/users/mzamot)
|
||||
|
||||
My Linux story: I grew up on PC Magazine not candy
|
||||
======
|
||||
This Linux story begins with a kid reading about Linux in issues of PC
|
||||
Magazine from his childhood home in Costa Rica. Today, he's a passionate
|
||||
member of the global Linux community.
|
||||
![The back of a kid head][1]
|
||||
|
||||
In 1998, the movie _Titanic_ was released, mobile phones were just a luxury, and pagers were still in use. This was also the year I got my first computer. I can remember the details as if it were yesterday: Pentium 133MHz and just 16MB of memory. Back in that time (while running nothing less than Windows 95), this was a good machine. I can still hear in my mind the old spinning hard drive noise when I powered that computer on, and see the Windows 95 flag. It never crossed my mind, though (especially as an 8-year-old kid), that I would dedicate every minute of my life to Linux and open source.
|
||||
|
||||
Being just a kid, I always asked my mom to buy me every issue of PC Magazine instead of candies. I never skipped a single issue, and all of those dusty old magazines are still there in Costa Rica. It was in these magazines that I discovered the essential technology that changed my life. An issue in the year 2000 talked extensively about Linux and the advantages of free and open-source software. That issue also included a review of one of the most popular Linux distributions back then: Corel Linux. Unfortunately, the disc was not included. Without internet at home, I was out of luck, but that issue still lit a spark within me.
|
||||
|
||||
In 2003, I asked my mom to take me to a Richard Stallman talk. I couldn’t believe he was in the country. I was the only kid in that room, and I was laser-focused on everything he was saying, though I didn’t understand anything about patents, licenses, or the jokes about him with an old hard drive over his head.
|
||||
|
||||
Despite my attempts, I couldn’t make Linux work on my computer. One rainy afternoon in the year 2003, with the heavy smell of recently brewed coffee, my best friend and I were able to get a local magazine with a two-disk bundle: Mandrake Linux 7.1 (if my memory doesn’t fail) on one and StarOffice on the other. My friend poured more coffee into our mugs while I inserted the Mandrake disk into the computer with my shaking, excited hands. Linux was finally running—the same Linux I had been obsessed with since I read about it 3 years earlier.
|
||||
|
||||
We were lucky enough to get broadband internet in 2006 (at the lightning speed of 128/64Kbps), so I was able to use an old Pentium II computer under my bed and run it 24x7 with Debian, Apache, and my own mail server (my personal server, I told myself). This old machine was my playground to experiment on and put into practice all of the knowledge and reading I had been doing (and also to make the electricity bill more expensive).
|
||||
|
||||
As soon as I discovered there were open source communities in the country, I started attending their meetings. Eventually, I was helping in their events, and not long after I was organizing and giving talks. We used to host two annual events for many years: Festival Latinoamericano de Software Libre (Latin American Free Software Installation Fest) and Software Freedom Day.
|
||||
|
||||
Thanks to what I learned from my reading, but more importantly from the people in these local communities that guided and mentored me, I was able to land my first Linux job in 2011, even without college. I kept growing from there, working for many companies and learning more about open source and Linux at each one. Eventually, I felt that I had an obligation (or a social debt) to give back to the community so that other people like the younger me could also learn. Not long after, I started teaching classes and meeting wonderful and passionate people, many of whom are now as devoted to Linux and open source as I am. I can definitely say: Mission accomplished!
|
||||
|
||||
Eventually, what I learned about open source, Linux, OpenStack, Docker, and every other technology I played with sent me overseas, allowing me to work (doesn’t feel like it) for the most amazing company I’ve ever worked for, doing what I love. Because of open source and Linux, I became a part of something bigger than me. I was a member of a community, and I experienced what I consider the most significant impact on my life: Meeting and learning from so many masterminds and amazing people that today I can call friends. Without them and these communities, I wouldn’t be the person I am today.
|
||||
|
||||
How could I know when I was 10 years old and reading a magazine that Linux and open source would connect me to the greatest people, and change my life forever?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/10/linux-journey-newb-ninja
|
||||
|
||||
作者:[Michael Zamot][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/mzamot
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_kid_education.png?itok=3lRp6gFa (The back of a kid head)
|
@ -0,0 +1,81 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Use sshuttle to build a poor man’s VPN)
|
||||
[#]: via: (https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/)
|
||||
[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/)
|
||||
|
||||
Use sshuttle to build a poor man’s VPN
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Nowadays, business networks often use a VPN (virtual private network) for [secure communications with workers][2]. However, the protocols used can sometimes make performance slow. If you can reach reach a host on the remote network with SSH, you could set up port forwarding. But this can be painful, especially if you need to work with many hosts on that network. Enter **sshuttle** — which lets you set up a quick and dirty VPN with just SSH access. Read on for more information on how to use it.
|
||||
|
||||
The sshuttle application was designed for exactly the kind of scenario described above. The only requirement on the remote side is that the host must have Python available. This is because sshuttle constructs and runs some Python source code to help transmit data.
|
||||
|
||||
### Installing sshuttle
|
||||
|
||||
The sshuttle application is packaged in the official repositories, so it’s easy to install. Open a terminal and use the following command [with sudo][3]:
|
||||
|
||||
```
|
||||
$ sudo dnf install sshuttle
|
||||
```
|
||||
|
||||
Once installed, you may find the manual page interesting:
|
||||
|
||||
```
|
||||
$ man sshuttle
|
||||
```
|
||||
|
||||
### Setting up the VPN
|
||||
|
||||
The simplest case is just to forward all traffic to the remote network. This isn’t necessarily a crazy idea, especially if you’re not on a trusted local network like your own home. Use the _-r_ switch with the SSH username and the remote host name:
|
||||
|
||||
```
|
||||
$ sshuttle -r username@remotehost 0.0.0.0/0
|
||||
```
|
||||
|
||||
However, you may want to restrict the VPN to specific subnets rather than all network traffic. (A complete discussion of subnets is outside the scope of this article, but you can read more [here on Wikipedia][4].) Let’s say your office internally uses the reserved Class A subnet 10.0.0.0 and the reserved Class B subnet 172.16.0.0. The command above becomes:
|
||||
|
||||
```
|
||||
$ sshuttle -r username@remotehost 10.0.0.0/8 172.16.0.0/16
|
||||
```
|
||||
|
||||
This works great for working with hosts on the remote network by IP address. But what if your office is a large network with lots of hosts? Names are probably much more convenient — maybe even required. Never fear, sshuttle can also forward DNS queries to the office with the _–dns_ switch:
|
||||
|
||||
```
|
||||
$ sshuttle --dns -r username@remotehost 10.0.0.0/8 172.16.0.0/16
|
||||
```
|
||||
|
||||
To run sshuttle like a daemon, add the _-D_ switch. This also will send log information to the systemd journal via its syslog compatibility.
|
||||
|
||||
Depending on the capabilities of your system and the remote system, you can use sshuttle for an IPv6 based VPN. You can also set up configuration files and integrate it with your system startup if desired. If you want to read even more about sshuttle and how it works, [check out the official documentation][5]. For a look at the code, [head over to the GitHub page][6].
|
||||
|
||||
* * *
|
||||
|
||||
_Photo by _[_Kurt Cotoaga_][7]_ on _[_Unsplash_][8]_._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/
|
||||
|
||||
作者:[Paul W. Frields][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://fedoramagazine.org/author/pfrields/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/sshuttle-816x345.jpg
|
||||
[2]: https://en.wikipedia.org/wiki/Virtual_private_network
|
||||
[3]: https://fedoramagazine.org/howto-use-sudo/
|
||||
[4]: https://en.wikipedia.org/wiki/Subnetwork
|
||||
[5]: https://sshuttle.readthedocs.io/en/stable/index.html
|
||||
[6]: https://github.com/sshuttle/sshuttle
|
||||
[7]: https://unsplash.com/@kydroon?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[8]: https://unsplash.com/s/photos/shuttle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
@ -0,0 +1,167 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool)
|
||||
[#]: via: (https://itsfoss.com/gnome-tweak-tool/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool
|
||||
======
|
||||
|
||||
![GNOME Tweak Tool Icon][1]
|
||||
|
||||
There are several ways you can tweak Ubuntu to customize its looks and behavior. The easiest way I find is by using the [GNOME Tweak tool][2]. It is also known as GNOME Tweaks or simply Tweaks.
|
||||
|
||||
I have mentioned it numerous time in my tutorials in the past. Here, I list all the major tweaks you can perform with this tool.
|
||||
|
||||
I have used Ubuntu here but the steps should be applicable to any Linux distribution using GNOME desktop environment.
|
||||
|
||||
### Install GNOME Tweak tool in Ubuntu 18.04 and other versions
|
||||
|
||||
Gnome Tweak tool is available in the [Universe repository in Ubuntu][3] so make sure that you have it enabled in your Software & Updates tool:
|
||||
|
||||
![Enable Universe Repository in Ubuntu][4]
|
||||
|
||||
After that, you can install GNOME Tweak tool from the software center. Just open the Software Center and search for GNOME Tweaks and install it from there:
|
||||
|
||||
![Install GNOME Tweaks Tool from Software Center][5]
|
||||
|
||||
Alternatively, you may also use command line to install software with [apt command][6]:
|
||||
|
||||
```
|
||||
sudo apt install gnome-tweaks
|
||||
```
|
||||
|
||||
### Customizing GNOME desktop with Tweaks tool
|
||||
|
||||
![][7]
|
||||
|
||||
GNOME Tweak tool enables you to do a number of settings changes. Some of these changes like wallpaper changes, startup applications etc are also available in the official System Settings tool. I am going to focus on tweaks that are not available in the Settings by default.
|
||||
|
||||
#### 1\. Change themes
|
||||
|
||||
You can [install new themes in Ubuntu][8] in various ways. But if you want to change to the newly installed theme, you’ll have to install GNOME Tweaks tool.
|
||||
|
||||
You can find the theme and icon settings in Appearance section. You can browse through the available themes and icons and set the ones you like. The changes take into effect immediately.
|
||||
|
||||
![Change Themes With GNOME Tweaks][9]
|
||||
|
||||
#### 2\. Disable animation to speed up your desktop
|
||||
|
||||
There are subtle animations for application window opening, closing, maximizing etc. You can disable these animations to speed up your system slightly as it will use slightly fewer resources.
|
||||
|
||||
![Disable Animations For Slightly Faster Desktop Experience][10]
|
||||
|
||||
#### 3\. Control desktop icons
|
||||
|
||||
At least in Ubuntu, you’ll see the Home and Trash icons on the desktop. If you don’t like, you can choose to disable it. You can also choose which icons will be displayed on the desktop.
|
||||
|
||||
![Control Desktop Icons in Ubuntu][11]
|
||||
|
||||
#### 4\. Manage GNOME extensions
|
||||
|
||||
I hope you are aware of [GNOME Extensions][12]. These are small ‘plugins’ for your desktop that extends the functionalities of the GNOME desktop. There are [plenty of GNOME extensions][13] that you can use to get CPU consumption in the top panel, get clipboard history etc.
|
||||
|
||||
I have written in detail about [installing and using GNOME extensions][14]. Here, I assume that you are already using them and if that’s the case, you can manage them from within GNOME Tweaks.
|
||||
|
||||
![Manage GNOME Extensions][15]
|
||||
|
||||
#### 5\. Change fonts and scaling factor
|
||||
|
||||
You can [install new fonts in Ubuntu][16] and apply the system wide font change using Tweaks tool. You can also change the scaling factor if you think the icons, text are way too small on your desktop.
|
||||
|
||||
![Change Fonts and Scaling Factor][17]
|
||||
|
||||
#### 6\. Control touchpad behavior like Disable touchpad while typing, Make right click on touchpad working
|
||||
|
||||
The GNOME Tweaks also allows you to disable touchpad while typing. This is useful if you type fast on a laptop. The bottom of your palm may touch the touchpad and the cursor moves away to an undesired location on the screen.
|
||||
|
||||
Automatically disabling touchpad while typing fixes this problem.
|
||||
|
||||
![Disable Touchpad While Typing][18]
|
||||
|
||||
You’ll also notice that [when you press the bottom right corner of your touchpad for right click, nothing happens][19]. There is nothing wrong with your touchpad. It’s a system settings that disables the right clicking this way for any touchpad that doesn’t have a real right click button (like the old Thinkpad laptops). Two finger click gives you the right click.
|
||||
|
||||
You can also get this back by choosing Area in under Mouse Click Simulation instead of Fingers.
|
||||
|
||||
![Fix Right Click Issue][20]
|
||||
|
||||
You may have to [restart Ubuntu][21] in order to take the changes in effect. If you are Emacs lover, you can also force keybindings from Emacs.
|
||||
|
||||
#### 7\. Change power settings
|
||||
|
||||
There is only one power settings here. It allows you to put your laptop in suspend mode when the lid is closed.
|
||||
|
||||
![Power Settings in GNOME Tweaks Tool][22]
|
||||
|
||||
#### 8\. Decide what’s displayed in the top panel
|
||||
|
||||
The top panel in your desktop gives shows a few important things. You have the calendar, network icon, system settings and the Activities option.
|
||||
|
||||
You can also [display battery percentage][23], add date along with day and time and show week numbers. You can also enable hot corners so that if you take your mouse to the top left corner of the screen, you’ll get the activities view with all the running applications.
|
||||
|
||||
![Top Panel Settings in GNOME Tweaks Tool][24]
|
||||
|
||||
If you have the mouse focus on an application window, you’ll notice that it’s menu is displayed in the top panel. If you don’t like it, you may toggle it off and then the application menu will be available on the application itself.
|
||||
|
||||
#### 9\. Configure application window
|
||||
|
||||
You can decide if maximize and minimize option (the buttons on the top right corner) will be shown in the application window. You may also change their positioning between left and right.
|
||||
|
||||
![Application Window Configuration][25]
|
||||
|
||||
There are some other configuration options as well. I don’t use them but feel free to explore them on your own.
|
||||
|
||||
#### 10\. Configure workspaces
|
||||
|
||||
GNOME Tweaks tool also allows you to configure a couple of things around workspaces.
|
||||
|
||||
![Configure Workspaces in Ubuntu][26]
|
||||
|
||||
**In the end…**
|
||||
|
||||
GNOME Tweaks tool is a must have utility for any GNOME user. It helps you configure looks and functionality of the desktop. I find it surprising that this tool is not even in Main repository of Ubuntu. In my opinion, it should be installed by default. Till then, you’ll have to install GNOME Tweak tool in Ubuntu manually.
|
||||
|
||||
If you find some hidden gem in GNOME Tweaks that hasn’t been discussed here, why not share it with the rest of us?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/gnome-tweak-tool/
|
||||
|
||||
作者:[Abhishek Prakash][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/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/gnome-tweak-tool-icon.png?ssl=1
|
||||
[2]: https://wiki.gnome.org/action/show/Apps/Tweaks?action=show&redirect=Apps%2FGnomeTweakTool
|
||||
[3]: https://itsfoss.com/ubuntu-repositories/
|
||||
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/enable-repositories-ubuntu.png?ssl=1
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/install-gnome-tweaks-tool.jpg?ssl=1
|
||||
[6]: https://itsfoss.com/apt-command-guide/
|
||||
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/customize-gnome-with-tweak-tool.jpg?ssl=1
|
||||
[8]: https://itsfoss.com/install-themes-ubuntu/
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/change-theme-ubuntu-gnome.jpg?ssl=1
|
||||
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/disable-animation-ubuntu-gnome.jpg?ssl=1
|
||||
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/desktop-icons-ubuntu.jpg?ssl=1
|
||||
[12]: https://extensions.gnome.org/
|
||||
[13]: https://itsfoss.com/best-gnome-extensions/
|
||||
[14]: https://itsfoss.com/gnome-shell-extensions/
|
||||
[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/manage-gnome-extension-tweaks-tool.jpg?ssl=1
|
||||
[16]: https://itsfoss.com/install-fonts-ubuntu/
|
||||
[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/change-fonts-ubuntu-gnome.jpg?ssl=1
|
||||
[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/disable-touchpad-while-typing-ubuntu.jpg?ssl=1
|
||||
[19]: https://itsfoss.com/fix-right-click-touchpad-ubuntu/
|
||||
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/enable-right-click-ubuntu.jpg?ssl=1
|
||||
[21]: https://itsfoss.com/schedule-shutdown-ubuntu/
|
||||
[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/power-settings-gnome-tweaks-tool.jpg?ssl=1
|
||||
[23]: https://itsfoss.com/display-battery-ubuntu/
|
||||
[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/top-panel-settings-gnome-tweaks-tool.jpg?ssl=1
|
||||
[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/windows-configuration-ubuntu-gnome-tweaks.jpg?ssl=1
|
||||
[26]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/configure-workspaces-ubuntu.jpg?ssl=1
|
@ -0,0 +1,144 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 Free and Open Source Alternatives to Adobe Photoshop)
|
||||
[#]: via: (https://itsfoss.com/open-source-photoshop-alternatives/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
4 Free and Open Source Alternatives to Adobe Photoshop
|
||||
======
|
||||
|
||||
_**Looking for a free Photoshop alternative? Here are some of the best free and open source software that you can use instead of Adobe Photoshop.**_
|
||||
|
||||
Adobe Photoshop is a premium image editing and design tool available for Windows and macOS. Undoubtedly, almost everyone knows about it. It’s that popular. Well, you can use Photoshop on Linux using Windows in a virtual machine or by [using Wine][1] – but that is not an ideal experience.
|
||||
|
||||
In general, we don’t have a lot of options available as a replacement for Adobe Photoshop. However, in this article, we shall mention some of the best open-source Photoshop alternatives available for Linux (with cross-platform support as well).
|
||||
|
||||
Do note that Photoshop is not just a photo editor. It’s used by photographers, digital artists, professional editors for various usage. The alternative software here may not have all the features of Photoshop but you can use them for various task that you do in Photoshop.
|
||||
|
||||
### Open Source Alternatives to Adobe Photoshop for Linux, Windows and macOS
|
||||
|
||||
![][2]
|
||||
|
||||
Initially, I thought of focusing only on Photoshop alternatives for Linux but why confine this list for Linux only? Other operating system users should also use the open source software.
|
||||
|
||||
_**If you are using Linux, all the mentioned software should be available in the repositories of your distribution. You can install it using the software center or the package manager.**_
|
||||
|
||||
For other platforms, please check the official project websites to get the installer files.
|
||||
|
||||
_The list is in no particular order of ranking_.
|
||||
|
||||
#### 1\. GIMP: The true Photoshop alternative
|
||||
|
||||
![][3]
|
||||
|
||||
Key Features:
|
||||
|
||||
* Customizable Interface
|
||||
* Digital Retouching
|
||||
* Photo Enhancement (using transform tools)
|
||||
* Wide range of hardware support (pressure-sensitive tablets, MIDIs, etc.)
|
||||
* Almost every major image file supported
|
||||
* Layer management support
|
||||
|
||||
|
||||
|
||||
**Platforms available for:** Linux, Windows and macOS
|
||||
|
||||
[GIMP][4] is my go-to tool for everything – no matter how basic/advanced the task is. Probably, this is the closest that you will get as a replacement for Photoshop on Linux. In addition to this, it is an open source and free solution for an artist looking to create great artwork on Linux.
|
||||
|
||||
It features all the necessary features for any kind of image manipulation. Of course, there’s layer management support. Depending on your experience level – the utilization will differ. So, if you are looking to make the most out of it, you should read the [documentation][5] and follow the [official tutorials][6].
|
||||
|
||||
#### 2\. Krita
|
||||
|
||||
![][7]
|
||||
|
||||
Key Features:
|
||||
|
||||
* Layer management support
|
||||
* Transformation tools
|
||||
* Variety of brushes/drawing tools
|
||||
|
||||
|
||||
|
||||
**Platforms available for:** Linux, Windows and macOS
|
||||
|
||||
[Krita][8] is an impressive open source tool for digital painting. The layer management support and the presence of transformation tools help makes it one of the Photoshop alternatives for basic editing tasks.
|
||||
|
||||
If you’re into sketching/drawing, this will help you a lot.
|
||||
|
||||
#### 3\. Darktable
|
||||
|
||||
![][9]
|
||||
|
||||
Key Features:
|
||||
|
||||
* Develop RAW images
|
||||
* Variety of Image formats supported
|
||||
* Several Image operation modules with blending operators
|
||||
|
||||
|
||||
|
||||
**Platforms available for**: Linux, Windows and macOS
|
||||
|
||||
[Darktable][10] is an open source photography workflow application made by photographers. It lets you manage your digital negatives in a database. From your collection, develop raw images and enhance them using the tools available.
|
||||
|
||||
Starting from the basic image editing tools to several image modules supporting blending operators, you will find a lot of things as you explore.
|
||||
|
||||
#### 4\. Inkscape
|
||||
|
||||
![][11]
|
||||
|
||||
Key Features:
|
||||
|
||||
* Tools for object creation (best for drawing/sketching)
|
||||
* Layer management support
|
||||
* Transformation tools for image manipulation
|
||||
* Color selector (RGB, HSL, CMYK, color wheel, CMS)
|
||||
* Support for all major file formats
|
||||
|
||||
|
||||
|
||||
**Platforms available for**: Linux, Windows and macOS
|
||||
|
||||
[Inkscape][12] is a quite popular open-source vector graphics editor used by many professionals. It provides flexible designing tools to help you create/manipulate beautiful artworks. It is technically a direct alternative to Adobe Illustrator – but it pulls off some tricks that can help you utilize this as a Photoshop alternative as well.
|
||||
|
||||
Similar to GIMP’s official resources, you can utilize [Inkscape’s tutorials][13] to make the most out of it.
|
||||
|
||||
**What’s the true Photoshop alternative in your opinion?**
|
||||
|
||||
It’s tough to offer the exact same features that Adobe Photoshop provides. However, if you follow the official documentations and resources, you can do a lot of great stuff using the above-mentioned Photoshop alternatives.
|
||||
|
||||
Adobe has a range of grpahics tools and we have [open source alternatives to entire Adobe Creative Suite][14]. You may check that out as well.
|
||||
|
||||
What do you think about the Photoshop alternatives that we mentioned here? Do you know about any better alternative that deserves the mention? Let us know about it in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/open-source-photoshop-alternatives/
|
||||
|
||||
作者:[Ankush Das][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/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/install-latest-wine/
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/open_source_photoshop_alternatives.png?ssl=1
|
||||
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/08/gimp-screenshot.jpg?ssl=1
|
||||
[4]: https://www.gimp.org/
|
||||
[5]: https://www.gimp.org/docs/
|
||||
[6]: https://www.gimp.org/tutorials/
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/krita-paint.png?ssl=1
|
||||
[8]: https://krita.org/
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/darktable.jpg?ssl=1
|
||||
[10]: https://www.darktable.org/
|
||||
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/12/inkscape-screenshot.jpg?ssl=1
|
||||
[12]: https://inkscape.org/
|
||||
[13]: https://inkscape.org/learn/
|
||||
[14]: https://itsfoss.com/adobe-alternatives-linux/
|
@ -0,0 +1,215 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Bash Script to Delete Files/Folders Older Than “X” Days in Linux)
|
||||
[#]: via: (https://www.2daygeek.com/bash-script-to-delete-files-folders-older-than-x-days-in-linux/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
Bash Script to Delete Files/Folders Older Than “X” Days in Linux
|
||||
======
|
||||
|
||||
**[Disk Usage][1]** Monitoring tools are capable of alerting us when a given threshold is reached.
|
||||
|
||||
But they don’t have the ingenuity to fix the **[disk usage][2]** problem on their own.
|
||||
|
||||
Manual intervention is needed to solve the problem.
|
||||
|
||||
But if you want to fully automate this kind of activity, what you will do.
|
||||
|
||||
Yes, it can be done using the bash script.
|
||||
|
||||
This script prevents alerts from **[monitoring tool][3]** because we delete old log files before filling the disk space.
|
||||
|
||||
We have added many useful shell scripts in the past. If you want to check them out, go to the link below.
|
||||
|
||||
* **[How to automate day to day activities using shell scripts?][4]**
|
||||
|
||||
|
||||
|
||||
I’ve added two bash scripts to this article, which helps clear up old logs.
|
||||
|
||||
### 1) Bash Script to Delete a Folders Older Than “X” Days in Linux
|
||||
|
||||
We have a folder named **“/var/log/app/”** that contains 15 days of logs and we are going to delete 10 days old folders.
|
||||
|
||||
```
|
||||
$ ls -lh /var/log/app/
|
||||
|
||||
drwxrw-rw- 3 root root 24K Oct 1 23:52 app_log.01
|
||||
drwxrw-rw- 3 root root 24K Oct 2 23:52 app_log.02
|
||||
drwxrw-rw- 3 root root 24K Oct 3 23:52 app_log.03
|
||||
drwxrw-rw- 3 root root 24K Oct 4 23:52 app_log.04
|
||||
drwxrw-rw- 3 root root 24K Oct 5 23:52 app_log.05
|
||||
drwxrw-rw- 3 root root 24K Oct 6 23:54 app_log.06
|
||||
drwxrw-rw- 3 root root 24K Oct 7 23:53 app_log.07
|
||||
drwxrw-rw- 3 root root 24K Oct 8 23:51 app_log.08
|
||||
drwxrw-rw- 3 root root 24K Oct 9 23:52 app_log.09
|
||||
drwxrw-rw- 3 root root 24K Oct 10 23:52 app_log.10
|
||||
drwxrw-rw- 3 root root 24K Oct 11 23:52 app_log.11
|
||||
drwxrw-rw- 3 root root 24K Oct 12 23:52 app_log.12
|
||||
drwxrw-rw- 3 root root 24K Oct 13 23:52 app_log.13
|
||||
drwxrw-rw- 3 root root 24K Oct 14 23:52 app_log.14
|
||||
drwxrw-rw- 3 root root 24K Oct 15 23:52 app_log.15
|
||||
```
|
||||
|
||||
This script will delete 10 days old folders and send folder list via mail.
|
||||
|
||||
You can change the value **“-mtime X”** depending on your requirement. Also, replace your email id instead of us.
|
||||
|
||||
```
|
||||
# /opt/script/delete-old-folders.sh
|
||||
|
||||
#!/bin/bash
|
||||
prev_count=0
|
||||
fpath=/var/log/app/app_log.*
|
||||
find $fpath -type d -mtime +10 -exec ls -ltrh {} \; > /tmp/folder.out
|
||||
find $fpath -type d -mtime +10 -exec rm -rf {} \;
|
||||
count=$(cat /tmp/folder.out | wc -l)
|
||||
if [ "$prev_count" -lt "$count" ] ; then
|
||||
MESSAGE="/tmp/file1.out"
|
||||
TO="[email protected]"
|
||||
echo "Application log folders are deleted older than 15 days" >> $MESSAGE
|
||||
echo "+----------------------------------------------------+" >> $MESSAGE
|
||||
echo "" >> $MESSAGE
|
||||
cat /tmp/folder.out | awk '{print $6,$7,$9}' >> $MESSAGE
|
||||
echo "" >> $MESSAGE
|
||||
SUBJECT="WARNING: Apache log files are deleted older than 15 days $(date)"
|
||||
mail -s "$SUBJECT" "$TO" < $MESSAGE
|
||||
rm $MESSAGE /tmp/folder.out
|
||||
fi
|
||||
```
|
||||
|
||||
Set an executable permission to **“delete-old-folders.sh”** file.
|
||||
|
||||
```
|
||||
# chmod +x /opt/script/delete-old-folders.sh
|
||||
```
|
||||
|
||||
Finally add a **[cronjob][5]** to automate this. It runs daily at 7AM.
|
||||
|
||||
```
|
||||
# crontab -e
|
||||
|
||||
0 7 * * * /bin/bash /opt/script/delete-old-folders.sh
|
||||
```
|
||||
|
||||
You will get an output like the one below.
|
||||
|
||||
```
|
||||
Application log folders are deleted older than 20 days
|
||||
+--------------------------------------------------------+
|
||||
Oct 11 /var/log/app/app_log.11
|
||||
Oct 12 /var/log/app/app_log.12
|
||||
Oct 13 /var/log/app/app_log.13
|
||||
Oct 14 /var/log/app/app_log.14
|
||||
Oct 15 /var/log/app/app_log.15
|
||||
```
|
||||
|
||||
### 2) Bash Script to Delete a Files Older Than “X” Days in Linux
|
||||
|
||||
We have a folder named **“/var/log/apache/”** that contains 15 days of logs and we are going to delete 10 days old files.
|
||||
|
||||
The articles below are related to this topic, so you may be interested to read.
|
||||
|
||||
* **[How To Find And Delete Files Older Than “X” Days And “X” Hours In Linux?][6]**
|
||||
* **[How to Find Recently Modified Files/Folders in Linux][7]**
|
||||
* **[How To Automatically Delete Or Clean Up /tmp Folder Contents In Linux?][8]**
|
||||
|
||||
|
||||
|
||||
```
|
||||
# ls -lh /var/log/apache/
|
||||
|
||||
-rw-rw-rw- 3 root root 24K Oct 1 23:52 2daygeek_access.01
|
||||
-rw-rw-rw- 3 root root 24K Oct 2 23:52 2daygeek_access.02
|
||||
-rw-rw-rw- 3 root root 24K Oct 3 23:52 2daygeek_access.03
|
||||
-rw-rw-rw- 3 root root 24K Oct 4 23:52 2daygeek_access.04
|
||||
-rw-rw-rw- 3 root root 24K Oct 5 23:52 2daygeek_access.05
|
||||
-rw-rw-rw- 3 root root 24K Oct 6 23:54 2daygeek_access.06
|
||||
-rw-rw-rw- 3 root root 24K Oct 7 23:53 2daygeek_access.07
|
||||
-rw-rw-rw- 3 root root 24K Oct 8 23:51 2daygeek_access.08
|
||||
-rw-rw-rw- 3 root root 24K Oct 9 23:52 2daygeek_access.09
|
||||
-rw-rw-rw- 3 root root 24K Oct 10 23:52 2daygeek_access.10
|
||||
-rw-rw-rw- 3 root root 24K Oct 11 23:52 2daygeek_access.11
|
||||
-rw-rw-rw- 3 root root 24K Oct 12 23:52 2daygeek_access.12
|
||||
-rw-rw-rw- 3 root root 24K Oct 13 23:52 2daygeek_access.13
|
||||
-rw-rw-rw- 3 root root 24K Oct 14 23:52 2daygeek_access.14
|
||||
-rw-rw-rw- 3 root root 24K Oct 15 23:52 2daygeek_access.15
|
||||
```
|
||||
|
||||
This script will delete 10 days old files and send folder list via mail.
|
||||
|
||||
You can change the value **“-mtime X”** depending on your requirement. Also, replace your email id instead of us.
|
||||
|
||||
```
|
||||
# /opt/script/delete-old-files.sh
|
||||
|
||||
#!/bin/bash
|
||||
prev_count=0
|
||||
fpath=/var/log/apache/2daygeek_access.*
|
||||
find $fpath -type f -mtime +15 -exec ls -ltrd {} \; > /tmp/file.out
|
||||
find $fpath -type f -mtime +15 -exec rm -rf {} \;
|
||||
count=$(cat /tmp/file.out | wc -l)
|
||||
if [ "$prev_count" -lt "$count" ] ; then
|
||||
MESSAGE="/tmp/file1.out"
|
||||
TO="[email protected]"
|
||||
echo "Apache Access log files are deleted older than 20 days" >> $MESSAGE
|
||||
echo "+--------------------------------------------- +" >> $MESSAGE
|
||||
echo "" >> $MESSAGE
|
||||
cat /tmp/file.out | awk '{print $6,$7,$9}' >> $MESSAGE
|
||||
echo "" >> $MESSAGE
|
||||
SUBJECT="WARNING: Apache log folders are deleted older than 15 days $(date)"
|
||||
mail -s "$SUBJECT" "$TO" < $MESSAGE
|
||||
rm $MESSAGE /tmp/file.out
|
||||
fi
|
||||
```
|
||||
|
||||
Set an executable permission to **“delete-old-files.sh”** file.
|
||||
|
||||
```
|
||||
# chmod +x /opt/script/delete-old-files.sh
|
||||
```
|
||||
|
||||
Finally add a **[cronjob][5]** to automate this. It runs daily at 7AM.
|
||||
|
||||
```
|
||||
# crontab -e
|
||||
|
||||
0 7 * * * /bin/bash /opt/script/delete-old-folders.sh
|
||||
```
|
||||
|
||||
You will get an output like the one below.
|
||||
|
||||
```
|
||||
Apache Access log files are deleted older than 20 days
|
||||
+--------------------------------------------------------+
|
||||
Oct 11 /var/log/apache/2daygeek_access.11
|
||||
Oct 12 /var/log/apache/2daygeek_access.12
|
||||
Oct 13 /var/log/apache/2daygeek_access.13
|
||||
Oct 14 /var/log/apache/2daygeek_access.14
|
||||
Oct 15 /var/log/apache/2daygeek_access.15
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/bash-script-to-delete-files-folders-older-than-x-days-in-linux/
|
||||
|
||||
作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/linux-check-disk-usage-files-and-directories-folders-size-du-command/
|
||||
[2]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/
|
||||
[3]: https://www.2daygeek.com/category/monitoring-tools/
|
||||
[4]: https://www.2daygeek.com/category/shell-script/
|
||||
[5]: https://www.2daygeek.com/crontab-cronjob-to-schedule-jobs-in-linux/
|
||||
[6]: https://www.2daygeek.com/how-to-find-and-delete-files-older-than-x-days-and-x-hours-in-linux/
|
||||
[7]: https://www.2daygeek.com/check-find-recently-modified-files-folders-linux/
|
||||
[8]: https://www.2daygeek.com/automatically-delete-clean-up-tmp-directory-folder-contents-in-linux/
|
Loading…
Reference in New Issue
Block a user