answersLogoWhite

0

📱

Unix

Unix is a family of operating systems primarily designed for servers, mainframes, and high-end workstations. First created in 1969, Unix systems are renowned for their security and stability.

1,127 Questions

Why unix is a multiprogramming os?

Those are two separate and totally unrelated concepts.

Linux and Unix are considered multi-user systems because they support separate user accounts with different levels of access privilege. A single-user system may have more than one "account", but there is no administrative difference between them.

Linux and most modern versions of Unix are multiprocessing operating systems because they support more than one processor in a system and can allocate processes to different processors.

How does vi editor work in unix?

The Linux 'vi editor' is an editor that is text based. It can be used like notepad in Windows based systems. It can also be used for editing configuration files.

Different types of file in unix?

Regular file

Text or binary data

Directory

Contains other files and directories.

Executable file

File with the "execute permission" set

Symbolic link

File is a "shortcut" that points to another file.

Device special file

An interface to a piece of hardware, such as a printer.(In UNIX devices are treated as "files")

Named pipe

An interface to a network program.

List of the unix based OS?

"Best" is often a matter of opinion, and can be highly subjective. Mac OS X, Solaris 10, AIX,and z/OS are the only major certified Unix operating systems still under development. Mac OS X is the most popular Unix desktop, and Solaris 10 is the most popular one on large servers.

What is the command to run a unix program?

Just type the name of the program. If you want to run the dump program, type dump. if you want to open the links web browser, type links. .....

Some programs take arguments, for example the cat program accepts one or more files as an argument, so you could call it by typing

$ cat file1 [file2, file3...]

Explain out put of the ls-l command?

If you mean the ls command in linux/unix, it is the command to list the contents of a directory. A 'ls -l' will display the complete information including the permissions, owners, size and when last modified in date and time.

e.g.

root\usr\sample $ ls -l

drwxr-xr-x 1 root root 4096 Nov 26 2007 sample.txt

root\usr\sample $ ll

drwxr-xr-x 1 root root 4096 Nov 26 2007 sample.txt

root\usr\sample $ ls

sample.txt

The output of the ls -l and ll command is in the following format. First of the 10 characters shows the type of the item (directory/file/link etc) and the remaining shows the permissions of root, user and group. Next is the number of directories, next is group to which the item belongs, next size of the dirctory/file, next the date on which the directory/file was last modified and the directory/file name.

In unix what does the wc command output?

wc is used to count the characters/words/lines in a file or files. You might use it to see how productive you've been (did you finish that 5000 word essay you were supposed to write) or to see how productive some one else has been...

The options control characters/words/lines: with no options it gives all three:

$ wc notes

56 219 1607 notes

There are 56 lines, 219 words, 1607 characters.

$ wc -l notes

56 notes

I just wanted to know how many lines.

What is difference between block special file and character special file?

A block special file that provides access to a device that transfers in groups of a fixed size. For example, a disk.

A character special file that provides access to a device that transfers in increments of a single character; for example, a terminal.

What are shell variables Give example?

A shell variable is a temporary location in memory that can be used to store and retrieve information.

For example, the following creates a shell variable and then prints it out:

stuff="Hi there"

echo $stuff

will echo out 'Hi There' to the screen. It has the words "Hi There" saved in a memory location called $stuff, which can be retrieved by its name.

What is grep in Unix?

Grep is a command line application that is used to search a file or files and extract data from it/them according to a pattern or filter if you prefer. Grep stands for global regular-expression. There are many versions of grep available and regular expressions (for pattern matching) are available in most modern scripting languages such as ruby, python, perl, php, vb, etc. Grep, ngrep, egrep, etc. are available for multiple platforms including windows. They are well documented and can be downloaded for free.

What command to change directory?

CD

Example:

CD <sub-directory>

Use

CD ..

to go up a directory.

You can also enter a full path to go straight to that directory. Eg:

CD windows/system/etc

What is the difference between soft links and hard links in UNIX?

Linux reference-counts each file and will only reclaim its blocks when the reference-count goes to zero, that is, when the last hard link is severed.

Consider this example:
$ date > foo
$ rm foo


Typically, you create a file, and it has a ref-count of 1 for its entire lifetime, and eventually we delete the directory entry, decrement the ref-count, and reclaim the inode and data blocks.

Now consider this example:
$ date > foo1
$ ln foo1 foo2
$ rm foo1
$ cat foo2

In this case, the 1st name disappears, but the original data are still available via the 2nd name. This will continue to be true even if we add and delete many names, and even if we move those names up and down the directory hierarchy within the same filesystem, as long as at least one reference remains. Deleting that last name will reclaim the inode and data blocks, too. If you are familiar with RDBMs, you might think of it in terms of referential integrity.


