Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mknod(5) [hpux man page]

mknod(5)							File Formats Manual							  mknod(5)

NAME
mknod.h - header file of macros for handling device numbers SYNOPSIS
DESCRIPTION
The header file defines macros to create and interpret device identification numbers for use with the system call (see mknod(2)). The use of these macros is architecture-dependent. See the System Administration Manual for your system for information on how to select major and minor device numbers. contains the macro which packs the major and minor components into a device identification number suitable for the dev argument of and the two macros: which extract the major and minor number components, respectively, from a device identification number, dev. The macro is a specification (see printf(3S)) that prints the minor number in the format best suited to the particular implementation; it is used by the long format of the command (see ls(1)) to show the minor numbers for device files. The base of the number is indicated in the same way as in the C programming language: no leading zero for decimal, leading zero for octal, and leading for hexadecimal. SEE ALSO
ls(1), mknod(1M), mknod(2), printf(3S). mknod(5)

Check Out this Related Man Page

mknod(8)						      System Manager's Manual							  mknod(8)

NAME
mknod - Creates a special file SYNOPSIS
/usr/sbin/mknod special_file [ b major_device# minor_device# | c major_device# minor_device#] /usr/sbin/mknod filename p DESCRIPTION
The mknod command makes a directory entry. The first argument is the name of the special device file. Select a name that is descriptive of the device. The mknod command has two forms. In the first form, the second argument is the b or c flag. The last two arguments are numbers specifying the major_device, which helps the operating system find the device driver code, and the minor_device, the unit drive, or line number, which may be either decimal or octal. The assignment of major device numbers is specific to each system. You can determine the device numbers by examining the conf.c system source file. If you change the contents of the conf.c file to add a device driver, you must rebuild the kernel. In the second form of mknod, you use the p flag to create named pipes (FIFOs). Only the superuser can create a character or device special file. FLAGS
Indicates that the special file corresponds to a block-oriented device (disk or tape) Indicates that the special file corresponds to a character-oriented device Creates named pipes (FIFOs) EXAMPLES
To create the special file for a new drive, /dev/disk/dsk20, with a major device number of 1 and a minor device number of 2, enter: mknod /dev/disk/dsk20 b 1 2 This command creates the special file, /dev/disk/dsk20, which is a block special file with major device number 1 and minor device number 2. To create a pipe named fifo, enter: mknod fifo p This command creates the pipe fifo, which is not necessarily in the current directory. FILES
Specifies the command path Specifies the system device numbers specification file delim off mknod(8)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mknod

Can someone please tell me what the command mknod does and what it's syntax is? I can't find it in my "Unix for dummies" book or "Unix in s nutshell". I found it in an existing script that I want to copy, but I want to understand what I am doing. The script is going to do a full export of an... (3 Replies)
Discussion started by: bemeeks
3 Replies

2. Shell Programming and Scripting

printf format

hi, i would like to extract the header and put it in a variable, then use printf to output the variable, but i keep on getting errors...please tell me if my format is incorrect. HDR = "`ps -e -o user,pid,ppid,pcpu,stime,etime,time,comm | head -n 1`" printf (%s, $HDR); thanks! (3 Replies)
Discussion started by: laila63
3 Replies

3. Solaris

major & minor number

Hi Can anyone tell me what is major number and minor number in the mknod command. Also what these numbers mean. I have gone through the man pages but still I couldn't understand. Regards (3 Replies)
Discussion started by: RajaRC
3 Replies

4. HP-UX

recreating /dev/null

Something (I'm still trying to find out what) has clobbered our /dev/null and made it into an ordinary file. I know I need to recreate it with mknod, but I'm unsure what the major and minor device numbers should be - I know enough to know that they vary on different systems and I've seen 1 3, 2 2,... (4 Replies)
Discussion started by: pblake1
4 Replies

5. HP-UX

Mknod

Hey guys i dont quite understand mknod, can anyone explain it to me and what is its purpose in LVM. (4 Replies)
Discussion started by: sbn
4 Replies

6. Shell Programming and Scripting

Add leading zeroes to numbers in a file

Hello, I am (trying) to write a script that will check to see how many users are logged on to my machine, and if that number is more than 60 I need to kill off all the oldest sessions that are over 60. So far I have been able to check how many users are on and now I am at the part where I have to... (3 Replies)
Discussion started by: raidzero
3 Replies

7. UNIX for Dummies Questions & Answers

Compilation program

Hi, I'm new to HP-Unix programming; I have a few programs, don't know the programming language used. I have to make minor changes and to recompile the source code. How do I find the programming language used and the compiler? Thanks, Nick. (3 Replies)
Discussion started by: NicoMan
3 Replies

8. Shell Programming and Scripting

Add leading zero's to the number in unix

Hi, Can anyone help me how to add leading zero's (0's) infront of numbers in unix script. For more details. x=450 Y=2344 i want the out put of 00000450, 000002344 (leading 5 zeros) Thanks A. Raj. (8 Replies)
Discussion started by: easterraj
8 Replies

9. UNIX for Dummies Questions & Answers

printf formatting

Is there a way to make these 2 numbers - $482477.37 and $1875000.00 look like $482,477.37 and $1,875,000.00 with printf? (4 Replies)
Discussion started by: nickg
4 Replies

10. UNIX for Dummies Questions & Answers

Extract numbers from .txt file

I need to extract all the p-value numbers and the rho numbers from a .txt file and write them as coma separated values in a new file. Ideally I would get two files in the end, one for p- values and one for rho. Any suggestions? I appreciate your help!!! The .txt file looks essentially like this... (5 Replies)
Discussion started by: eggali
5 Replies

11. Programming

get ID number from one string name by using awk

Hi guys, I am new to unix shell scripts. I have a file-A.txt which contained several names in "ABCo12345678.gz_to_ABCn12345678.gz" format. I want to extract the numbers in a "for" loop that means I can not use cut -c6-13 A.txt.Dose anyone know how to do it by using awk? Thank you so much. ... (4 Replies)
Discussion started by: shrimpj
4 Replies

12. Shell Programming and Scripting

How to get the number series in between?

Hi Guys, Can someone give me a simple script that can extract the numbers in between numbers from start to end. As shown below, it start from 100 to 110 and revealed the numbers in between. INPUT: 100 - 110 DESIRED OUTPUT: 100 101 102 103 104 105 106 107 (6 Replies)
Discussion started by: pinpe
6 Replies

13. Shell Programming and Scripting

Use one loop to handle below code

mknod /dev/vda b 253 0 mknod /dev/vda1 b 253 1 mknod /dev/vda2 b 253 2 mknod /dev/vda3 b 253 3 I know below code is ease to handle, but I don't know above code mknod /dev/vda1 b 253 1 mknod /dev/vda2 b 253 2 mknod /dev/vda3 b 253 3 (3 Replies)
Discussion started by: yanglei_fage
3 Replies

14. UNIX for Advanced & Expert Users

Help using awk with a text file

Basically I have a text file that is made up of customer statements. I want to be able to separate the customer statements into their own file. The file is consistant in that the account # (part of the key) is always on line 10 then on every 55th line from there on out so my logic would be like: ... (17 Replies)
Discussion started by: ziggy6
17 Replies

15. UNIX for Beginners Questions & Answers

Substr with % - extract numbers only

# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.5 (Maipo) I have this script that will monitor filesystems and send me e-amil alerts. #! /bin/ksh DIST_LIST=monitor@...com WORKDIR=/home/monitor WARNLEVEL=90 MAIL_SUBJ="filesystems monitor on "$(hostname) ... (3 Replies)
Discussion started by: danielshell
3 Replies