0% found this document useful (0 votes)
5 views7 pages

Linux VIVA Questions

Uploaded by

amaldavis2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Linux VIVA Questions

Uploaded by

amaldavis2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

lOMoAR cPSD| 15656105

1. What is Linux?
Linux is an operating system or a kernel distributed under an open-source license. Its
functionality list is quite like UNIX. The kernel is a program at the heart of the Linux operating
system that takes care of fundamental stuff, like letting hardware communicate with software.

2. What is the difference between UNIX and LINUX?


Unix originally began as a propriety operating system from Bell Laboratories, which later on
spawned into different commercial versions. On the other hand, Linux is free, open source and
intended as a non-propriety operating system for the masses.

3. What is BASH?
BASH is short for Bourne Again SHell. It was written by Steve Bourne as a replacement to the
original Bourne Shell (represented by /bin/sh). It combines all the features from the original
version of Bourne Shell, plus additional functions to make it easier and more convenient to use.
It has since been adapted as the default shell for most systems running Linux.

4. What is the advantage of open source?


Open source allows you to distribute your software, including source codes freely to anyone
who is interested. People would then be able to add features and even debug and correct errors
that are in the source code. They can even make it run better and then redistribute these
enhanced source code freely again. This eventually benefits everyone in the community.

5. Describe the root account.


The root account is like a systems administrator account and allows you full control of the
system. Here you can create and maintain user accounts, assigning different permissions for
each account. It is the default account every time you install Linux.

6. How do you change permissions under Linux?


Assuming you are the system administrator or the owner of a file or directory, you can grant
permission using the chmod command. Use + symbol to add permission or – symbol to deny
permission, along with any of the following letters: u (user), g (group), o (others), a (all), r
(read), w (write) and x (execute). For example, the command chmod go+rw FILE1.TXT grants
read and write access to the file FILE1.TXT, which is assigned to groups and others.

7. What are hard links?


lOMoAR cPSD| 15656105

Hard links point directly to the physical file on disk, and not on the pathname. This means that
if you rename or move the original file, the link will not break since the link is for the file itself,
not the path where the file is located.

8. What is the pwd command?


The pwd command is short for print working directory command.

9. What are the kinds of permissions under Linux?


There are 3 kinds of permissions under Linux:-

Read: users may read the files or list the directory

Write: users may write to the file of new files to the directory

Execute: users may run the file or lookup a specific file within a directory
10. What are environmental variables?
Environmental variables are global settings that control the shell’s function as well as that of
other Linux programs. Another common term for environmental variables is global shell
variables.

Example: PATH, LOGNAME, PS1, PS2

11. What are the different modes when using vi editor?


There are 3 modes under vi:-

Command mode – this is the mode where you start in, in this mode inserted characters are
treated as vi commands. Esc key is used to enter command mod

Edit mode or insert mode– this is the mode that allows you to do text editing. The key ”i“is
used to enter edit mode

Ex mode – This mode is also called last line mode. This mode is used to save file or quit vi
editor. Press “:” key to enter Ex mode.

12. How can you find the status of a process?


ps command

13. How can you append one file to another in Linux?


To append one file to another in Linux you can use command cat
file2 >> file 1.
The operator >> appends the output of the named file or creates the file if it is not created.
lOMoAR cPSD| 15656105

While another command

cat file 1 file 2 > file 3 appends two or more files to one.

14. Explain how you can create a folder using Terminal?


To create a folder, you have to use command mkdir.It will be something like these:

mkdir dirname

15. What is the purpose of the 'sudo' command in Linux?


The 'sudo' command in Linux allows users to execute commands with superuser or root
privileges, granting them the necessary permissions to perform administrative tasks.

16. What is the 'grep' command used for in Linux?


The 'grep' command is used to search text for patterns or specific strings within files. It's a
powerful tool for text processing and searching.

17. What is a shell in Linux?


A shell is a command-line interface that allows users to interact with the Linux operating
system. Common shells include Bash, Zsh, and Fish.
18. What is the purpose of the 'passwd' command in Linux?
The 'passwd' command is used to change a user's password in Linux. It can also be used by
administrators to manage user account passwords.

19. What does the 'ps' command do in Linux?


The 'ps' command is used to display information about running processes on a Linux system,
including their process IDs (PIDs), resource usage, and status.

20. What is the purpose of the 'ls' command in Linux?


The 'ls' command is used to list files and directories in the current directory or a specified
location. It provides information such as file names, sizes, and permissions.

21. How can you create a symbolic link in Linux?


You can create a symbolic link in Linux using the 'ln -s' command, where '-s' indicates that
you're creating a symbolic (soft) link to a target file or directory.

22. What is a Linux kernel?


lOMoAR cPSD| 15656105

The Linux kernel is the core component of the Linux operating system. It manages hardware
resources, facilitates communication between software and hardware, and controls system
processes.

23. What is a shell script in Linux?


A shell script is a text file containing a series of commands that can be executed in sequence.
It allows users to automate tasks and perform complex operations by running the script in a
shell or terminal.

24. How do you rename a file or directory in Linux?


