Linux Interview Questions and Answers
Question - 41 : - What are the contents of /usr/local?
Answer - 41 : - It contains locally installed files. This directory matters in environments where files are stored on the network. Specifically, locally-installed files go to /usr/local/bin, /usr/local/lib, etc.). Another application of this directory is that it is used for software packages installed from source, or software not officially shipped with the distribution.
Question - 42 : - How do you terminate an ongoing process?
Answer - 42 : - Every process in the system is identified by a unique process id or pid. Use the kill command followed by the pid to terminate that process. To terminate all process at once, use kill 0.
Question - 43 : - How do you insert comments in the command line prompt?
Answer - 43 : - Comments are created by typing the # symbol before the actual comment text. This tells the shell to completely ignore what follows. For example "# This is just a comment that the shell will ignore."
Question - 44 : - What is command grouping and how does it work?
Answer - 44 : - You can use parentheses to group commands. For example, if you want to send the current date and time along with the contents of a file named OUTPUT to a second file named MYDATES, you can apply command grouping as follows: (date cat OUTPUT) > MYDATES
Question - 45 : - What is the command to calculate the size of a folder?
Answer - 45 : - To calculate the size of a folder uses the command du –sh folder1.
Question - 46 : - How can you find the status of a process?
Answer - 46 : - Use the command
ps ux
Question - 47 : - How can you check the memory status?
Answer - 47 : - You can use the command
free -m to display output in MB
free -g to display output in GB
Question - 48 : - Explain how to color the Git console?
Answer - 48 : - To color the Git console, you can use the command git config—global color.ui auto. In the command, the color.ui variable sets the default value for a variable such as color.diff and color.grep.
Question - 49 : - How can you append one file to another in Linux?
Answer - 49 : - 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. While another command cat file 1 file 2 > file 3 appends two or more files to one.
Question - 50 : - Explain how you can find a file using Terminal?
Answer - 50 : - To find a file you have to use a command, find . –name "process.txt" . It will look for the current directory for a file called process.txt.