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

Write a shell program called whos to display a sorted list of the logged in usersJust display the user names and no other information?

The 'users' command should do that; you don't need to write a shell script to get that information in that format.

What is the generic syntax for all UNIX command?

The generic syntax for commands is:

command-name options-or-parameters

The first non-blank field is always the command to be executed. Following that are either options (starts with a - or +), and any other non-blank field would be considered a parameter. An example:

cc -O -o testing -n -s -x main1.c sub1.c sub2.c

In unix Which command do you use to assign a socket to a specific address?

There isn't a generalized way from the command line in Unix to connect to a socket; there are socket libraries you can utilize from within the 'C' language to assign, bind, and connect to a specific socket address. For example:

int connect(int s, const struct sockaddr *name, int namelen);

In Linux, you can use the 'socket' command to connect to a specific socket as:

socket ?options? host port

Where the host is the IP address and the port is the port number (giving you the socket address).

How do you sum numbers in a Unix shell script?

try a for loop:

for x in 1 2 3 4

n=0

do

n=`echo $x+$n`|bc

done

Integer arithmetic can be done in the shell itself without requiring an external program, making the operation much faster:

n1=123

n2=543

sum=$(( $n1 + $n2 ))

echo "$sum"

How can you make out whether two files are copied or linked in unix?

Use the long listing function of 'ls'. You will see a link count > 1 and a reference to where the file is linked to if it is a link. Without a link it is a copy.

How can you append the output of a command to a file?

Use the append I/O redirection operator: >>

An example would be:

echo "Put this at the end of the file" >> aFile

Which takes the output of 'echo' and puts/appends it to the end of the file aFile.

What is swapping in operating systems?

When you load a file or program, the file is stored in the random access memory (RAM). Since RAM is finite, some files cannot fit on it. These files are stored in a special section of the hard drive called the "swap file". "Swapping" is the act of using this swap file.Aswapping is a mechanism in which a process can be swapped temporarily out of memory to a backing store and then brought back into memory for continued execution.

Write a shell script where you check whether the name begins with A and ends with t?

You haven't specified what the 'name' is, so it is not possible to answer the question.

What is the purpose of the chown command?

It changes the ownership of the file/device/directory to a specified user.

He shell standard variables are called metacharacters?

Shell metacharacters are special characters that have meaning in a Unix shell. For example, the '$' character followed by letters indicates that the shell variable with that name should have its value substituted.

str=hello

echo $str

will echo out 'hello'. Other metacharacters include the semi-colon (for multiple commands on the same line), the backslash character for escaping special meanings, the single and double quote for combining fields, these are all metacharacters.

A metacharacter changes the interpretation of things in various ways.

Can command rmdir can be used to delete a directory that is not empty?

the commandrmdir will not remove a directory if it is not empty in UNIX. The correct way to

remove a directory and all its contents recursively is with the rm

command.

What is the ls -F command?

Lists your files in the directory and allows appending of indicators (one of */=@|) to entries

Difference between booting and mounting process?

"Booting" refers to the process is bringing a machine up, usually from the power-on standpoint. The boot process brings in the operating system a piece at a time and initializes the system. The final part of a boot process is usually the log-in screen.

"Mounting" refers to adding a file system from another source, either a remote computer or a remote device, such as a flash drive. This has to be done while the system is running, i.e., after it has "booted" and is in a running state.

Is there a timer command for the Linux terminal?

Use "man time" in a Linux terminal (without the quotes) to view the manual page for time. There are commands to show elapsed time a program runs, when a program is to start, etc. For a simple example, this 'Egg Timer' command: echo -e '\a' >&2; sleep 180; echo -e '\a' >72 will show a blank terminal for 180 seconds. Or 3 minutes, (which is enough to cook a soft-boiled egg!).

Is the hidden file in the users home directory that is the configuration file for bash is bash profile?

The bash shell uses a hidden file called .bashrc for settings in the shell upon startup.

What is a server daemon?

A server daemon is a program that runs in the background and provides some sort of service, such as a web server, SSH server, or a database server.

What is fullform of posix?

"posix" is a latest version of a operating system of "unix",published by ieee 1003.2 standard.

Specifically, it's an acronym for Portable Operating Systems Interface. When used, it should specify which version of the specification is being referenced. E.g. POSIX.1-2008 is the latest.

What are the advantages and diadvantages of a buffer cache?

A cache allows one to retrieve commonly used information very quickly (if it is still in the cache) rather than trying to find it on the system (which takes much longer).

The disadvantage is that is takes away memory from the system to implement the cache.

Program to find the simple interest in unix?

# calculate simple interest for 3 sets of p,n and r

count=1

while [ count -le 3 ]

do

echo "\n enter the values of p,n and r\c"

read p n r

si='echo $p\*$n\*$r/100|bc'

echo simple interest = Rs. $si

count='expr $count+1'

done

What is the full path name of your home directory?

If your user name is tom it would be /home/tom or if your user name is Mary it would be /home/Mary

Option cp -p in unix commands?

To copy the file from source to target as well as preserve the permissions by writing next to cp '-p'

What does it mean when your printer says broken pipe?

The OS is telling you that it has lost the ability to write data to the printer. This is normally caused by some sort of corruption in the system.

I would try deleting the print job and trying again. If that does not work delete the printer and enable it again. If that does not work reboot the computer and restart the printer. The last step is to reinstall the printer drivers.