To rename a file or directory in Linux, you can use the 'mv' command, followed by the
current name and the desired new name. For example, mv oldname.txt newname.txt
renames a file.
25. What is the purpose of the 'top' command in Linux?
The 'top' command is used to display real-time information about system processes, including
CPU usage, memory usage, and other system statistics. It provides a dynamic view of system
performance.

26. How do you find out your current working directory in Linux?
You can find out your current working directory in Linux using the 'pwd' (print working
directory) command.

27. What command is used to display the manual pages for other commands in Linux?
The 'man' command is used to display manual pages for other commands in Linux. For
example, 'man ls' shows the manual for the 'ls' command.

28. How do you create a new user in Linux?


To create a new user in Linux, you can use the 'useradd' command followed by the
username. For example, 'sudo useradd newuser' creates a new user named 'newuser'.
29. What command is used to view and manipulate environment variables in Linux?
The 'env' command displays environment variables, while 'export' is used to set or modify
environment variables in Linux.

30. How can you display the last few lines of a text file in Linux?
You can display the last few lines of a text file in Linux using the 'tail' command. For example,
'tail myfile.txt' shows the last 10 lines by default.
lOMoAR cPSD| 15656105

31. How do you search for files or directories with a specific name in Linux?
You can use the 'find' command to search for files or directories with a specific name in Linux.
For example, 'find /path/to/search -name filename' searches for 'filename' in the specified path.

32. What command is used to delete a file in Linux?


The 'rm' command is used to delete files in Linux. For example, 'rm myfile.txt' deletes the
'myfile.txt' file.

33. How can you list all running processes in Linux?


You can list all running processes in Linux using the 'ps ' command. This command displays a
detailed list of all processes running on the system.

34. How do you change the permissions of a file in Linux?


You can change the permissions of a file in Linux using the 'chmod' command followed by the
desired permission settings. For example, 'chmod 644 myfile.txt' sets read and write
permissions for the owner and read-only permissions for others.

35. What is the purpose of the 'chown' command in Linux?


The 'chown' command is used to change the ownership of files and directories in Linux. It
allows you to specify a new owner and optionally a new group.
36. How do you display a list of currently logged-in users in Linux?
You can display a list of currently logged-in users in Linux using the 'who' or 'w' command.

37. How can you create a new empty file in Linux?


You can create a new empty file in Linux using the 'touch' command, followed by the filename.
For example, 'touch newfile.txt' creates an empty file named 'newfile.txt'.

38. What command is used to view and manipulate the contents of text files in Linux?
The 'cat' command is commonly used to view the contents of text files in Linux.
39. What command is used to find and replace text within a file in Linux?
The 'sed' command is often used to find and replace text within a file in Linux. For example,
'sed 's/old-text/new-text/g' inputfile > outputfile' replaces all occurrences of 'oldtext' with 'new-
text' in 'inputfile' and saves the result in 'outputfile'.

40. How do you view and navigate the contents of a large text file in Linux without opening it?
You can use the 'less' command to view and navigate the contents of a large text file in Linux
without opening it entirely. Simply type 'less filename' to enter the viewer and use arrow keys
or other commands to navigate.
lOMoAR cPSD| 15656105

41. How can you copy a file from one directory to another in Linux?
You can copy a file from one directory to another in Linux using the 'cp' command. For
example, 'cp file.txt /destination/directory' copies 'file.txt' to the specified destination directory.

42. How do you display the content of a text file in Linux?


You can display the content of a text file in Linux using the 'cat' command. For example, 'cat
myfile.txt' shows the contents of 'myfile.txt'.

43. How can you find a file by its name in Linux?


You can find a file by its name in Linux using the 'find' command. For example, 'find
/path/to/search -name filename' searches for 'filename' in the specified path.

44. What command is used to list files and directories in a long format with additional information
like permissions and ownership?
The 'ls -l' command is used to list files and directories in a long format, providing detailed
information about permissions, ownership, file size, and more.

45. What is the purpose of the 'sed' command in Linux?


The 'sed' (stream editor) command is used to filter and transform text. It can be used to search
for patterns and replace them, among other text manipulation tasks.

46. How can you use 'uniq' to count the number of occurrences of each unique line in a sorted file?
You can use 'uniq -c' to count the number of occurrences of each unique line in a sorted file.
For example, sort input.txt | uniq -c sorts 'input.txt' and counts the occurrences of each
unique line.

47. Which command is used to change a directory?

cd command

48. Which command is used to copy the content of one file to another?
cp

49. Which command is used to remove a directory?


rmdir

50. Which command is used to remove a directory with its content?


rm –r dirname

51. Which command is used to display the content of the file page by page?
lOMoAR cPSD| 15656105

more or less command


52. Commands used to create file
cat, touch, vi cpmmand

53. Command used to sort the content of the file


sort

54. Commands used to perform arithmetic opeartions


bc, expr

55. What is the difference between expr and bc commands?


expr command is used to perform arithmetic operations on integers.
bc command is used to perform arithmetic operations on integers as well as on floating point
numbers.

You might also like