Sunday, December 27, 2015

How to Delete Files/Directories?

Deleting files :-

syntax :- rm <filename>

using #rm <filename> , It will ask you confirm to delete file.
you can use #rm -rf <filename>,   It will delete without promting anything .

r- recursively  , f- forcefully

using * you can delete all related to that file name. You can see from below  example for above commands.

Deleting Directory :-

syntax :- rmdir <directoryname>    or  rm -rf  <directoryname>

Using above 2 commands you can delete directories without any prompt .

using # rm -rf *   , we can delete all the files and directories in that folder .  You can see same in below examples.

Thursday, December 24, 2015

How to Rescan the existing Disk ?

We can rescan the existing disk using below command.

Syntax :-

echo 1 >  /sys/class/scsi_device/device/rescan 

How to Change Hostname ?

"hostname" is the command to check current hostname .

syntax  to change hostname :-  hostname <serverhostname>

In below example you can see on how we can change hostname to linuxtechnotes.  Current server  hostname is  localhost.localdomain

From above screen you can see ,you need to relogin to change effect to shell .

Again , its temporary change . If you want to make it persistent during system boot . we need to specify new hostname in /etc/sysconfig/network file .