Friday, September 11, 2015

Finding & processing the file
  • Find /etc/ passwd = to search a passwd details
  • Find /etc -size 1024k (small k) = to search a all files 1024k at a time
  • Find /etc -size +1024k= to search & show a more than 1024k files
  • Find /etc -size -1024k = to show a less than 1024k all file
  • Find /home – user student = to search file by user name
  • Find /home – group student = to search by group name
  • Find /etc –perm 755 = to search a file permission
  • Find /etc - perm -222 = it means every one should have write permission
  • Find /etc +perm +222 =any one can have a write permission
  • Sign “ - ” it’s mean Anding
  • Find /home -user student -a root
  • Find /home -user student -o root
# Time stamp
A timestamp is a sequence of characters or encoded information identifying when a certain event occurred, usually giving date and time of day.


Stat install.log = showing file details about install.log , like that…
File: `install.log'
Size: 42639 Blocks: 96 IO Block: 4096 regular file
Device: 802h/2050d Inode: 15 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-05-30 19:39:34.320710515 +0530
Modify: 2013-05-28 18:22:11.433160238 +0530
Change: 2013-05-28 18:22:22.609701016 +0530
Touch = DESCRIPTION :- Update the access and modification times of each FILE to the current time.
Example :- touch…..file name
-a change only the access time
-m change only the modification time
-t STAMP = use [[CC]YY]MMDDhhmm[.ss] instead of current time
Find /etc -a time +/-5 = it’s showing 1 to 5 days
Find /etc -atime 5 = showing a details in a /etc file


# inode
Definition :- inode is a unique number assign of a file or a directory to identified by the kernel .
Inode number to store a metadata of the file
An inode (index node) is a data structure found in many Unix file systems. Each inode stores all the information about a file system object (file, device node, socket,pipe, etc.), except data content and file name
Find -I num 6672 (inode number)
# Processing a file
  • - ok ------|
  • - | connect two character & two command at a time using this operator
  • - exec |
  • { } --------| curly base ( this is a place holder source )
Example 1 , find /home –user student -exec cp -rf {} /data \ ;
(Where rf stands r= recursively , f = forcefully)

 Example2, find /home –user student -ok cp {} /data \ ;  

No comments:

Post a Comment

Linux Tables: Block All Incoming Traffic But Allow SSH

  This is very common scenario. You want to permit access to a remote machine only by SSH. You would like to block all incoming traffic to y...