Linux Format

Monitoring cycles in directory trees

We’re going to use Python 3 to write Linux command line utilities that work with files and finds cycles in directory trees. The thinking here is that it’s faster to write in Python 3 than to use C. However, the tutorial presents some directions for developing the same utility in both C and Go. Let’s start by understanding the problem we’re trying to solve.

The idea behind the utility is that with UNIX symbolic links it’s possible to create cycles (aka loops) in filesystems. Put simply, without symbolic links, there would be no cycles problem. This can perplex back-up software such as tar or utilities such as find and it can sometimes have security implications: for example, accessing files outside of the designated directory tree. FScycles.py, the utility we’ll be focusing on in this tutorial, attempts to inform us about such situations.

The screenshot (below) shows a directory tree using the tree utility – it’s the ~/go directory where Go puts external packages. Because this directory doesn’t contain any symbolic links, create some using

Before getting into the meat of the subject let’s understand the various types of files that can be found in Linux. Remember that UNIX treats everything as a file, even hardware

Citiți o mostră, înregistrați-vă pentru a citi în continuare.

Mai multe de la Linux Format

Linux Format1 min cititeComputers
Meet The Team
OpenMediaVault server can install Portainer in a single click, and despite running many a container on very modest hardware, it never once fell over during my labours. If only the same could be said for me, who suffered plenty at the hands of IPv6 th
Linux Format2 min cititeInternet & Web
Resource Usage
We tested the browsers using the pmap utility to determine the memory usage at initial launch, and ran the test again after some light browsing of Wikipedia, webmail, social media platforms, YouTube and a handful of other websites across different ta
Linux Format1 min cititeComputers
RASPBERRY Pi REVISIONS
If you try the above on a Pi you’ll find Docker works but Compose doesn’t. We downloaded an x86 docker-compose binary, when the Pi needs an ARM one. And sadly there’s no official ARM builds yet. To remedy this you can compile Compose yourself, or (mu