Soft links, on the other hand, have very little to do with all that. Here are two commands which bear some similarity to each other:

$ echo 'Go look at foo2' > bar
$ ln -s foo2 baz

The first offers human-readable instructions, while the second phrases those instructions in terms the filesystem understands. In both cases, if someone rm's foo2 we won't know about it until we "cat baz" or consult bar and notice that foo2 has been pulled out from under us. Symlinks are simple. There is no ref-counting and no guarantees of integrity when it comes to symlinks. That said, they are still enormously useful. Note that symlinks can cross filesystems, a feat which hard links were not designed to handle.

Which command is used to see the content of file?

You can get a list of all the files in the current directory with the "ls -a" command.

What are the options under ls command in Linux?

To see the full list of options for the ls command, type "ls --help".

Some of the more important options are:

* -a - show all files (do not hide files starting with .) * -h - human readable (e.g., show file size as 2K instead of 2048) * -l - long listing format (show much more information about each file) The options can be combined. For example "ls -lha".

[Note: I often need a long listing of all files with the most recently modified file(s) at the end of the listing so I frequently use the command:

ls -latr

to accomplish this task. JHM]

What are the precautions should be taken while logging in to the unix operating system?

When logging into any system on a computer, you should be very careful not to leave your log in information where it can be accessed. Always make sure you close out any page with your personal information before leaving the computer.

Write a shell script to read a text file delete the special symbols in it and save the file with a new file name?

You have mentioned "Shell Script", I assume you are working on Linux/Unix/Mac OS X environment.

I would suggest to use small utility which by default should be included in almost all above mentioned OS families. It is called sed (stream editor).

Here is how to use the utility:

sed -e 's/#//g' source_file.txt > destination_file.txt

What it does it changes all '#' to '' (removes it).

's///g':

* s - substitute * - standard regular expression * - symbol that will be as replacement. * g - global Here is a Bash Script: #!bin/bash

# Checking parameters number, we need two

if [ $# -ne 2 ]

then

echo "Wrong number of parameters, please try again."

exit 1

fi

# Checking to see if file actuall exists and it is readbale

if [ -e $1 -a -s $1 ]

then

# Calling sed program to find all '#' character and replace them with '' (empty),

# redirecting stdout (standard output stream) to file (second argument)

sed -e 's/#//g' $1 > $2

echo "Job done, please check " $2 " file."

else

echo "Missing file, please try again."

exit 2

fi

exit 0

First parameter of script should be input file and second one - output file.

Source File:

Word # Word

Word #

# Word

Destination File:

Word Word

Word

Word

To change more than one character you could use this regular expression:

s/[Word]/A/g

Same source file and destination would look like:

AAAA # AAAA

AAAA #

# AAAA

[All possible chars]; [Word] = { 'W' OR 'o' OR 'r' OR 'd' }

There are utilities like tr, that could be used for the same purpose.

What is the command to list all files in a directory?

ls (ie lower case LS)

In DOS: dir

If there are many files in the directory, type, "dir/p/o" ...this will stop the listing when the page fills up and list them in alphabetical order... press any key to continue to the next page of listed files.

If you're only interested in the name of the files (not the date/size etc.) you can add /B

Shell script that deletes all lines containing a specific word in one or more files?

Use the 'sed' command - it looks for a pattern and then you can 'delete' the line by preventing the input line from going to the output (sed is a filter program). For example,

sed -e '/word/d' file1 file2 file3 > file.out

will remove any line containing the word 'word' from the three files by not copying it to the output file 'file.out'

Which Linux command can you use to display a file in alphabetical order?

Generally the default behavior of the 'ls' command will list them in alpha order.

What are the components of a Unix file system?

Depending on how it's structured, usually a filesystem in any storage device will contain boot code (if it's set to run on start up especially if it contains a bootable operating system), a partition table, a file table (contains the addresses of each file and folder in the disk itself) , a journal (if it is a journaling system - to keep track of changes in case of a failure), their backups, and the actual data itself.

Where you can use Unix?

Unix can be used on a large number of mainframes, servers, and workstations. If you would like to use a certified UNIX system on commodity hardware, Solaris 10 can be downloaded free of charge for non-commercial use.

History of the UNIX operating system?

1970.

"As Ritchie summed up the effort, "Although it was not until well into 1970 that Brian Kernighan suggested the name 'UNIX,' in a somewhat treacherous pun on 'Multics,' the operating system we know today was born."

http://www.bell-labs.com/history/unix/almost.html