tidy up links and formatting

This commit is contained in:
Thomas Bishop 2025-12-19 18:38:12 +00:00
parent d72ec5c812
commit 08bbd8647f

View file

@ -8,7 +8,8 @@ tags:
Devices are hardware that require access to the CPU in order to function. Devices are hardware that require access to the CPU in order to function.
Devices can either be external and plugged-in or internal to the motherboard. Devices can either be external and plugged-in or internal to the motherboard.
The most common type of device that you will work with are [disks](Disks.md). The most common type of device that you will work with are
[disks](./What_are_disks.md)
Devices are files but they have some different capabilities than ordinaryq Devices are files but they have some different capabilities than ordinaryq
files. There are two types: **block** and **stream**. Device files reside in the files. There are two types: **block** and **stream**. Device files reside in the
@ -43,32 +44,37 @@ brw-rw---- 1 root disk 259, 3 Jun 4 11:00 nvme0n1p3
> Since device files are files we can interact with them using standard file > Since device files are files we can interact with them using standard file
> programs like `ls` and `cat`. > programs like `ls` and `cat`.
The The [mode](/zk/File_permissions_in_Linux.md) is different from ordinary files.
[mode](File_permissions_and_execution_in_Bash.md#what-the-output-means) Each device file is prepended with `b, p, c, s` before the standard permissions.
is different from ordinary files. Each device file is prepended with These stand for the major types of devices: _block, character, pipe_ and
`b, p, c, s` before the standard permissions. These stand for the major types of _socket_.
devices: _block, character, pipe_ and _socket_.
<dl> - block
<dt>block</dt> - Block devices transfer data as large fixed-size blocks. These are the most
<dd>Block devices transfer data as large fixed-size blocks. These are the most common device type and include harddrives and filesystems. As the data can be split up into discrete blocks of data, this facilitates quick random access from the kernel. </dd> common device type and include harddrives and filesystems. As the data can
<dt>character</dt> be split up into discrete blocks of data, this facilitates quick random
<dd>Character devices transfer data one character at a time.The data is not in discrete chunks, it is a continuous stream of characters. An example of a stream device file is a printer however many character devices (such as `/dev/null`) are not physically connected to the machine.</dd> access from the kernel.
<dt>pipe<dt> - character
<dd>Pipe devices allow two or more processes to communicate with each other. They work in the same way as character devices (transferring data as a stream) but instead of the output being sent to a device, it is sent to another process.</dd> - Character devices transfer data one character at a time.The data is not in
<dt>socket<dt> discrete chunks, it is a continuous stream of characters. An example of a
<dd>The same as pipe devices, facilitating communication between processes however they can communicate with many processes at once, not just a single process.</dd> stream device file is a printer however many character devices (such as
</dl> `/dev/null`) are not physically connected to the machine.
- pipe
- Pipe devices allow two or more processes to communicate with each other.
They work in the same way as character devices (transferring data as a
stream) but instead of the output being sent to a device, it is sent to
another process.
- socket
- The same as pipe devices, facilitating communication between processes
however they can communicate with many processes at once, not just a single
process.
## /dev/null ## /dev/null
`/dev/null` is a virtual device: it doesn't actually exist as a piece of `/dev/null` is a virtual device: it doesn't actually exist as a piece of
hardware on the system. It can be useful when hardware on the system. It can be useful when
[bash scripting](Redirect_to_dev_null.md) as a [bash scripting](Redirect_to_dev_null.md) as a place to direct output that you
place to direct output that you don't care about, for example errors or verbose don't care about, for example errors or verbose program read-outs.
program read-outs.
I like to think of `/dev/null` as being like earth in a circuit. It's an outlet I like to think of `/dev/null` as being like earth in a circuit. It's an outlet
to safely dispose of things you are not interested in. to safely dispose of things you are not interested in.
> ! Make notes on this. Base on : https://linuxhint.com/what_is_dev_null/