Interview Questions

Linux

How to enable FTP service in Linux?

Use the following commands to start/stop FTP service in Linux.

$ service vsftpd start
$ service vsftpd stop

In RHEL 3 & 4, the following commands can be used.

$ /etc/init.d/vsftpd {start|stop|restart|condrestart|status}

How will you change the time stamp of a file?

Use the command "touch" to change the time stamp of a file.

bash# touch Test.txt

How will you find the free space details of your machine?

bash# free

How will you find the Disk space details of your machine?

bash# df -h

This gives the list of available space mounted in the Linux machine.

How will you find the details of the command user?

Command: whoami ; Output: Displays the user name of the command user Command: who am i ; Output: Provides the details of the command user

How will you find the list of all users logged in to the system?

Use the command "who" to get the list of users logged in to the Linux system.

How will you display the last 20 lines of a file?

Use the command "tail" to display the last part of the file. By default, it displays the last 10 lines of the file.

If you need to display more than 10 lines, then execute the following command,

bash# tail -20 Test.txt

How will you display the first 20 lines of a file?

Use the command "head" to display the top part of the file. By default, it displays the first 10 lines of the file.

If you need to display more then 10 lines, then execute the following command.

bash# head -20 Test.txt

How will you move the content of file-1 and file-2 to another file named file-3 by single command execution?

cat file-1.txt file-2.txt > file-3/txt

what is the command to display the file content?

Use the following command to display the content of the file.

cat file_name

Example: cat Test.txt