What is Unix / Linux?
What is Unix / Linux?
Unix operating system is a collection of programs that act as a link between a computer and a user.
Computer programs decentralize system resources and coordinate all the internal parts of the computer called the operating system or kernel.
Users communicate with the kernel via a program that is known as a shell. Shell is a command line compiler, it compiles commands entered by users and converts them into a language that the kernel can understand.
Unix / Linux was first developed by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Douglas Mclloy and Joe Ossanna.
There are many different Unix versions on the market. Solaris Unix, AIX, HP Unix and BSD are some examples. Linux is also a version of Unix which is free.
Many people can use a Unix computer at the same time; So Unix is called a multi-user system.
A user can run multiple programs at the same time; So Unix is called multitasking.
Unix / Linux structure
The following diagram is the structure of a Unix system:
The main concept that is unified in all Unix versions is the following four bases:
Kernel : Kernel is the heart of the operating system. It interacts with hardware and most tasks such as memory management, file management, and task scheduling.
Shell : Shell is a utility that handles your requests. When you type a command in your terminal, the shell compiles the command and calls the program you want. Shell uses standard syntax for all commands. C Shell, Bourne Shell and Korn Shell are the most well-known shells and are available in most Unix versions.
Commands and utilities : There are many commands and utilities that you can use in your daily work. cp, mv, cat and grep . are some examples of commands and utilities. There are more than 250 standard commands plus some other commands provided by the 3rd software. All of these commands come with its (functional) options.
Files and directories : All data in Unix is organized in files. All files are organized into folders. These directories are organized in a tree-like structure called the file system.
Boot the system in Unix / Linux
If you have a computer that has the Unix operating system installed on it, then you simply need to turn it on to boot the system.
As soon as you turn on the system, the system starts to boot and it eventually prompts you to log in to the system, which is used for daily activities.
Unix / Linux login
When you first connect to a Unix system, you often see a prompt like this:
login :
Log in to Unix / Linux system
- Get ready your user ID and password. Contact the manager if you don't have it yet.
- Enter the ID at the login prompt, then press Enter. Your ID is case-sensitive, so make sure you've entered it exactly as the manager instructed.
- Enter the password in the password box and press Enter. Your password is also case sensitive.
- If you provide the correct ID and password then you will be allowed to enter the system. You read through the information and announcements that appear on the screen as shown below:
login : amrood amrood 's password: Last login: Sun Jun 14 09:32:32 2009 from 62.61.164.73 $
You will be provided with a prompt (sometimes called the $ command) at which you will enter all your commands. For example, to check the calendar, you need to enter the cal command as follows:
$ cal December 2015 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 $
Change passwords in Unix / Linux
All Unix operating systems require a password to secure your data and files and also ensure the security of the system against hackers or crackers. Here are the steps to change your password:
- To start, write passwd at the command prompt as shown below.
- Enter the old password
- Enter the new password you want to change. Always keep the password as complex as possible so that no one can guess it. But make sure you remember it.
- You need to confirm your password by entering it again
$ passwd Changing password for amrood ( current ) Unix password : ****** New UNIX password : ******* Retype new UNIX password : ******* passwd : all authentication tokens updated successfully $
Note : I have placed a * in the location showing you where you need to enter the old and new password. Also at your system, it will not display any characters when you type in the password.
List directories and files in Unix / Linux
All data in Unix is organized into files. All files are organized into folders. These directories are organized into a tree structure called the file system.
You can use the ls command to list all the files or directories in a directory. Below is an example of how to use the ls command with the -l option .
$ ls - l total 19621 drwxrwxr - x 2 amrood amrood 4096 Dec 25 09 : 59 uml - rw - rw - r - 1 amrood amrood 5341 Dec 25 08 : 38 uml . jpg drwxr - xr - x 2 amrood amrood 4096 Feb 15 2006 univ drwxr - xr - x 2 root root 4096 Dec 9 2007 urlspedia - rw - r - r - 1 root root 276480 Dec 9 2007 urlspedia . tar drwxr - xr - x 8 root root 4096 usr - rwxr - xr - x 1 root root 3192 Nov 25 2007 webthumb . php - rw - rw - r - 1 amrood amrood 20480 Nov 25 2007 webthumb . tar - rw - rw - r - 1 amrood amrood 5654 Aug 9 2007 yourfile . mid - rw - rw - r - 1 amrood amrood 166255 Aug 9 2007 yourfile . swf $
Here, the results that begin with d . represent the directories. For example, uml, univ and urlspedia are directories and the rest are files.
Whoami command in Unix / Linux?
While you log into the system, you might be willing to know: Who am I?
The easiest way is to search for "who you are" and enter the whoami command :
$ whoami amrood $
Try it on your system. This command lists account names associated with the current login. You can try the whoami command also to get information about yourself.
Who is logged in Unix / Linux?
Sometimes you may want to know who logged into the computer at the same time.
There are 3 commands available to help you get this information, based on how much you want to know about other users : users, who and w.
$ users amrood bablu qadir $ who amrood ttyp0 Oct 8 14 : 10 ( limbo ) bablu ttyp2 Oct 4 09 : 08 ( calliope ) qadir ttyp4 Oct 8 12 : 09 ( dent ) $
Try the w command on your system to check the results. This command will list some information related to logins in the system.
Log out in Unix / Linux
When you have finished your session, you need to exit the program to make sure no one can access your files when they disguise you.
To exit the program:
- You just need to type the logout command at the command prompt, and the system will clean everything and disconnect.
Close the system in Unix / Linux
The most suitable way to close the Unix system is through using one of the following commands:
Command Description halt Close the system immediately. init 0 Close the system using a predefined script to synchronize and clean the system before shutdown. init 6 Reboot the system by closing the system immediately and then start again as before before closing the poweroff Close the system in poweroff reboot Reboot the system shutdown Close the systemYou must be the primary user to have the right to close the system, but sometimes the agent can do this.
According to Tutorialspoint
Last lesson: Function signal () in C
Next lesson: File Management in Unix / Linux
You should read it
- Basic file system in Unix / Linux
- System log in Unix / Linux
- Network communication utilities in Unix / Linux
- File Management in Unix / Linux
- Instructions for installing Unix / Linux
- Navigation IO in Unix / Linux
- Useful commands in Unix / Linux
- Signal and Trap in Unix / Linux
- Regular Expression in Unix / Linux
- Techniques cited in Unix / Linux
- Basic utilities: print, email in Unix
- User management in Unix / Linux