UNIX
UNIX
UNIX is a portable operating system that is designed for efficient multitasking and multi-user
functions. Since it is a portable operating system, it can run on different hardware platforms.
It is written in C language. It was developed by Ken Thompson, Dennis Ritchie, Douglas
McIlroy, and Joe Ossanna.
UNIX supports the multiuser system: In UNIX it is possible that many users can use the
system with their separate workspace and logins i.e.it has full support for the multiuser
environment.
UNIX supports the multitasking environment: In UNIX many apps can run at a single
instance of time this is also known as a multitasking environment.
o Kernel- The kernel is also known as the heart of the operating system. Its fundamental
role is to interact with the hardware and also monitor major processes like memory
management, file management, and task scheduling.
o Shell- It is also called command prompt, it connects the user to the operating system,
whatever is typed by the user is translated into the language understood by the
command prompt, and then the corresponding actions are performed.
o Commands and Utilities- Many built-in commands help the user perform day to day
activities.mv,cat,cp,and grep etc. Some of the examples
o Directories- Every bit of data is stored in files, and these files are stored in directories,
these directories combine to form a tree-like structure.
6) What is filter?
A filter is a program that takes input from standard inputs and performs some operation on
that input to produce a result as standard output.
8) Is there any method to erase all files in the current directory, along
with its all sub-directories, by using only one command?
Yes, you should use "rm-r*" command for this purpose.
Here, the "rm" command is used for deleting files, the -r option will erase directories and
subdirectories with their internal data and * is used for selecting all entries.
o sh - Bourne shell
o csh - C Shell
o bash - Bourne Again Shell
o tcsh - enhanced C Shell
o zsh - Z Shell
o ksh - Korn Shell
ls -a In Linux, hidden files start with. (dot) Symbol and they are not visible in the regular dire
The (ls -a) command will enlist the whole list of the current directory including the hidde
ls -lh This command will show you the file sizes in human readable format. Size of the file is t
displayed regarding a byte. The (ls -lh)command will give you the data regarding Mb, G
ls -lhS If you want to display your files in descending order (highest at the top) according to the
can use (ls -lhS) command.
ls -l - -block-size=[SIZE] It is used to display the files in a specific size format. Here, in [SIZE] you can assign size
your requirement.
ls -g or ls -lG With this, you can exclude column of group information and owner.
ls -li This command prints the index number if the file in the first column.
ls -p It is used to identify the directory easily by marking the directories with a slash (/) line si
ls -lX It will group the files with the same extensions together in the list.
ls -lt It will sort the list by displaying a recently modified file at the top.
ls ~ It gives the contents of the home directory.
18) What are the links and symbolic links in a UNIX file system?
o A link is a second name for a file. Links are used to assign more than one name to a
file, but cannot be used to designate a directory more than one name or link filenames
on different computers.
Symbolic links are the files that only contain the name of another file. The operations on the symbolic
link are directed to the file pointed by it. Both the limitations of connections are eliminated in
symbolic links.
o halt
o init 0
o init 6
o power off
o reboot
o shutdown
o .profile
o .kshrc
o .rhosts
o .cshrc
27) What is the difference between a single dot and double dot in
UNIX?
.(Single dot)-represents the current directory
Type vi filename in command prompt to create new files. We can also use
the touch command to create a zero byte file.
$ cat filename
Where the cat is the command to view contents of the file specified by the filename. Also if
you want the line number to be displayed along with the content, you can use cat command
with option -b.
30) How to calculate the number of words in a file?
To count the number of words in a file, Use the following command.
$ wc filename
Where wc is the command to count the number of words in the file specified by filename.
$ touch filename
$ pwd
$ file filename
34) How to change the directory in UNIX?
To change the directory, you can use the cd command in the terminal window. It changes the
current directory to the specified directory.
$ cd directory-name
The -r is used to copy all the content of a directory including sub-directories recursively.
$ rm <filename>
we can use -r with the rm command to delete all the sub-directories recursively.
$ mkdir <directory-name>
39) How to remove the directory in UNIX?
To remove the directory, you can use the rmdir command. To use this command, use the
following syntax.
$ rmdir filename.