Reader small image

You're reading from  Mastering Bash

Product typeBook
Published inJun 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781784396879
Edition1st Edition
Languages
Right arrow
Author (1)
Giorgio Zarrelli
Giorgio Zarrelli
author image
Giorgio Zarrelli

Giorgio Zarrelli is a passionate GNU/Linux system administrator and Debian user, but has worked over the years with Windows, Mac, and OpenBSD, writing scripts, programming, installing and configuring services--whatever is required from an IT guy. He started tinkering seriously with servers back in his university days, when he took part in the Computational Philosophy Laboratory and was introduced to the Prolog language. As a young guy, he had fun being paid for playing games and write about them in video game magazines. Then he grew up and worked as an IT journalist and Nagios architect, and recently moved over to the threat intelligence field, where a lot of interesting stuff is happening nowadays. Over the years, he has worked for start-ups and well-established companies, among them In3 incubator and Onebip as a database and systems administrator, IBM as QRadar support, and Anomali as CSO, trying to find the best ways to help companies make the best out of IT. Giorgio has written several books in Italian on different topics related to IT, from Windows security to Linux system administration, covering MySQL DB administration and Bash scripting.
Read more about Giorgio Zarrelli

Right arrow

/dev/tcp and /dev/udp

If we look inside the /dev directory, we find lots of files that represent physical devices that can be hardware or not. These device files can represent partitions; loopback is used to access plain files as if they were block devices. ISO files, for example, can be mounted as if they were CD-ROMs. Some of this device files are quite unusual, but we have already heard of them, for instance, /dev/null, /dev/zero, /dev/urandom, /dev/tcp, and /dev/tcp.

These are called pseudo-devices, and they represent and provide access to some facilities. For instance, all this is moved or redirected to the /dev/null fall in a black hole and disappears, whereas /dev/urandom is a good way to get a random string when needed:

cat /dev/urandom | head -c 25 | base64
HwUmcXt0zr6a7puLtO1xyKMrAdZrRqIrgw==

With /dev/tcp or /dev/udp, we get access to a socket through which we can communicate...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering Bash
Published in: Jun 2017Publisher: PacktISBN-13: 9781784396879

Author (1)

author image
Giorgio Zarrelli

Giorgio Zarrelli is a passionate GNU/Linux system administrator and Debian user, but has worked over the years with Windows, Mac, and OpenBSD, writing scripts, programming, installing and configuring services--whatever is required from an IT guy. He started tinkering seriously with servers back in his university days, when he took part in the Computational Philosophy Laboratory and was introduced to the Prolog language. As a young guy, he had fun being paid for playing games and write about them in video game magazines. Then he grew up and worked as an IT journalist and Nagios architect, and recently moved over to the threat intelligence field, where a lot of interesting stuff is happening nowadays. Over the years, he has worked for start-ups and well-established companies, among them In3 incubator and Onebip as a database and systems administrator, IBM as QRadar support, and Anomali as CSO, trying to find the best ways to help companies make the best out of IT. Giorgio has written several books in Italian on different topics related to IT, from Windows security to Linux system administration, covering MySQL DB administration and Bash scripting.
Read more about Giorgio Zarrelli