Wednesday 20 March 2013

Imp Linux commands I often use

To find a file :

1) find -name filename1
2) find . -name *.trc -mtime +10 -exec rm {}\;   --- It finds the file and remove if it exists from before 10 days.
3) file  file_name      <---- to fine file type
4) find -name *.req -ctime +10 -exec rm{}\;

Different TAR commands:

1) tar   -cvzf   target_file.tgz  file1 file2 file3    <---
2) tar   -xvzf   file_name.tgz     <---- To extract the TAR file
3) tar   -ztvf   file_name.tgz      <----  To see the contents of a TAR file.

Memory Usage commands:

1)  df -Th
2)  du
3)  du -sh    <----To know particular directory size
4) free -m
5) top

Unzip commands:
1) unzip filename.zip
2) unzip filename.zip -d  /dir/.   ---->> unzip a file to a particular directory  

Telnet command:

1) telnet  IPaddress  portnumber

How To mount a directory in nfs :

 In host system do the following :
( from which system you want to share a directory ) :

1)  vi /etc/exports

 

Here is softwares is the directory I want to mount 


2) restart the nfs and network with below commands:

  
 From the guest machine where you wanted that mounted directory:

1) create a mounted directory structure as in host system:
Here For Ex  : mkdir -p /mnt/softwares
2) mount -t nfs -o rw IPadressofHost:/mnt/softwares /mnt/softwares



1 comment: