ls command options
Here are the
command options and their descriptions:
ls -R: Generates a recursive listings
ls -F: Labels file types in listing with /, *, @
ls -t: Lists files in order of modification time
ls -u: Lists files in order of access time
ls -g: Includes information on group of files
ls -a: Includes hidden files in the listing
ls -l: Generates a long format listing
A special file is a file that has no associated storage but can be used to gain access to a device. The goal here is to be able to access a device using the same mechanisms by which regular files and directories can be accessed.
Thus, callers are able to invoke open(), read(), and write() in the same way that these system calls can be used on regular files.
One noticeable difference between special files and other file types can be seen by issuing an ls command as follows
$ ls -l /dev/vx/*dsk/homedg/h
brw------ 1 root root 142,4002 Jun 5 1999 /dev/vx/dsk/homedg/h
crw------ 1 root root 142,4002 Dec 5 21:48 /dev/vx/rdsk/homedg/h
In this example there are two device files denoted by the b and c as the first character displayed on each line. This letter indicates the type of device that this file represents. Block devices are represented by the letter b
while character devices are represented by the letter c. For block devices, data is accessed in fixed-size blocks while for character devices data can be accessed in multiple different sized blocks ranging from a single character upwards.
Device special files are created with the mknod command as follows:
mknod name b major minor
mknod name c major minor
For example, to create the above two files, execute the following commands:
# mknod /dev/vx/dsk/homedg/h b 142 4002
# mknod /dev/vx/rdsk/homedg/h c 142 4002
The major number is used to point to the device driver that controls the device, while the minor number is a private field used by the device driver. The mknod command is built on top of the mknod() system call:
int mknod(const char *path, mode_t mode, dev_t dev);
The mode argument specifies the type of file to be created, which can be one of the following:
S_IFIFO. FIFO special file (named pipe).
S_IFCHR. Character special file.
S_IFDIR. Directory file.
S_IFBLK. Block special file.
S_IFREG. Regular file.
The file access permissions are