Online Tutorials & Training Materials | STechies.com
Register Login

Unix Interview Questions and Answers

|| || 0

Unix Interview Questions and Answers
Stechies

What is UNIX? What does UNIX stand for?

UNIX is easy to use, multi-user, multi-tasking and stable operating system for servers that have a graphical user interface (GUI) like Microsoft Windows. It stands for Uniplexed Information and Computing Service.

How to rename a file in UNIX?

The syntax to rename a file in UNIX is mv old-file-name new-file-name.

How to delete a directory in UNIX?

The syntax to delete an empty directory in UNIX is 'rmdir directoryname'. To remove a directory with files in it, the syntax is rm -r directoryname.

What is the difference between UNIX and LINUX?

The difference between UNIX and LINUX are-

UNIX

LINUX

Different versions of UNIX are priced differently.

Linux is usually free of cost. Even the commercial version is cheaper than Windows.

Servers, mainframes, and workstations mostly use UNIX operating systems.

Anyone can use Linux operating systems.

UNIX mostly finds use in internet servers, workstations & PCs.

Linux can be installed in devices from mainframes and supercomputers computer to mobile phones, tablets, video game consoles, etc.

It supports file formats like jfs, gpfs, hfs, hfs+, ufs, xfs, and zfs.

It supports file formats like Ext2, Ext3, Ext4, Jfs, ReiserFS, Xfs, Btrfs, FAT, FAT32, and NTFS.

How to change a password in UNIX?

To change the root password or another user’s password in UNIX, log in to the server with ssh or console and use the command passwd.

How to find a file in UNIX?

The syntax to find a file in UNIX is find . -name "filename" -print

How to use grep command in UNIX?

The GREP or Globally Search For Regular Expression and Print Out command in UNIX is a filter to search for a file with a specific pattern of characters. The syntax to use GREP is:

grep [options] pattern [files]

How to kill a process in UNIX?

The commands to kill a process in UNIX is kill and killall. The syntax is:

  • kill -[signal] PID
  • kill -15 PID
  • kill -9 PID
  • kill -SIGTERM PID
  • kill [options] -SIGTERM PID

Unix-Interview-Questions

What is UNIX shell scripting?

Shell scripting in UNIX is the process of writing a sequence of command to execute a shell. It has the ability to condense lengthy and repetitive sequences into one simple script ready for execution at any time to reduce the end user’s effort.

How to run shell script in UNIX?

The steps to run a shell script in UNIX are-

  • In the terminal, go to the directory.
  • Make a file with .sh extension.
  • Using an editor, write the script.
  • Execute the script using the command chmod +x <fileName>.
  • The script can be Run using ./<fileName>.

How to write a function in UNIX shell script?

The steps to writing a function in UNIX shell script are-

  • Add a shell script file with the extension .sh.
  • Define the desired function in the shell script using the command fnHelloWorld() {} and name it.

Example-

#function define hi world

fnHiWorld()

{

        #print hi world

        echo "Hi World";

}

#calling hi world function

fnHiWorld

How to add comments in UNIX shell script?

To add comments in UNIX shell script using the function # my comment goes here.

What is the difference between Kill and Kill -9 command in UNIX?

The difference between Kill and Kill-9 commands in UNIX is that Kill command is used to kill a process with the process ID. Kill -9 directs the signal to kill to the process group ID.

Difference between cat and vi commands in UNIX?

The difference between CAT and VI commands are that CAT creates one or more files and redirects the output in the terminal or files, Vi enable editing lines in context with another line in the file.

What are the different dialects in UNIX?

The different dialects in UNIX are-

  • AT&T UNIX
  • Berkeley's BSD UNIX
  • Microsoft's XENIX
  • Hewlett-Packard UNIX (HPUX)
  • IBM's UNIX (AIX)
  • Sun UNIX (Solaris)

What are the differences between MV and CP commands in UNIX?

MV command in UNIX is used to move a file or rename a file, besides deleting the original file. Unlike mv, cp saves a copy of the original file besides performing the same operation as mv.

What are different ways to create a file in UNIX?

The file can be created in UNIX are by using the following commands-

  • CAT command
  • Touch command
  • Echo and printf command

What is the use of use of awk command in UNIX?

In UNIX, Awk Command finds and replaces a text. The syntax for the same is:

awk ‘BEGIN {start_action} {action} END {stop_action}’ filename

How to copy a directory in Linux?

The syntax to copy a directory in LINUX is cp -R path_to_source path_to_destination/.

What is the UNIX commands to create a shortcut to the tail?

The UNIX command to create a shortcut to the tail is ls -l /path/to/dir | tail -n200.


Related Articles