Linux Interview Questions and Answers
Question - 101 : - What is the iptables command in Linux?
Answer - 101 : -
iptables command blocks or allows traffic on a Linux host, similar to a network firewall. This iptables command may prevent certain applications from receiving or transmitting requests.
Question - 102 : - What does the cd - command do?
Answer - 102 : -
cd- command go to the previous directory.
Question - 103 : - What does cd command do?
Answer - 103 : -
Go to $HOME directory
Question - 104 : - What does (cd dir && command) do?
Answer - 104 : -
cd dir && command go to the dir, executes the command and returns to the current directory.
Question - 105 : - What does pushd command do?
Answer - 105 : -
pushd command put current dir on the stack so you can pop back to it.
Question - 106 : - What is ls -lSr command?
Answer - 106 : -
ls - ISr command shows files by size, biggest file will be displayed last.
Question - 107 : - How do you check the permissions of each directory to a file?
Answer - 107 : -
It is useful to detect permissions errors, for example when configuring a web server.
namei -l /path/to/file.txt
Question - 108 : - How do you find who is logged in?
Answer - 108 : -
Use this command to find who logged in: w
Question - 109 : - How do you list the contents of tar.gz and extract only one file?
Answer - 109 : -
Use these commands:
- tar tf file.tgz
- tar xf file.tgz filename
Question - 110 : - How do you run the command every time a file is modified?
Answer - 110 : -
Use this command to do:
while inotifywait -e close_write document.tex
do
make
done