this post was submitted on 22 Nov 2023
532 points (98.5% liked)
Linux
48122 readers
703 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The best part of working in a meat grinder startup were the Linux masters teaching you stuff like
or
What is /dev/pty23? From context, I assume another users terminal so it just spams garbage to their screen?
What OP said. But here's a more detailed answer courtesy of GPT-4:
Adding
cat /dev/random > /dev/pty23
to your.profile
would result in an interesting situation whenever you start a login shell.Behavior of the Command: The command
cat /dev/random
continuously reads random data from the/dev/random
device file, which generates an endless stream of random bytes. Redirecting this to/dev/pty23
means it attempts to write this data to the pseudo-terminal device/dev/pty23
.Impact on Shell Startup: When you add this to your
.profile
, every time you start a login shell (like when you open a new terminal session), it will execute this command. Since/dev/random
produces an endless stream of data, thecat
command will not terminate on its own. This means your shell will be stuck executing this command, and you won't get a prompt to enter new commands.Interactive Shell Issue: The shell remains technically interactive, but because the
cat
command doesn't complete, you won't get a chance to interact with it. The shell is effectively blocked by thecat
command continuously running.Potential Problems: There's a possibility that
/dev/pty23
might not exist on your system, or you might not have the permission to write to it. In such cases, the command would fail, but it would still block the shell if it doesn't exit properly.Fixing the Issue: To regain control of your shell, you might need to edit your
.profile
from a different context where it doesn't get executed, like using a non-login shell or booting into a recovery mode.In summary, it's a kind of a "prank" command that can render your login shell unusable until you remove it from your
.profile
. It's an example of how powerful shell startup scripts can be, and also a reminder to be cautious about what gets added to them!Please don't spam gpt rubbish
Imagine someone adding this to your .profile