Posts

Showing posts with the label Commands

Stat Utility

The stat utility allows you to see all information about either a file or a directory.  You can use wildcards if you want to see info for more than one object at a time. stat process.sh File: `process.sh' Size: 158           Blocks: 16         IO Block: 4096   regular file Device: 305h/773d    Inode: 98134       Links: 1 Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root) Access: 2010-08-18 11:16:37.000000000 -0600 Modify: 2010-08-16 09:44:57.000000000 -0600 Change: 2010-08-16 09:44:57.000000000 -0600 Most of this should be self-explanatory, but a few items bear explaining. * Blocks–Each file occupies a certain number of filesystem blocks on the hard drive.  Here, we see that this file occupies eight blocks. * IO Block–This i...

XARGS

xargs: Execute a command, passing constructed argument list(s). The arguments are typically a long list of filenames (generated by ls or find) that are passed to xargs via a pipe. Syntax       xargs [ options ] [ command ] Options    -0    --null             Expect filenames to be terminated by NULL instead of whitespace.             Do not treat quotes or backslashes specially.    -e[ string ]    -E[ string ]    --eof[= string ]             Set EOF to _ or, if specified, to string.    --help             Print a summary of the options to xargs and then exit.    -i[ string ]    -I[ string ]    --replace[= strin...

LSOF (Listing of open files)

lsof stands for list open files. Which will list information about files opened by processes. Command to show all opened Internet sockets # lsof -i Command to print all tcp connections # lsof -i tcp Command to print all udp connections # lsof -i udp Command to find who are the users using the folder right now # lsof +D /tmp  Command to print who and what are the files using in /dev/sda5 partitions # lsof /dev/sda5  Command to list all the files associated with process ID 2665 # lsof +p 2665  Command to listing of files for processes executing the command that begins with vmstat #lsof -c vmstat  Listing of files for processes executing the command that begins with character a # lsof -c a  Command to print all the files opened by the user ashish # lsof -u ashish Consider that you are usnig nfs to transfer files between multiple systems in you local LAN. Assume that the folder which shares for  NFS  is / sharing , if you ...