Learning UNIX – Series I


Learning UNIX

Introduction: UNIX is one of the most popular and reliable OS. So, learning UNIX is very important for the developers. Specially, learning the commands and concepts of the UNIX OS is very important. In this series, we have tried to summarize the important concepts of UNIX and their usage. Hope you will enjoy reading this. We will come up some more series to cover other asserts of UNIX OS.

1: What is UNIX?

Answer: UNIX is an operating system. Operating system consists of programs that act as a link between the computer and the end user.

2: What are the different UNIX variants available?
Various UNIX variants available in the market are Solaris UNIX, AIX, UP UNIX, BSD etc.

3: What are the three parts in UNIX operating system?
Three parts are kernel, standard utility programs and the system configuration files.

4: What is kernel?
Answer: The kernel is the core of the UNIX operating system. It interacts with the hardware, manages memory, schedule tasks and also does the file management. 

5: What is shell?
The shell is a utility that processes user requests. The shell interprets the command and calls the program requested by the user. 

6: What are Commands and Utilities?
There are various command and utilities available for day to day use. Few examples are like cp, mv, cat and grep etc. 

7: What are Files and Directories in UNIX?
All data in UNIX is organized into files and files are again organized into directories. These directories are organized into file system.

8: How do you bootup UNIX system?
When you turn on the power, the system starts booting up automatically and prompts you for log in.

9: How do you list out all the files or directories?
Use ls command to list out all the files or directories.

10: What does ‘whoami’ command do?
This command basically lists the associated account name with the current login.

11:  Name some UNIX commands to shutdown the system.
Some commands are ‘halt’, ‘poweroffand ‘shutdown.

12: What are the three different files available in UNIX?
Three different files are Ordinary Files, Directories and Special Files.

13: Which file is used to access hardware?
Special files are used to access hardware such as hard drives, CD-ROM drives, modems etc.

14: What are Meta characters in UNIX?
UNIX recognizes certain special characters as command directives. These special characters are known as ‘meta characters’ like ‘*’,’?’ etc.

15: What are hidden files in UNIX?
UNIX uses most of these hidden files to store configuration information.

16: Which editor is most commonly used in UNIX to create file?
The ‘vi’ editor is used to create ordinary files on any UNIX system. You simply need to give following command:

[User]$ vi filename

17: Which command is used to display content of a file?
The ‘cat’ command is used to see the content of a file. Following is the simple example to see the content of a file.

[User]$ cat filename

18: What are the three streams in UNIX?
Answer: Three streams are stdin (referred to as standard input), stdout (referred to as standard output) and stderr (referred to as standard error).

19: What is ‘Home Directory’?
This is the directory where you will find yourself when you first login.

20: What are the different types of permissions available for a file in UNIX system?
The three permissions are ‘Owner permissions’,’ Group permissions’ and the ‘Other (world) permissions’.

21: What are the different access modes in UNIX?
There are three access modes available in UNIX.
Read (Grants the capability to read)

Write (Grants the capability to modify/remove the content of a file)

Execute (Grants to run a file as a program)

22: Which command is used to change the file/directory permission?
Answer: The ‘chmod’ (change mode) command is used to change the permission. There are two ways to use chmod symbolic mode and absolute mode.

23: Describe the commands to change the owner/group of a file.
Answer: The ‘chown'(change owner) command is used to change the owner of a file. And ‘chgrp'(change group) command is used to change the group of a file.

24: What is ‘.profile File’ in UNIX?
Answer: The ‘.profile’ file is maintained by the system administrator of the UNIX machine. It contains all the shell initialization information required by all users on that system.

25: What are PS1 and PS2 variable?
Answer: The characters that the shell displays as your command prompt are stored in PS1 variable and the default secondary prompt’ >’ (the greater than sign) is stored in PS2 variable.

26: Which UNIX command is used to do the minor formatting of files?
Answer: The ‘pr’ command is used to do the minor formatting of files on the terminal screen or for a printer.

27: When do you use ‘lp’ and ‘lpr’ Commands?
The command ‘lp’ or ‘lpr’ is used to print a file on paper as opposed to the screen display.

28:  Can we use UNIX command to send email?
UNIX ‘mail’ command is used to send and receive email.

Here is the syntax to send an email:

[User]$mail [-s subject] [-c cc-addr] [-b bcc-addr] to-addr

29: What is ‘pipe’ in UNIX?
In UNIX ‘pipe'(|) can be defined as a connector between two or more commands. It is used so that the output from one program becomes the input of the next program.

30: What is ‘filter’ in UNIX?
Some time a program takes its input from one program, performs some operation on that input, and then writes the result to the standard output. This is known as ‘filter’.

31: What is ‘grep’ Command?

Answer: The ‘grep’ command is used to search a file or files for lines that have a certain pattern. The simplest use of grep is to look for a pattern consisting of a single word.

32: What does ‘sort’ command do?
The ‘sort’ command is used to arrange lines of text alphabetically or numerically.

33: What are the two ways to run a process in UNIX?
The two ways to start a process (run a command) are ‘Foreground Processes’ and ‘Background Processes’

34: How do you stop a process in UNIX?
A process can be stopped in various ways. Sending a CTRL + C keystroke (the default interrupt character) will exit the command but it works when the process is running in foreground mode. If a process is running in background mode then first you need to get its Job ID using ‘ps’ command and then use ‘kill’ command to kill the process.

35: What is ‘Zombie’ process?
Some time even after killing a process, a ‘ps’ listing may still show the process with a Z state. This is a zombie, or defunct, process which means the process is dead and not being used.

36: What is ‘Daemon’ process?
System related background processes are known as ‘Daemons’. These processes are run with the permissions of root and services requests from other processes.

37: What is ‘top ‘command?
The ‘top’ command is a very useful tool. It quickly shows processes sorted by various criteria.

38: What is ‘Job ID’ and ‘Process ID’?
The ‘Job ID’ is used to manipulate background and suspended processes. This number is different from the process ID and is used because it is shorter.

39: What is ‘ping’ utility?
The ‘ping’ command is used to send an echo request to a host available on the network. Using this command you can check if your remote host is responding well or not.

40: What is ‘ftp ‘ utility?
Answer: The command ‘ftp’ stands for ‘File Transfer Protocol’. This utility is used to upload and download your file from one computer to another computer.

41: What is ‘telnet’ utility?
The ‘Telnet’ utility is used to allow a computer user at one site to make a connection, login and then conduct work on a computer at another site.

42: What is ‘finger’ utility?
The ‘finger’ command is used to display information about users on a given host which can be either local or remote.

Sometime ‘finger’ is disabled on other systems for security reasons.

43: What is ‘VIM’?
Answer: There is an improved version of ‘vi’ editor available which is called VIM. Here VIM stands for ‘Vi Improved’.


Tagged on: , ,
============================================= ============================================== Buy TechAlpine Books on Amazon
============================================== ----------------------------------------------------------------

Enjoy this blog? Please spread the word :)

Follow by Email