{"id":6843,"date":"2024-08-07T01:00:00","date_gmt":"2024-08-07T05:00:00","guid":{"rendered":"https:\/\/www.both.org\/?p=6843"},"modified":"2025-07-06T14:46:39","modified_gmt":"2025-07-06T18:46:39","slug":"the-linux-philosophy-for-sysadmins-tenet-03-everything-is-a-file","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=6843","title":{"rendered":"The Linux Philosophy for SysAdmins, Tenet 03 \u2014 Everything is a File"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"6843\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><\/div>\n<p class=\"has-small-font-size\">Author&#8217;s note: This article is excerpted in part from chapter 5 of my book, The <a href=\"https:\/\/www.both.org\/?page_id=903\" data-type=\"link\" data-id=\"https:\/\/www.both.org\/?page_id=903\" target=\"_blank\" rel=\"noreferrer noopener\">Linux Philosophy for SysAdmins<\/a>, with some changes.<\/p>\n\n\n\n<p>This is one of the most important concepts that makes Linux especially flexible and powerful: Everything is a file. That is, everything can be the source of a data stream, the target of a data stream, or in many cases both. In this article you will explore what \u201ceverything is a file\u201d really means and learn to use that to advantage as a SysAdmin.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>The whole point with &#8220;everything is a file&#8221; is &#8230; the fact that you can use common tools to operate on different things.<\/p>\n\n\n\n<p>Linus Torvalds in an email.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">What is a file?<\/h2>\n\n\n\n<p>Here is a trick question for you. Which of the following are files?<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Directories<\/li>\n\n\n\n<li>Shell scripts<\/li>\n\n\n\n<li>Running terminal emulators<\/li>\n\n\n\n<li>LibreOffice documents<\/li>\n\n\n\n<li>Serial ports<\/li>\n\n\n\n<li>Kernel data structures<\/li>\n\n\n\n<li>Kernel tuning parameters<\/li>\n\n\n\n<li>Hard drives &#8211; \/dev\/sda<\/li>\n\n\n\n<li>\/dev\/null<\/li>\n\n\n\n<li>Partitions &#8211; \/dev\/sda1<\/li>\n\n\n\n<li>Logical Volumes (LVM) &#8211; \/dev\/mapper\/volume1-tmp<\/li>\n\n\n\n<li>Printers<\/li>\n\n\n\n<li>Sockets<\/li>\n<\/ul>\n\n\n\n<p>To Unix and Linux they are all files and that is one of the most amazing concepts in the history of computing. It makes possible some very simple yet powerful methods for performing many administrative tasks that might otherwise be extremely difficult or impossible. Linux handles almost everything as a file and that has some interesting and amazing implications. This concept makes it possible to copy an entire hard drive, boot record included, because the entire hard drive is a file, just as are the individual partitions.<\/p>\n\n\n\n<p>\u201cEverything is a file\u201d is possible because all devices are implemented by Linux as these things called device files. Device files are not device drivers, rather they are gateways to devices that are exposed to the user.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Device Files<\/h2>\n\n\n\n<p>Device files are technically known as <a href=\"https:\/\/en.wikipedia.org\/wiki\/Device_file\" data-type=\"link\" data-id=\"https:\/\/en.wikipedia.org\/wiki\/Device_file\" target=\"_blank\" rel=\"noreferrer noopener\">device special files<\/a>. Device files are employed to provide the operating system and, even more importantly in an open operating system, the users an interface to the devices that they represent. All Linux device files are located in the <code>\/dev<\/code> directory which is an integral part of the root (<code>\/<\/code>) filesystem because they must be available to the operating system during early stages of the boot process\u2013before other filesystems are mounted.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Device data flow<\/h3>\n\n\n\n<p>Let&#8217;s look at the data flow of a typical command to visualize how device special files work. Figure 1 illustrates a simplified data flow for a simple command. Issuing the <code>cat \/etc\/resolv.conf<\/code> command from a GUI terminal emulator such as Konsole or xterm causes the <code>resolv.conf<\/code> file to be read from the disk with the disk device driver handling the device specific functions such as locating the file on the hard drive and reading it. The data is passed through the device file and then from the command to the device file and device driver for pseudo-terminal 6 where it is displayed in the terminal session.<\/p>\n\n\n\n<figure class=\"wp-block-image alignleft size-full is-resized\"><a href=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/05\/Figure-22-01.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"532\" height=\"531\" src=\"http:\/\/www.both.org\/wp-content\/uploads\/2024\/05\/Figure-22-01.png\" alt=\"\" class=\"wp-image-5449\" style=\"width:343px;height:auto\"\/><\/a><figcaption class=\"wp-element-caption\"><em>Figure 1: Simplified data flow with device special files.<\/em> <\/figcaption><\/figure>\n\n\n\n<p>Of course the output of the <strong>cat<\/strong> command could have been redirected to a file in the following manner, <code>cat \/etc\/resolv.conf &gt; \/etc\/resolv.bak<\/code> in order to create a backup of the file. In that case the data flow on the left side of Figure 1 would remain the same while the data flow on the right would be through the <code>\/dev\/sda2<\/code> device file, the hard drive device driver, and then back onto the hard drive in the <code>\/etc<\/code> directory as the new file, <code>resolv.bak<\/code>.<\/p>\n\n\n\n<p>These device special files make it very easy to use Standard Streams (STDIO) and redirection to access any and every device on a Linux or Unix computer. They provide a consistent and easy to access interface to every device. Simply directing a data stream to a device file sends the data to that device.<\/p>\n\n\n\n<p>One of the most important things to remember about these device special files is that they are not device drivers. They are most accurately described as portals or gateways to the device drivers. Data is passed from an application or the operating system to the device file which then passes it to the device driver which then sends it to the physical device.<\/p>\n\n\n\n<p>By using these device files which are separate from the device drivers it is possible for users and programs to have a consistent interface to every device on the host computer. This is how common tools can be used to operate on different things as Linus says.<\/p>\n\n\n\n<p>The device drivers are still responsible for dealing with the unique requirements of each physical device. That is, however, outside the scope of this article.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Device File Classification<\/h3>\n\n\n\n<p>Device files can be classified in at least two ways. The first and most commonly used classification is that of the type of data stream commonly associated with the device. For example tty and serial devices are considered to be character based because the data stream is transferred and handled one character or byte at a time. Block type devices such as hard drives transfer data in blocks, typically a multiple of 256 bytes.<\/p>\n\n\n\n<p>Let&#8217;s take a look at the <code>\/dev<\/code> directory and some of the devices in it. This experiment should be performed as a normal, that is a non-root, user. Open a terminal session and display a long listing of the <code>\/dev<\/code> directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tuser1@testvm1:~$ <strong>ls -l \/dev | less<\/strong>\ntotal 0\ncrw-r--r--  1 root    root     10, 235 Jul 25 08:40 autofs\ndrwxr-xr-x  2 root    root         260 Jul 25 08:40 block\ndrwxr-xr-x  2 root    root          80 Jul 25 04:40 bsg\ncrw-rw----  1 root    disk     10, 234 Jul 25 08:40 btrfs-control\ndrwxr-xr-x  3 root    root          60 Jul 25 08:40 bus\nlrwxrwxrwx  1 root    root           3 Jul 25 08:40 cdrom -&gt; sr0\ndrwxr-xr-x  2 root    root        3800 Jul 27 07:50 char\ncrw--w----  1 root    tty       5,   1 Jul 27 07:49 console\nlrwxrwxrwx  1 root    root          11 Jul 25 04:40 core -&gt; \/proc\/kcore\ndrwxr-xr-x  8 root    root         160 Jul 25 08:40 cpu\ncrw-------  1 root    root     10, 124 Jul 25 08:40 cpu_dma_latency\ncrw-------  1 root    root     10, 203 Jul 25 08:40 cuse\ndrwxr-xr-x  8 root    root         160 Jul 25 04:40 disk\nbrw-rw----  1 root    disk    253,   0 Jul 25 08:40 dm-0\nbrw-rw----  1 root    disk    253,   1 Jul 25 08:40 dm-1\nbrw-rw----  1 root    disk    253,   2 Jul 25 08:40 dm-2\nbrw-rw----  1 root    disk    253,   3 Jul 25 08:40 dm-3\nbrw-rw----  1 root    disk    253,   4 Jul 25 08:40 dm-4\n&lt;SNIP&gt;\ncrw-rw----  1 root    lp        6,   0 Jul 25 08:40 lp0\ncrw-rw----  1 root    lp        6,   1 Jul 25 08:40 lp1\ncrw-rw----  1 root    lp        6,   2 Jul 25 08:40 lp2\ncrw-rw----  1 root    lp        6,   3 Jul 25 08:40 lp3\ndrwxr-xr-x  2 root    root         160 Jul 25 08:40 mapper\ncrw-------  1 root    root     10, 227 Jul 25 08:40 mcelog\ncrw-r-----  1 root    kmem      1,   1 Jul 25 08:40 mem\ndrwxrwxrwt  2 root    root          40 Jul 25 08:40 mqueue\ndrwxr-xr-x  2 root    root          60 Jul 25 08:40 net\ncrw-rw-rw-  1 root    root      1,   3 Jul 25 08:40 null\ncrw-------  1 root    root     10, 144 Jul 25 08:40 nvram\n&lt;SNIP&gt;\ncrw-rw-rw-  1 root    root      1,   8 Jul 25 08:40 random\ncrw-rw-r--+ 1 root    root     10, 242 Jul 25 08:40 rfkill\nlrwxrwxrwx  1 root    root           4 Jul 25 08:40 rtc -&gt; rtc0\ncrw-------  1 root    root    250,   0 Jul 25 08:40 rtc0\nbrw-rw----  1 root    disk      8,   0 Jul 25 08:40 sda\nbrw-rw----  1 root    disk      8,   1 Jul 25 08:40 sda1\nbrw-rw----  1 root    disk      8,   2 Jul 25 08:40 sda2\nbrw-rw----  1 root    disk      8,   3 Jul 25 08:40 sda3\n&lt;SNIP&gt;\nlrwxrwxrwx  1 root    root          15 Jul 25 04:40 stderr -&gt; \/proc\/self\/fd\/2\nlrwxrwxrwx  1 root    root          15 Jul 25 04:40 stdin -&gt; \/proc\/self\/fd\/0\nlrwxrwxrwx  1 root    root          15 Jul 25 04:40 stdout -&gt; \/proc\/self\/fd\/1\ncrw-rw-rw-  1 root    tty       5,   0 Aug  3 09:03 tty\ncrw--w----  1 root    tty       4,   0 Jul 25 08:40 tty0\ncrw--w----  1 root    tty       4,   1 Jul 25 08:40 tty1\ncrw--w----  1 root    tty       4,  10 Jul 25 08:40 tty10\ncrw--w----  1 root    tty       4,  11 Jul 25 08:40 tty11\n&lt;SNIP&gt;\ncrw-rw-rw-  1 root    root      1,   5 Jul 25 08:40 zero\nbrw-rw----  1 root    disk    252,   0 Jul 25 08:40 zram0\n<\/code><\/pre>\n\n\n\n<p>The results from this command are too long to show here in full but you will see a list of device files with their file permissions and their major and minor identification numbers. The voluminous output of the <code>ls -l<\/code> command is piped through the less pager utility to allow you to page through the results; use the Page Up, Page Down, and up and down arrow keys to move around. Type <strong><code>q<\/code> <\/strong>to quit and get out of the <code>less<\/code> display.<\/p>\n\n\n\n<p>The pruned listing of device files shown in this experiment are just a few of the ones in the <code>\/dev<\/code> directory on my Fedora workstation. They represent disk, printer, memory, CPU, and tty type devices among many others. Notice the leftmost character of each line in the output. The ones that have a \u201cb\u201d are block type devices and the ones that begin with \u201cc\u201d are character devices.<\/p>\n\n\n\n<p>The <a href=\"https:\/\/www.kernel.org\/doc\/html\/v4.11\/admin-guide\/devices.html\" data-type=\"link\" data-id=\"https:\/\/www.kernel.org\/doc\/html\/v4.11\/admin-guide\/devices.html\" target=\"_blank\" rel=\"noreferrer noopener\">Linux Allocated Devices file<\/a> at Kernel.org is the official registry of device types and major and minor number allocations. It can help you understand the major and minor numbers for all currently defined devices.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Fun with device files<\/h2>\n\n\n\n<p>Let&#8217;s take a few minutes now and have some fun with some of these device files to illustrate their power and flexibility. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Console communications<\/h3>\n\n\n\n<p>Most Linux distributions have multiple virtual consoles, 1 through 7, that can be used to login to a local console session with a shell interface. These can be accessed using the key combinations Ctrl-Alt-F1 for console 1, Ctrl-Alt-F2 for console 2, and so on.<\/p>\n\n\n\n<p>In this experiment we will show that simple commands can be used to send data between devices, in this case, different console and terminal devices. Perform this experiment as a normal user.<\/p>\n\n\n\n<p>Press <strong>Ctrl-Alt-F2<\/strong> to switch to console 2. On some distributions, the login information includes the tty (Teletype) device associated with this console, but others do not. It should be tty2 because you are in console 2. You might need to use a different key combination if you are using a local instance of a VM.<\/p>\n\n\n\n<p>Login to console 2 as the normal user. Then use the <code>who am i<\/code> command\u2014yes, just like that, with spaces\u2014to determine which tty device is connected to this console.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tuser1@testvm1:~$ <strong>who am i<\/strong>\ntuser1   pts\/1        2024-07-25 08:42 (192.168.0.1)<\/code><\/pre>\n\n\n\n<p>This command also shows the date and time that the user on the console logged in. Before we proceed any further with this experiment, let&#8217;s look at a listing of the tty3 and tty4 devices in <code>\/dev<\/code>. We do that by using a set <code>[34]<\/code> so that only those two devices are listed. This shows us the full paths to these two device special files which I used for the rest of this experiment.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tuser1@testvm1:~$ <strong>ls -l \/dev\/tty&#91;34]<\/strong>\ncrw--w---- 1 root   tty 4, 3 Jul 27 07:49 \/dev\/tty3\ncrw--w---- 1 root   tty 4, 4 Aug  3 21:16 \/dev\/tty4<\/code><\/pre>\n\n\n\n<p>There are a large number of tty devices defined at boot time but we don&#8217;t care about most of them, just these two devices. As device files there is nothing special about them, they are simply character type devices; note the \u201cc\u201d in the first column of the results. The tty3 device is attached to virtual console 3 and the tty4 device is attached to virtual console 4 (VC4).<\/p>\n\n\n\n<p>Press <strong>Ctrl-Alt-F3<\/strong> to switch to console 3 and login again as the normal user. Use the <code>who am i<\/code> command again to verify that you really are on VC3 and then enter the <code>echo<\/code> command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tuser1@testvm1:~$ <strong>who am i<\/strong>\nstudent tty3          2017-10-05 13:18\ntuser1@testvm1:~$ <strong>echo \"Hello world\" &gt; \/dev\/tty<\/strong>4\ntuser1@testvm1:~$<\/code><\/pre>\n\n\n\n<p>Press <strong>Ctrl-Alt-F4<\/strong> to return to console 4. The string &#8220;Hello world&#8221; (without quotes) should displayed on console 4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Terminal communications<\/h3>\n\n\n\n<p>This experiment can also be performed with terminal emulators on the GUI desktop but it does essentially the same thing as the previous experiment. Terminal sessions on the desktop use pseudo terminal devices in the <code>\/dev<\/code> tree, such as <code>\/dev\/pts\/1<\/code>, where pts stands for \u201cpseudo terminal session.\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image alignleft size-full is-resized\"><a href=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/08\/Terminal-Communications-01.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1036\" height=\"679\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/08\/Terminal-Communications-01.png\" alt=\"\" class=\"wp-image-6868\" style=\"width:699px;height:auto\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 2: Sending a message from one terminal session to another using common commands and redirection.<\/figcaption><\/figure>\n\n\n\n<p>Open two terminal sessions on the GUI desktop using Konsole, or Xterm. Your other favorite graphical terminal emulator may work, but Tilix and Xfce4-terminal do not return the proper information for the <code>who am i<\/code> command. Determine which pseudo-terminal device files the sessions are connected to with the <code>who am i<\/code> command and then use one to send a message to the another with the echo command.<\/p>\n\n\n\n<p>On my test host, I sent the text \u201cHello world\u201d from <code>\/dev\/pts\/3<\/code> to <code>\/dev\/pts\/2<\/code>. Your terminal devices will probably be different from the ones I have used on my test virtual machine. Be sure to use the correct devices for your environment for this experiment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Direct printing<\/h3>\n\n\n\n<p>Another interesting experiment is to print a file directly to the printer using the <code>cat<\/code> command. This experiment should be performed as the student user.<\/p>\n\n\n\n<p>You may need to determine which device is your printer. If your printer is a USB printer which almost all are these days, look in the <code>\/dev\/usb<\/code> directory for lp0 which is usually the default printer. You may find other printer device files in that directory as well. You must have configured this printer so that it prints using more traditional methods.<\/p>\n\n\n\n<p>I used LibreOffice Writer to create a short document which I then exported as a PDF file, test.pdf. Any Linux word processor will do so long as it can export to the PDF format.<\/p>\n\n\n\n<p>We will assume that your printer device is <code>\/dev\/usb\/lp0<\/code>, and that your printer can print PDF files directly, as most can. Be sure to use a PDF file and change the name test.pdf in the command to the name of your own file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tuser1@testvm1:~$<strong>cat test.pdf &gt; \/dev\/usb\/lp0<\/strong><\/code><\/pre>\n\n\n\n<p>This command should print the PDF file <code>test.pdf<\/code> on your printer.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Reading memory<\/h3>\n\n\n\n<p>The <code>\/dev<\/code> directory contains some very interesting device files that are portals to hardware that one does not normally think of as a device like a hard drive or display. For one example, system memory (RAM) is not something that is normally considered as a \u201cdevice,\u201d yet <code>\/dev\/mem<\/code> is the device special file through which direct access to memory can be achieved.<\/p>\n\n\n\n<p>This experiment must be run as the root user. Because you are only reading the contents of memory this experiment poses little danger.<\/p>\n\n\n\n<p>If a root terminal session is not already available, open a terminal emulator session and login as root. The next command will dump the first 2MB of RAM to STDOUT via the <code>less<\/code> pager. To make it a bit more intelligible &#8212; to at least display the data in a decent format that might be interpreted using careful examination &#8212; pipe the output of the <code>dd<\/code> command through the <code>od<\/code> utility. In this instance, the line starting at memory location 2704240 looks like it contains the word SATA.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@testvm1:~# <strong>dd if=\/dev\/mem bs=2048 count=1000 | od -c | less<\/strong>\n&lt;SNIP&gt;\n2703600   a 003   h 003   c 003   i 003     003   0 003   0 003   0 003\n2703620   0 003   : 003   0 003   0 003   : 003   0 003   d 003   . 003\n2703640   0 003   : 003     003   S 003   S 003   S 003     003   f 003\n2703660   l 003   a 003   g 003     003   s 003   e 003   t 003   , 003\n2703700     003   p 003   a 003   r 003   a 003   l 003   l 003   e 003\n2703720   l 003     003   b 003   u 003   s 003     003   s 003   c 003\n2703740   a 003   n 003     003   d 003   i 003   s 003   a 003   b 003\n2703760   l 003   e 003   d 003      \\a      \\a      \\a      \\a      \\a\n2704000      \\a      \\a      \\a      \\a      \\a      \\a      \\a      \\a\n*\n2704040   a 003   h 003   c 003   i 003     003   0 003   0 003   0 003\n2704060   0 003   : 003   0 003   0 003   : 003   0 003   d 003   . 003\n2704100   0 003   : 003     003   A 003   H 003   C 003   I 003     003\n2704120   v 003   e 003   r 003   s 003     003   0 003   0 003   0 003\n2704140   1 003   . 003   0 003   1 003   0 003   0 003   , 003     003\n2704160   3 003   2 003     003   c 003   o 003   m 003   m 003   a 003\n2704200   n 003   d 003     003   s 003   l 003   o 003   t 003   s 003\n2704220   , 003     003   3 003     003   G 003   b 003   p 003   s 003\n<strong>2704240   , 003     003   S 003   A 003   T 003   A 003     003   m 003<\/strong>\n2704260   o 003   d 003   e 003      \\a      \\a      \\a      \\a      \\a\n2704300   a 003   h 003   c 003   i 003     003   0 003   0 003   0 003\n2704320   0 003   : 003   0 003   0 003   : 003   0 003   d 003   . 003\n2704340   0 003   : 003     003   4 003   \/ 003   4 003     003   p 003\n2704360   o 003   r 003   t 003   s 003     003   i 003   m 003   p 003\n2704400   l 003   e 003   m 003   e 003   n 003   t 003   e 003   d 003\n2704420     003   ( 003   p 003   o 003   r 003   t 003     003   m 003\n2704440   a 003   s 003   k 003     003   0 003   x 003   f 003   ) 003\n2704460      \\a      \\a      \\a      \\a      \\a      \\a      \\a      \\a\n*\n2704540   a 003   h 003   c 003   i 003     003   0 003   0 003   0 003\n&lt;SNIP&gt;<\/code><\/pre>\n\n\n\n<p>This demonstrates how easy it is to access system memory directly if you have root privilege. This is why the crackers try so hard to install tools on target systems that can elevate their privileges to root level. Root has more access to read memory than a non-root user, but most memory is protected from being written by any user, including root. Many types of malware depend upon privilege escalation to allow them to read the contents of memory that they would not normally be able to access. This allows the malware to find and steal personal data such as account numbers, user ID, and stored passwords. Fortunately Linux protects against memory access by non-root users. It also protects against privilege escalation.  <\/p>\n\n\n\n<p>But even Linux security is not perfect. It is important to install security patches to protect against vulnerabilities that allow privilege escalation. You should also be aware of human factors such as the tendency people have to write down their passwords but that is all another article.<\/p>\n\n\n\n<p>You can now see that memory is also considered to be a file and can be treated as such using the memory device file.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Implications of Everything is a File<\/h1>\n\n\n\n<p>The implications of \u201cEverything is a file\u201d are far-reaching and much greater than can be listed here. You have already seen some examples in the preceding experiments, but here is a short list that encompasses those and more.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Clone hard drives.<\/li>\n\n\n\n<li>Back up partitions.<\/li>\n\n\n\n<li>Back up the master boot record (MBR) or the GUID Partition Table (GPT).<\/li>\n\n\n\n<li>Install ISO images onto USB thumb drives.<\/li>\n\n\n\n<li>Communicate with users on other terminals.<\/li>\n\n\n\n<li>Print PDF, ASCII text, and other files directly to a printer.<\/li>\n\n\n\n<li>Change the contents of certain files in the \/proc pseudo filesystem to modify configuration parameters of the running kernel.<\/li>\n\n\n\n<li>Overwrite files, partitions or entire hard drives with random data or zeros.<\/li>\n\n\n\n<li>Redirect unwanted output from commands to a null device, \/dev\/null, where it disappears forever.<\/li>\n\n\n\n<li>etc., etc., etc.<\/li>\n<\/ul>\n\n\n\n<p>There are so many possibilities here that any list can really only scratch the surface. I am sure that you have, or will,  figure out many ways to use this tenet of the Philosophy far more creatively than I have discussed here.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Summary<\/h1>\n\n\n\n<p>It is all part of the filesystem. Everything on a Linux computer is accessible as a file in the filesystem space. The whole point of this is to be able to use common tools to operate on different things \u2013 common tools such as the standard GNU\/Linux utilities and commands that work on files will also work on devices \u2013 because, in Linux, they are files.<\/p>\n\n\n\n<p>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<p>This is the complete list of all the articles in this series.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.both.org\/?p=6303\" target=\"_blank\" rel=\"noreferrer noopener\">What is the Linux Philosophy for SysAdmins?<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=6325\">Data Streams, the universal interface<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=6632\" target=\"_blank\" rel=\"noreferrer noopener\">Transforming Data Streams<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=6843\" target=\"_blank\" rel=\"noreferrer noopener\">Everything is a File<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=6982\" target=\"_blank\" rel=\"noreferrer noopener\">Use the Linux FHS<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=7030\" target=\"_blank\" rel=\"noreferrer noopener\">Embrace the CLI<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=7200\" target=\"_blank\" rel=\"noreferrer noopener\">Be the Lazy SysAdmin<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=7228\" target=\"_blank\" rel=\"noreferrer noopener\">Automate Everything<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=7547\" target=\"_blank\" rel=\"noreferrer noopener\">Always use shell scripts<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=7608\" target=\"_blank\" rel=\"noreferrer noopener\">Test Early, Test Often<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=7854\" target=\"_blank\" rel=\"noreferrer noopener\">Use common sense naming<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=8003\" target=\"_blank\" rel=\"noreferrer noopener\">Store data in open formats<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=8129\" target=\"_blank\" rel=\"noreferrer noopener\">Use separate filesystems for data<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=8226\" target=\"_blank\" rel=\"noreferrer noopener\">Make programs portable<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=8258\" target=\"_blank\" rel=\"noreferrer noopener\">Use Open Source software<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=7113\" target=\"_blank\" rel=\"noreferrer noopener\">Strive For Elegance<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=9194\">Find the simplicity<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=9780\">Use your favorite editor<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=9995\">Document everything<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=10054\">Backup everything frequently<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=10331\">Follow your curiosity<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=10804\">There is no should<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=10992\">Mentor the young SysAdmins<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=11039\">Support your Favorite Open Source Project<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.both.org\/?p=11057\" data-type=\"link\" data-id=\"https:\/\/www.both.org\/?p=11057\" target=\"_blank\" rel=\"noreferrer noopener\">Reality Bytes<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Author&rsquo;s note: This article is excerpted in part from chapter 5 of my book, The Linux Philosophy for<\/p>\n","protected":false},"author":2,"featured_media":3182,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[90,5,477],"tags":[173],"class_list":["post-6843","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-in-depth","category-linux","category-linux-philosophy","tag-everything-is-a-file"],"modified_by":"David Both","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/6843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6843"}],"version-history":[{"count":36,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/6843\/revisions"}],"predecessor-version":[{"id":11087,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/6843\/revisions\/11087"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/3182"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}