POSIX is an IEEE standard that acts as a standard UNIX version. It is a consortium of vendors that helps users easily port applications across different platforms. POSIX is considered a subset of UNIX and is used to cover different Unix-like environments for many other operating systems. POSIX initially contained different environments, such as Eunice for Virtual Machines, POSIX Personality, and NT from Windows OS. POSIX is portable between different variants of UNIX. In general terms, we can call POSIX as an operating system of UNIX.
Linux and GNU Project are quite like UNIX and are therefore compatible with one another. UNIX is an operating system that acts as a multi-tasking and multi-user operating system. UNIX comes with various program development tools, as well as electronic mail, text editors, etc. Many operating systems are like UNIX and have the same UI, programs, and functions. It was initially a networking operating system. UNIX was developed by a team of developers, but any other person can easily contribute to Linux and use it according to their needs.
UNIX has a trademark and is primarily used for commercial purposes. UNIX has its own flexibilities, but there is one rather famous drawback, which is that UNIX contains some hardware restrictions. Nonetheless, UNIX is a full-fledged operating system.
Software engineers and other users who work on operating systems understand that they need to interact with the command-line/terminal window of the system many times. A shell is also a powerful command-line interface, and POSIX contains a famous bash shell. In the next section, we will look at some famous POSIX commands and the purposes of these commands.
To specify the file and directory paths, use the “/” to separate directory names and filenames in the path. The following are a few sample names of paths:
|/example/default||A file named as default in the /example directory|
|~||The shortcut used to access current user’s home directory|
|~/someExample||A file or directory named someExample located in the user’s home directory|
|.||Leads to the current working directory|
|..||Leads to the parent directory|
POSIX File System
The POSIX shell helps to manage several functions from one window. Users can navigate around their current location, their current working directory, and the absolute working directory (home directory).
Suppose that the present working directory is the home directory (e.g.: “/home/<user_name>”), and this directory has a subdirectory named “example.” You can use the command-line to specify this path as an absolute path (“/home/<user_name>/example”), as well as a relative path (“example”). POSIX programs executed from the shell are also aware of the working directory when declared correctly. In this section, we will cover a few sample commands and options that can be used in POSIX to move files.
|pwd||Shows the current working directory|
|cd||Changes the current directory to the home directory|
|cd /etc/example||Changes the current directory to /etc/example|
|cd new_directory||Changes the current directory to new_directory a sub-directory of your current directory|
|cd ..||Changes current directory to the home or parent directory|
|cd $temporary||Changes directory to the directory temporary|
Now, we will check out some of the basic UNIX commands. These commands are not part of UNIX itself, but they are used in multiple UNIX machines. There is one interesting thing to take note of here: if you make a typo or error while writing in UNIX, you can use the CTRL+U shortcut from your keyboard to easily cancel out the whole line. Users can also edit these commands, which is quite easy and adaptive. Remember that UNIX is case sensitive, so make sure to take into account such requirements when trying out these commands.
The first set of commands that we will discuss is files.
|ls||To list your files, you can also use ls -l to list your files in a ‘long format’ that contains a lot of information, e.g., the precise size of the file, who is the file owner, what are the rights, and who altered the file last. ls -a lists all the files, including those whose names start with a dot, mostly are not easily visible.|
|more NameOfFile||Displays and shows the first part of file|
|emacs NameOfFile||An editor that allows you to create and edit files.|
|mv NameOfFile1 NameOfFile2||Used to move a file by giving it a different name or by moving it to another directory.|
|cp NameOfFile1 NameOfFile2||Used to copy the content of File 1 to File 2|
|rm NameOfFile||Used to remove files. You can also use rm -i, which will ask for the permission of the user before deleting any files.|
Directories in UNIX
The following section shows you how to use and create a directory in UNIX. The following are some of the commands used for this purpose:
|mkdir NameOfDirectory||Used to make a new directory. Type the name of the new directory next to mkdir|
|cd NameOfDirectory||Used to alter the path of the directory. Users can go back by one directory using cd, and they can also return to the parent directory using cd.|
|pwd||Returns the information of the directory in which the user is located currently.|
This article covered some of the basic differences between POSIX and UNIX, including some of the commands used in each. As can be seen from the above examples, there is no major difference between the commands used for POSIX and UNIX. POSIX is just a shell, whereas UNIX is a legacy OS.