Linux Commands

  Home  Operating System Linux  Linux Commands


“Linux Commands job interview questions and answers guideline. Lean Linux Commands and get preparation for the job of Linux Commands”



23 Linux Commands Questions And Answers

2⟩ If we transfer 100 files by ftp to remote server, how to know the files are successfully transfer or some file are not transferred?

after transferring the files look into the present working

directory of the client machine for the transferred files

and cross check it.

else you can check the total number of files transferred to

the client machine in present working directory using this

command

ls -l | wc -l

 176 views

7⟩ Explain Difference between swap partition and swap file?

Swap partition maintained seperate partition.

same swap partition can be used in two OS within single

machine.

If system crashes their is a chance to recover itor may not

be corrupt the partition.

Less fragmented.

where as swap file takes very less space. we can increase

the space very easily, compared to swap partition.

SWap file system fragmented.

If system crashes their is a huge chance to lost the swap

file system.

 137 views

8⟩ How to recover /etc/passwd file and /etc/shadow file?

## In that case you need to recover /etc/passwd file first.

For this you have to following steps,

-Start GRUB on boot (press ESC while booting)

-Press e over (recovery mode)

-Press e over the line beginning with kernel

-Press Space bar and enter "init=/bin/bash"

-Press enter

-Press b

-At command prompt type: "cp /etc/passwd- /etc/passwd"

-reboot to GRUB again

-Press e over (recovery mode)

-Press e over the line beginning with kernel

-Press Space bar and enter "init=/bin/bash"

-Press enter

-Press b

-At command prompt type "mount -o remount,rw /"

-Type "passwd YOURUSERNAMEHERE" (IF you don't know your user

name type "ls /home" (that is a Lower case L and lower case

S) for a list of users)

-Enter new password at prompt

-reboot to normal boot.

Hope that helps others like it did me!

### Then to recover /etc/shadow file, Use following command

pwconf

This command will generate /etc/shadow file from /etc/passwd

 216 views

10⟩ Suppose I lost a root password and i need to give it, I treid to change it through single usermode even though i am not get a password, then what is the other procedure to give a root password?

Login into single user mode and try below things:

1. passswd [ Change Password for root ]

2. rm -rf /etc/nologin

3. remove any "nologin" shell for root user in /etc/passwd file

4. chage -l root then chage -E root

5. passwd -u root

6. chattr -i /etc/passwd /etc/shadow

7. chmod 600 /etc/securetty

8. vim /etc/rc.local --> then remove any line like say "

/etc/nplogin "

9. chsh root [ /bin/bash ]

 132 views

12⟩ What is lilo? How it is useful in linux?

LILO (LInux LOader) is a boot loader (a small program that

manages a dual boot) for use with the Linux operating system.

Most of the new computers are shipped with boot loaders for

some version of Microsoft Windows or the Mac OS. If a

computer is to be used with Linux, a special boot loader must

be installed. LILO is the most popular boot loader among

users.

 129 views

16⟩ What is the command to check wwn # in linux?

Emulex HBA Adaptor.

Find the WWPN.

Step1:

Confirm if the HBA is Emulex.

# lspci

......

0e:00.0 Fibre Channel: Emulex Corporation Zephyr LightPulse

Fibre Channel Host Adapter (rev 02)

17:00.0 Fibre Channel: Emulex Corporation Zephyr LightPulse

Fibre Channel Host Adapter (rev 02)

#

Step2:

# cd /sys/class/fc_host/

# ls -l

total 0

drwxr-xr-x 3 root root 0 Oct 14 20:57 host0

drwxr-xr-x 3 root root 0 Oct 14 20:57 host1

# cat port_name

0x10000000c97a37cf

#

 132 views

17⟩ How to give acl permission in numerical mode on linux?

By using chmod command

for example chmod 777 <file name>

its for full permissionof the file

read =4

write =2

execute=1

user group other

7 7 7

4+2+1 4+2+1 4+2+1

r+w+e r+w+e r+w+e

other example

we give permission to user to full and give group and other

to only read and execute than

chmod 755 <file name>

 119 views

18⟩ How to restart apache server with out shatdown?

whenever you want restart Apache web server without shutdown

Apache web server that time you use the commands service

httpd reload ,if you type the commands service httpd restart

that time frist shut down the service then startup the

service but if you type commands service httpd reload, only

read the configuration file and startup the service

 139 views

19⟩ What is chainloading?

The chainloading technique tells GRUB to read +n sectors from

the start of the partition. Usually n = 1. The chainloading

command may specify also a file name: chainloader +1 read 1

sector from start of the partition

chainloader /boot/chain.os2 load a file

 155 views