🖥️mknod

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the mknod command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ███╗   ███╗██╗  ██╗███╗   ██╗ ██████╗ ██████╗ 
#                ████╗ ████║██║ ██╔╝████╗  ██║██╔═══██╗██╔══██╗
#                ██╔████╔██║█████╔╝ ██╔██╗ ██║██║   ██║██║  ██║
#                ██║╚██╔╝██║██╔═██╗ ██║╚██╗██║██║   ██║██║  ██║
#                ██║ ╚═╝ ██║██║  ██╗██║ ╚████║╚██████╔╝██████╔╝
#                ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝ ╚═════╝ 
                

                                                            
mknod /dev/random c 1 8
# make a device

mknod pipe p
# mknod device-name device-type major-number minor-number is the command used to create device files

# create /dev/null if accidentally deleted or for a chroot
mknod -m 0666 /dev/null c 1 3

# This is sample output - yours may be different.
# - name: Mknod /dev/null to Chroot
    /bin/mknod -m 0666 /dev/null       c 1 3
# - name: Mknod /dev/random to Chroot
    /bin/mknod -m 0666 /dev/random     c 1 8
# - name: Mknod /dev/urandom to Chroot
    /bin/mknod -m 0666 /dev/urandom    c 1 9

mknod -m 0666 /dev/null_test c 1 3 
stat /dev/null_test

File: '/dev/null_test'
Size: 0  Blocks: 0 IO Block: 4096 character special file
Device: 6h/6d	Inode: 603  Links: 1 Device type: 1,3
Access: (0666/crw-rw-rw-) Uid: (0/ root) Gid: ( 0/ root)

# dont forget restorecon for selinux after creating
restorecon /dev/null

#==============================##==============================#
# CMD MKNOD						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░