Basic Administration Commands - Basic Objects

From the technical side the Unix Administrators job is to work with the basic objects within Unix, so it is important to understand what these are.
files Files serve many functions in Unix. They are where both data and programs are stored. Every file has certain attributes: 3 dates, a user and group who own it and a set of permissions.  There are many types of special file on Unix: directories, links, devices, FIFOs and sockets.  File manipulation commands include: ls, rm, touch, chmod, chown, chgrp, find, ln, mkdir.

files - Files serve many functions in Unix. They are where both data and programs are stored.  Every file has certain attributes: 3 dates, a user and group who own it and a set of permissions.  There are many types of special file on Unix: directories, links, devices, FIFOs and sockets.  File manipulation commands include: ls, rm, touch, chmod, chown, chgrp, find, ln, mkdir.

processes - A process is the basic unit of program execution in Unix. Process may be in several states — running, ready to run, waiting for data or suspended. The “load” on a Unix box is the average number of processes running or ready to run.  Each process has a user and group to which it belongs. This determines two things: first what files the process may access and second who may send signals to the process. Signals can kill, suspend, restart a process or notify it of some event.  Typically processes on a Unix machine are either providing some service (dæmons), or belong to users. Many processes are created during the boot procedure. These process then create any other needed processes by forking.  If a process is connected to a terminal then certain key presses can cause signals. The most common of these are ctrl-C to kill, ctrl-Z to suspend and ctrl-n to abort.  Process manipulation commands include: ps, kill, nice, renice.

devices - One type of Unix special file is the device. Devices correspond to services within the Unix kernel, and often represent disks, tapes and serial ports.  These special device files usually reside under the /dev directory, but can be made anywhere in the file system. Each device has two numbers which connect it with the service in the kernel - these are referred to as the major and minor device numbers. The naming of devices within /dev is not standard across different versions of Unix.  Device files have attributes just like normal files, and their permissions should be set accordingly.  Section 12 of the DRS/NX manual talks a little about devices, their naming and the major and minor device numbers.

users & groups - Users and groups are not really fundamental Unix objects, beyond each process and file having an associated user and group. The Unix kernel knows nothing of user names and group names and treats each user and group as a number—the user ID (uid) and group ID (gid).

However Unix utilities such as ls or ps have used user names instead of numbers — as this is easier for people to deal with.  The mapping of names to numbers is usually done in the /etc/passwd and /etc/group files. These files also provide other information which are useful to Unix utilities (eg.
Home directory, shell) and to people (eg. Users real name). For the normal running of a Unix system an uncorrupted /etc/passwd is essential.

file system layout - The standard Unix file system layout is also not a fundamental Unix object, but is essential for the normal operation of a Unix system. This layout is not completely standard across all Unix systems, but there is usually a strong degree of agreement.
/bin Essential commands
/dev Devices
/etc Configuration files and boot scripts
/sbin Essential system commands
/home Home directories for users and projects
/mnt Tempery file system mount point
/proc Special process monitoring file system
/tmp Scratch/Scratch files
/usr/bin Non-essential user commands
/usr/include Header files for compilers
/usr/lib Shared and static libraries
/usr/local Like /usr, but for local software
/usr/sbin Non-essential system commands
/usr/share Files that can be shared between machines
/usr/share/man Manual pages (sometimes /usr/man)
/var Files specific to this machines running
/var/spool Spool space for mail, printers, periodic jobs
On older systems /var and /usr/share may be merged into /usr and sbin directories
merged into etc and bin directories.

privilege - The privilege system in Unix is quite simple. Generally a process may only access a file if it is in the running as the user or is in the correct group. The only exception is if the uid is zero. This usually corresponds to the user name root.  Root has other privileges — the ability to send a signal to any process, the ability to run certain system calls (eg. reboot), the ability to change to any uid and the ability to make certain network connections.  Privilege is gained in Unix by running a program with the set user ID attribute (suid).  These programs usually perform whatever privileged action is needed and then discard their privilege by switching to another uid.  To get a shell which is running as root, the su program is usually used. This is considered better than logging straight in as root, as it logs a message saying who became root.

Unix Tips

See Also
Using The Tail Command

Have a Unix Problem
Unix Forum - Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.