Translate

Archives

On-disk File Timestamps

The Single Unix Specification, Base Definitions (XBD), Section 4.8 entitled “File Times Update” states “An implementation may update timestamps that are marked for update immediately, or it may update such timestamps periodically.” This means that, for example, that file read and write operations are free to set the appropriate flags in the in-memory structures and do the actual updating of the on-disk filesystem structures at a later time. Assuming periodically means from time to time, it implies that a POSIX-compliant operating system is free to update it’s on-disk structures when it is convenient for the operating system to do so.

Sudo and Globbing

The question is how we can use the sudo utility to display a list of files in a directory to which we have absolutely no Unix filesystem privileges Consider the following directory and files contained therein: $ ls -l total 4 drwxrwx—. 2 root root 4096 May 22 21:14 demo $ su Password: XXXXXXXX # ls -l demo total 0 -rw-r–r–. 1 root root 0 May 22 21:14 file1 -rw-r–r–. 1 root root 0 May 22 21:14 file2 -rw-r–r–. 1 root root 0 May 22 21:14 file3 # exit exit Note the directory permissions are 770 and the user and

Unix Domain Sockets

Unix domain (UD) sockets are an inter-process communication (IPC) mechanism that allows bidirectional data exchange between processes running on the same platform. They are sometimes called local sockets. Communication occurs entirely within the operating system kernel. The closest IPC mechanism to a UD socket is probably a Unix pipe or a Linux Netlink socket. Note that the term domain in UD has nothing to do with DNS, NIS, LDAP, or Active Directory, and instead refers to the file system. A UD socket is uniquely identified by a filesystem pathname. Obviously, both processes have to agree on the pathname for them

The Syslog Protocol

I have used syslog for over 30 years now but other than knowing that it uses UDP and port 514, I have never looked at the underlying protocol in any detail. Syslog is standardized by the IETF in RFC 5424 This document describes the syslog protocol, which is used to convey event notification messages. This protocol utilizes a layered architecture, which allows the use of any number of transport protocols for transmission of syslog messages. It also provides a message format that allows vendor-specific extensions to be provided in a structured way. This RFC does not define any transports. They

Difference between [ and [[ in Shell Scripts

Many shell script writers are aware that [ is a synonym for the test command (See the test(1) man page) but few are fully aware of the actual differences between [ and [[. The test command implements the portable syntax specified by the IEEE Std 1003.1-2008 (POSIX) standard. In most shells (older Bourne shells being the main exception), [ is a synonym for test (but requires a final argument of ]) and is a shell builtin. In addition, there is usually an external executable of that name, e.g. /bin/[ or /usr/bin/[. The IEEE 1003.1-2008 standard (POSIX) defines a mandatory feature