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

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

What is the difference between the cat and more commands in Unix?

Both the 'more' and the 'cat' commands will list the contents of one or more files. In that case, the main difference between the two commands is that 'more' is a 'pager' program, meaning that it stops at the end of every page and waits for the user. The 'cat' command will list everything in the file without stopping.

One other thing that 'cat' does that 'more' does not is to concatenate (add/merge) files together. 'more' is not designed to do that.

Lastly, some versions of 'more' can traverse a file forwards and backwards and have simple searching capabilities, which 'cat' does not.

What is the latest version of Linux Mint?

There is no one "current Linux operating system" due to the fact that Linux is developed and distributed in various forms by many different individuals and corporations. The current version of Linux depends on which of these "distributions" you are interested in installing.

For example, a popular distribution of Linux tailored for use as a Desktop system is Ubuntu (www.ubuntu.com), which is distributed by the company Canonical. The current release of Ubuntu is 8.04, which was released in April this year.

There are literally hundreds of distributions freely available online, but other distributions which are of note in the desktop arena include Fedora (www.fedoraproject.org), openSUSE (www.opensuse.org) and Debian (www.debian.org), each of which have their own advantages and disadvantages. Each distribution has its own release schedule, but you can find out what the current version is (and download it) from the official websites.

What is the difference between Sun Solaris and OpenSolaris?

Windows XP is a proprietary operating system from Microsoft while Solaris is a highly scalable UNIX operating system from Sun Microsystems. Solaris runs on SPARC-based and x86-based hardware. Although Solaris was originally developed as proprietary software most of it is now open source and can be downloaded for free.

What are the advantages to Unix hosting?

-It's super secure

-It's fast

-It's stable

-Significantly less risk of getting a virus/trojan

-It's very customizable

-Most Linux distributions don't take much of memory.

What is the purpose of the more parameter at the end of the command line?

The command, help xcopy |more, List information one screen at a time when using a command line to get help about a command line

I believe the author of this is question is referencing question #28 on Reviewing the Basics for Chapter 13 of 'Guide to Managing and Maintaining Your PC' 7th Edition by Jean Andrews.

Answer I came up with:

The parameter |more, when used with other commands, requires the user to respond to a prompt at the end of a fully displayed screen of text that signals the next line of text to be displayed to the user.

Write a unix program for Fibonacci?

fibo()

{

num=${1:-100}

n2=1

n1=0

while n=$(( $n1 + $n2 )); [ $n -le $num ]

do

printf "%d " "$n"

n1=$n2

n2=$n

done

echo

}

## The loop continues until the user enters a valid number

while :

do

printf "Enter a number: "

read number

case $number in

*[!0-9]* | "") printf "\a*** Invalid number ***\n" >&2 ;;

*) break ;;

esac

done

fibo "$number"

Which are the various available versions of UNIX?

According to their website, there are exactly 30 versions in existence.

http://www.unix.com/unix-dummies-questions-answers/28637-versions-unix.html


There are many different versions of UNIX. Until a few years ago, there were two main versions: the line of UNIX releases that started at AT&T (the latest is System V Release 4), and another line from the University of California at Berkeley (the latest version is BSD 4.4). Some other major commercial versions include SunOS, Solaris, SCO UNIX, AIX, HP/UX, and ULTRIX. The freely available versions include Linux and FreeBSD.

Many versions of UNIX, including System V Release 4, merge earlier AT&T releases with BSD features. The recent POSIX standard for UNIX-like operating systems defines a single interface to UNIX. Advanced features differ among systems.

Most versions of UNIX can also work with window systems, which allow each user to have more than one "terminal" on a single display.

When might a chroot not work?

When a copy of "su" is not installed in the jail. The "su" command is required to to rin programs as a user other then "root." However since "root" can break out of the jail, it is necessary that you run a programs in the chroot jail as a user other then "root."

Why unix is the best operating system than other operating system?

There is no way to answer this question in sufficient detail. "Unix" is a term for a variety of operating systems, many of which have only a few features in common. And with a variety of operating systems on the market, there may or may not be differences between them and "Unix" in selected areas.

What is single user single process?

The single user process is the environment that only 1 user may log into and use the system. Typically this is for the administrator account and is used only in recovery situations. It is vaguely similar to "safe mode" in Windows.

For loop syntax in unix?

For loop can be used in following Ways:- Syntax: for var in list do commands done where list is basically the list of the values u want to traverse on, consider an example: suppose u want to display ur name 10 times we ca use for loop as: for var in 1 2 3 4 5 6 7 8 9 10 do echo "$name" done OR for var in {1 .. 10} do echo "$name" done OR the best way(analogous to c) for (( i = 0; i <= 10; i++) do echo "$name" done

How UNIX system calls work?

A "System Call" is used for the purpose of accomplishing a privileged task for a user by the operating system since the user cannot directly get access to the file system, hardware, etc.

The exact methodology is described in any standard Operating Systems textbook and the discussion of how it works is beyond the scope of this web site.

What is the SDLC process?

The Software Development Lifecycle (SDLC) is a conceptual model used in project management that describes the stages involved in an information system development project, from an initial feasibility study through maintenance of the completed application.

What is the Unix file system?

There are four types of file in unix

Ordinary files

Directory files

Special files

Links

Ordinary files can contain text, data, or program information. An ordinary file cannot

contain another file, or directory. An ordinary file can be a text file or a binary file. A text file contains

lines of printable characters where every line is terminated with a newline character. A binary file can

contain any of the ASCII characters. Most of the UNIX commands are binary files

Directory files: Directories are containers that can hold files, and other directories. A directory is

actually implemented as a file that has one line for each item contained within the directory. Each line in

a directory file contains only the name of the item, and a numerical reference to the location of the item.

The reference is called an i-number, and is an index to a table known as the i-list. The i-list is a complete

list of all the storage space available to the file system.

Special files Special files represent input/output (i/o) devices, like a tty (terminal), a disk drive, or a

printer. Because UNIX treats such devices as files, some of the commands used to access ordinary files

will also work with device files. This allows for more efficient use of software. Special files can be either

character special files, that deal with streams of characters, or block special files, that operate on larger

blocks of data. Typical block sizes are 512 bytes, 1024 bytes, and 2048 bytes.

Links A link is a pointer to another file. Since a directory is a list of the names and i-numbers of

files, a directory entry can be a hard link, in which the i-number points directly to another file. A hard link

to a file cannot be distinguished from the file itself. When a hard link is made, then the i-numbers of two

different directory file entries point to the same inode. Hence, hard links cannot span across file systems.

A soft link or a symbolic link provides an indirect pointer to a file. A soft link is implemented as a directory

file entry containing a pathname. Soft links are distinguishable from files, and can span across file systems.

Soft links are not supported in all versions of UNIX.

(mihir)

How do you created a directory or a file?

What are you refering to?

If you are refering to windows. Just right click in the folder you want to create the directory/file, click "new" then choose what you want to create.