Unix Shell and Properties

Unix Shell and Properties

Unix Shell and Properties
Whenever a user wants to run a program they can open a general purpose shell window and run the program under this shell.
For example a user using the Bash shell wanting to switch to csh (C shell) due to being more familiar with it can do so using the following command:

Use > or >> to write the output of the command to a file.
Example: Running the following code, while in a folder, creates a file that has the same name as the folder’s processes. The contents of the file would be the output of the ps auxw command.
There wouldn’t be any output onto the screen as the entire output would be written to the file.

After logging on to the system, the shell automatically defines a folder’s environmental variables.
The list of environmental variables can be output using the printenv command: $printenv
Auditing accesses to files and folders
The chown folder is useful for changing the folder’s ownership. The following code can be used to change the ownership.

chgrp can be used to change the group that a user is connected to. The following code can be used to achieve this.

* Using a chmod program to give a u+s privilege identifier before granting a program a SUID (set user ID) privilege.

In a way similar to SUID, it might be necessary to grant some programs temporary user group membership in order to run them.
An example of this is some software related to printer services requiring this.
Using the chmod program to grant a g+s privilege identifier before granting a SGID (set group ID) privilege.

Defining a link.

The above code defines an alternative access route for a file using /reports/january-sales.txt, called /best-sellers/2001-january.txt.
After applying the above definition, even if one of these file names is deleted the file will remain accessible until the other filename has been deleted. However deletion of the last hard-link will result in the file being linked to also being deleted.
-rwxr-sr-x 1 root root 512540 Aug 22 19:46 /bin/bash
The following code defines a hard-link to a file named php.ps:

Soft-links are a type of link file that can be defined by any system user and are easier to understand and manage. They also allow access to a present file through a variety of routes.
The difference between soft and hard links is: when a soft-link is deleted the original file remains and if the original file is deleted, the soft-link remains but doesn’t point to anything.
A soft-link can be created by using the -s parameter as shown in first line of the following example: