Never heard of Colorado-based System76? Think of the company as the Linux alternative to boutique PC builders like Digital Storm, Maingear or Falcon Northwest. System76 specializes in preloading laptops, desktops and mini PCs with a Linux operating system, either Ubuntu or its own Pop!_OS distribution. But today marks a dramatic turning point for the company. Where before it traditionally customized systems inside a mass-produced chassis, the new Thelio PCs are a leap forward in originality, built from the ground up with an “open hardware” approach.
Learn how to use the find command in this tutorial from our archives.
It goes without saying that every good Linux desktop environment offers the ability to search your file system for files and folders. If your default desktop doesn’t — because this is Linux — you can always install an app to make searching your directory hierarchy a breeze.
But what about the command line? If you happen to frequently work in the command line or you administer GUI-less Linux servers, where do you turn when you need to locate a file? Fortunately, Linux has exactly what you need to locate the files in question, built right into the system.
The command in question is find. To make the understanding of this command even more enticing, once you know it, you can start working it into your Bash scripts. That’s not only convenience, that’s power.
Let’s get up to speed with the find command so you can take control of locating files on your Linux servers and desktops, without the need of a GUI.
How to use the find command
When I first glimpsed Linux, back in 1997, I didn’t quite understand how the find command worked; therefore, it never seemed to function as I expected. It seemed simple; issue the command find FILENAME (where FILENAME is the name of the file) and the command was supposed to locate the file and report back. Little did I know there was more to the command than that. Much more.
If you issue the command man find, you’ll see the syntax of the find command is:
Naturally, if you’re unfamiliar with how man works, you might be confused about or overwhelmed by that syntax. For ease of understanding, let’s simplify that. The most basic syntax of a basic find command would look like this:
find /path option filename
Now we’ll see it at work.
Find by name
Let’s break down that basic command to make it as clear as possible. The most simplistic structure of the find command should include a path for the file, an option, and the filename itself. You may be thinking, “If I know the path to the file, I’d already know where to find it!”. Well, the path for the file could be the root of your drive; so / would be a legitimate path. Entering that as your path would take find longer to process — because it has to start from scratch — but if you have no idea where the file is, you can start from there. In the name of efficiency, it is always best to have at least an idea where to start searching.
The next bit of the command is the option. As with most Linux commands, you have a number of available options. However, we are starting from the beginning, so let’s make it easy. Because we are attempting to find a file by name, we’ll use one of two options:
name – case sensitive
iname – case insensitive
Remember, Linux is very particular about case, so if you’re looking for a file named Linux.odt, the following command will return no results.
find / -name linux.odt
If, however, you were to alter the command by using the -iname option, the find command would locate your file, regardless of case. So the new command looks like:
find / -iname linux.odt
Find by type
What if you’re not so concerned with locating a file by name but would rather locate all files of a certain type? Some of the more common file descriptors are:
f – regular file
d – directory
l – symbolic link
c – character devices
b – block devices
Now, suppose you want to locate all block devices (a file that refers to a device) on your system. With the help of the -type option, we can do that like so:
find / -type c
The above command would result in quite a lot of output (much of it indicating permission denied), but would include output similar to:
We can use the same option to help us look for configuration files. Say, for instance, you want to locate all regular files that end in the .conf extension. This command would look something like:
find / -type f -name "*.conf"
The above command would traverse the entire directory structure to locate all regular files ending in .conf. If you know most of your configuration files are housed in /etc, you could specify that like so:
find /etc -type f -name “*.conf”
The above command would list all of your .conf files from /etc (Figure 1).
Figure 1: Locating all of your configuration files in /etc.
Outputting results to a file
One really handy trick is to output the results of the search into a file. When you know the output might be extensive, or if you want to comb through the results later, this can be incredibly helpful. For this, we’ll use the same example as above and pipe the results into a file called conf_search. This new command would look like:
find /etc -type f -name “*.conf” > conf_search
You will now have a file (conf_search) that contains all of the results from the find command issued.
Finding files by size
Now we get to a moment where the find command becomes incredibly helpful. I’ve had instances where desktops or servers have found their drives mysteriously filled. To quickly make space (or help locate the problem), you can use the find command to locate files of a certain size. Say, for instance, you want to go large and locate files that are over 1000MB. The find command can be issued, with the help of the -size option, like so:
find / -size +1000MB
You might be surprised at how many files turn up. With the output from the command, you can comb through the directory structure and free up space or troubleshoot to find out what is mysteriously filling up your drive.
You can search with the following size descriptions:
c – bytes
k – Kilobytes
M – Megabytes
G – Gigabytes
b – 512-byte blocks
Keep learning
We’ve only scratched the surface of the find command, but you now have a fundamental understanding of how to locate files on your Linux systems. Make sure to issue the command man find to get a deeper, more complete, knowledge of how to make this powerful tool work for you.
Learn more about Linux through the free “Introduction to Linux” course from The Linux Foundation and edX.
With over 75 sessions, keynotes, hands-on technical workshops, social activities, evening events, and more, Hyperledger Global Forum gives you a unique opportunity to collaborate with the Hyperledger community, make new connections, learn about the latest production deployments, and further advance your blockchain skills. In addition to previously announcedkeynote speakers, new keynote speakers include:
Frank Yiannas, Vice President of Food Safety, Walmart
David Treat, Managing Director, Accenture
Session Highlights Include:
Technical Track:
Approaches to Consortia Governance and Access Control in Hyperledger Fabric Applications – Mark Rakhmilevich, Oracle
Chaincode Best Practices – Sheehan Anderson, State Street
Lessons Learned Creating a Usable, Real-world Web Application using Fabric/Composer – Waleed El Sayed & Markus Stauffiger, 4eyes GmbH
Secure your spot now and save up to $150 with the current registration rate, available through November 25. Register now >>
For years, Ansible has been a go-to choice for infrastructure automation. As Kubernetes adoption has skyrocketed, Ansible has continued to shine in the emerging container orchestration ecosystem.
Ansible fits naturally into a Kubernetes workflow, using YAML to describe the desired state of the world. Multiple projects, including the Automation Broker, are adapting Ansible for use behind specific APIs. This article will focus on a new technique, created through a joint effort by the Ansible core team and the developers of Automation Broker, that uses Ansible to create Operators with minimal effort.
An Operator is a Kubernetes controller that deploys and manages a service or application in a cluster. It automates human operation knowledge and best practices to keep services running and healthy.
The survey conducted for our “Guide to Serverless Technologies” asked a series of questions about the vendors and technologies that we will be using in the next 18 months to drive our coverage at The New Stack.
The first half of the roadmap dealt with the platforms and frameworks on which serverless architecture is deployed. The leading hosted platforms are the big three cloud providers’ FaaS offerings. AWS Lambda has twice as many users as Azure Functions and more than three times as many as Google Cloud Functions. Although on-premises deployments are not widespread, they are widely being considered. In fact, the percentage planning to use Kubeless, OpenFaaS, and Apache OpenWhisk rivals those looking at AWS, Microsoft and Google. In other words, the battle for the next wave of serverless adoption is alive and well.
Today, we are announcing a suite of open source Linux kernel components and related tools that address critical fleet management issues. These include resource control, resource utilization, workload isolation, load balancing, measuring, monitoring, and much more.
Kernel and kernel application developers at Facebook partner with various internal teams to develop technologies that resolve issues and concerns in Facebook’s data centers — the same challenges that many throughout the industry share. The following products are now in production on a massive scale throughout all of Facebook’s infrastructure, as well as at many other organizations.
BPF
BPF is a highly flexible, efficient code execution engine in the Linux kernel that allows bytecode to run at various hook points, enabling safe and easy modifications of kernel behaviors with custom code. Although it’s been widely used for packet filtering, BPF’s instruction set is generic and flexible enough to support and allow for a wide variety of use cases beyond networking such as tracing and security (e.g., sandboxing).
Following this flurry of activity, we want to share some of the highlights with you. At Open Source Summit Europe & ELC + OpenIoT Summit Europe, more than 90 sessions were recorded, and you can browse the list of presentations here. A few of the featured keynotes include:
The Kernel Report – Jonathan Corbet, Author, Kernel Developer and Executive Editor, LWN.net
There are 21 videos available online for Linux Security Summit Europe, several of which provide an overview of recent developments in the Linux kernel, including the following:
The Open FinTech Forum is a brand-new event, which took place in New York City earlier this month and focused on the intersection of financial services and open source. It covered cutting-edge open source technologies including AI, blockchain, and Kubernetes, and there are 9 keynote videos available online, including:
Whatever goal setting methodology you choose (be it SMART, OKRs, or something else), approach the process as its own project in a transparent and collaborative way. In other words, treat the goal setting process as its own project, just like you would the work toward the goals themselves.
Start with where you are
Before stating your wild goals for the future, first build an understanding of where you are now. This way you’ll be able to chart a clear path from here to your ideal future state—that is, once you’ve identified your goals.
Most people will think of Ubuntu as primarily a Linux server and cloud technology effort. Ubuntu also has some networking capabilities that it develops on its own including the Fan container networking project.
There are multiple open source SDN efforts in the market today that more well known than Fan, including the Tungsten Fabric and OVN, among others. Fan however, takes a different approach than other SDN models.
“Fan is a zero configuration SDN,” Mark Shuttleworth CEO of Canonical Inc and Founder of Ubuntu, said. “What you trade is the ability to live migrate an IP address for simplicity.”
What used to be 27 is now 39 – Due to all the great comments, I’ve amended the list to add a few more suggestions, thanks to all that contributed.
Shortcuts are the most productive thing that a developer can add to their repertoire that will aid them through their entire career. Learning how to use your system and tools will improve your productivity and in general make traversing all your windows and apps a breeze. The mouse is a great, tool, but if you can do it quicker, more effectively without your hands leaving your keyboard then you should!
Here’s a list of my most used shortcuts, you’ll probably know or use quite a few of these already, hopefully there is one here you don’t!