Chapter 4. Working with Files
Everything in a BSD file system can be viewed as a file. This includes data files, directories, devices, named pipes, links, and other types of files. Associated with each file is a set of information that determines who can access the file and how they can access it. This chapter covers many commands for exploring and working with files.
Understanding File Types
Directories and regular files are by far the file types you will use most often. However, there are several other types of files you will encounter as you use BSD. From the command line, there are many ways you can create, find, and list different types of files.
Files that provide access to the hardware components on your computer are referred to as device files. There are character and block devices. There are hard links and soft links you can use to make the same file accessible from different locations. Less often used directly by regular users are named pipes and sockets, which provide access points for processes to communicate with each other.
Using Regular Files
Regular files consist of data files (documents, music, images, archives, and so on) and commands (binaries and scripts). You can determine the type of a file using the file command. In the following example, you change to the directory containing bash shell ...
Get BSD Unix® Toolbox: 1000+ Commands for FreeBSD®, OpenBSD, and NetBSD® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.