Finding the occurrence of specific word from a file in linux using grep



This can be a interview question for even advanced linux users.


Here is the command : grep -o spellword file | grep wc -w 


( where spellword = name of the word you want to count and file is the name of the file )


Result : You will find the result based on occurrence of specific word.


SSHD Port Change – Linux interview question




This is most common interview question for freshers.

How do you change sshd port ?


Login as root:
cd /etc/ssh
pico -w sshd_config
Now look for the line that says #Port 22
Remove the # and change 22 to the number you want to change to
Someting like this : Port 2342443

Use Control-O to save the file
Control-X to exit the pico editor.

The above change tells sshd to listen on port 2342443 for connections.

Now restart service sshd restart

/etc/init.d/sshd restart

Don’t forget to change the port forwarding in your router to reflect the new port that needs to be forwarded to your node computer. If you don’t, you won’t make it in when you try to remotely administer your node


Go to Top