SLIDER
Latest Post
3:00 PM
Optimize Xargs Command on Linux
Written By Andara on Sunday, July 28, 2013 | 3:00 PM
NAME
xargs - build and execute command lines from standard input
SYNOPSIS
xargs [-0prtx] [-E eof-str] [-e[eof-str]] [--eof[=eof-str]] [--null] [-d delimiter] [--delimiter delimiter] [-I replace-str] [-i[replace-str]]
[--replace[=replace-str]] [-l[max-lines]] [-L max-lines] [--max-lines[=max-lines]] [-n max-args] [--max-args=max-args] [-s max-chars] [--max-chars=max-
chars] [-P max-procs] [--max-procs=max-procs] [--interactive] [--verbose] [--exit] [--no-run-if-empty] [--arg-file=file] [--show-limits] [--version]
[--help] [command [initial-arguments]]
DESCRIPTION
This manual page documents the GNU version of xargs. xargs reads items from the standard input, delimited by blanks (which can be protected with double or
single quotes or a backslash) or newlines, and executes the command (default is /bin/echo) one or more times with any initial-arguments followed by items
read from standard input. Blank lines on the standard input are ignored.
The command line for command is built up until it reaches a system-defined limit (unless the -n and -L options are used). The specified command will be in‐
voked as many times as necessary to use up the list of input items. In general, there will be many fewer invocations of command than there were items in
the input. This will normally have significant performance benefits. Some commands can usefully be executed in parallel too; see the -P option.
Because Unix filenames can contain blanks and newlines, this default behaviour is often problematic; filenames containing blanks and/or newlines are incor‐
rectly processed by xargs. In these situations it is better to use the -0 option, which prevents such problems. When using this option you will need to
ensure that the program which produces the input for xargs also uses a null character as a separator. If that program is GNU find for example, the -print0
option does this for you.
If any invocation of the command exits with a status of 255, xargs will stop immediately without reading any further input. An error message is issued on
stderr when this happens.
OPTIONS
--arg-file=file
-a file
Read items from file instead of standard input. If you use this option, stdin remains unchanged when commands are run. Otherwise, stdin is redi‐
rected from /dev/null.
--null
-0 Input items are terminated by a null character instead of by whitespace, and the quotes and backslash are not special (every character is taken lit‐
erally). Disables the end of file string, which is treated like any other argument. Useful when input items might contain white space, quote marks,
or backslashes. The GNU find -print0 option produces input suitable for this mode.
--delimiter=delim
-d delim
Input items are terminated by the specified character. Quotes and backslash are not special; every character in the input is taken literally. Dis‐
ables the end-of-file string, which is treated like any other argument. This can be used when the input consists of simply newline-separated items,
although it is almost always better to design your program to use --null where this is possible. The specified delimiter may be a single character,
a C-style character escape such as \n, or an octal or hexadecimal escape code. Octal and hexadecimal escape codes are understood as for the printf
command. Multibyte characters are not supported.
-E eof-str
Set the end of file string to eof-str. If the end of file string occurs as a line of input, the rest of the input is ignored. If neither -E nor -e
is used, no end of file string is used.
--eof[=eof-str]
-e[eof-str]
This option is a synonym for the -E option. Use -E instead, because it is POSIX compliant while this option is not. If eof-str is omitted, there is
no end of file string. If neither -E nor -e is used, no end of file string is used.
--help Print a summary of the options to xargs and exit.
-I replace-str
Replace occurrences of replace-str in the initial-arguments with names read from standard input. Also, unquoted blanks do not terminate input items;
instead the separator is the newline character. Implies -x and -L 1.
--replace[=replace-str]
-i[replace-str]
This option is a synonym for -Ireplace-str if replace-str is specified. If the replace-str argument is missing, the effect is the same as -I{}.
This option is deprecated; use -I instead.
-L max-lines
Use at most max-lines nonblank input lines per command line. Trailing blanks cause an input line to be logically continued on the next input line.
Implies -x.
--max-lines[=max-lines]
-l[max-lines]
Synonym for the -L option. Unlike -L, the max-lines argument is optional. If max-lines is not specified, it defaults to one. The -l option is dep‐
recated since the POSIX standard specifies -L instead.
--max-args=max-args
-n max-args
Use at most max-args arguments per command line. Fewer than max-args arguments will be used if the size (see the -s option) is exceeded, unless the
-x option is given, in which case xargs will exit.
--interactive
-p Prompt the user about whether to run each command line and read a line from the terminal. Only run the command line if the response starts with `y'
or `Y'. Implies -t.
--no-run-if-empty
-r If the standard input does not contain any nonblanks, do not run the command. Normally, the command is run once even if there is no input. This op‐
tion is a GNU extension.
--max-chars=max-chars
-s max-chars
Use at most max-chars characters per command line, including the command and initial-arguments and the terminating nulls at the ends of the argument
strings. The largest allowed value is system-dependent, and is calculated as the argument length limit for exec, less the size of your environment,
less 2048 bytes of headroom. If this value is more than 128KiB, 128Kib is used as the default value; otherwise, the default value is the maximum.
1KiB is 1024 bytes. xargs automatically adapts to tighter constraints.
--verbose
-t Print the command line on the standard error output before executing it.
--version
Print the version number of xargs and exit.
--show-limits
Display the limits on the command-line length which are imposed by the operating system, xargs' choice of buffer size and the -s option. Pipe the
input from /dev/null (and perhaps specify --no-run-if-empty) if you don't want xargs to do anything.
--exit
-x Exit if the size (see the -s option) is exceeded.
--max-procs=max-procs
-P max-procs
Run up to max-procs processes at a time; the default is 1. If max-procs is 0, xargs will run as many processes as possible at a time. Use the -n
option or the -L option with -P; otherwise chances are that only one exec will be done.
EXAMPLES
find /tmp -name core -type f -print | xargs /bin/rm -f
Find files named core in or below the directory /tmp and delete them. Note that this will work incorrectly if there are any filenames containing newlines
or spaces.
find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f
Find files named core in or below the directory /tmp and delete them, processing filenames in such a way that file or directory names containing spaces or
newlines are correctly handled.
find /tmp -depth -name core -type f -delete
Find files named core in or below the directory /tmp and delete them, but more efficiently than in the previous example (because we avoid the need to use
fork(2) and exec(2) to launch rm and we don't need the extra xargs process).
cut -d: -f1 < /etc/passwd | sort | xargs echo
Generates a compact listing of all the users on the system.
xargs sh -c 'emacs "$@" < /dev/tty' emacs
Launches the minimum number of copies of Emacs needed, one after the other, to edit the files listed on xargs' standard input. This example achieves the
same effect as BSD's -o option, but in a more flexible and portable way.
EXIT STATUS
xargs exits with the following status:
0 if it succeeds
123 if any invocation of the command exited with status 1-125
124 if the command exited with status 255
125 if the command is killed by a signal
126 if the command cannot be run
127 if the command is not found
1 if some other error occurred.
Exit codes greater than 128 are used by the shell to indicate that a program died due to a fatal signal.
STANDARDS CONFORMANCE
As of GNU xargs version 4.2.9, the default behaviour of xargs is not to have a logical end-of-file marker. POSIX (IEEE Std 1003.1, 2004 Edition) allows
this.
The -l and -i options appear in the 1997 version of the POSIX standard, but do not appear in the 2004 version of the standard. Therefore you should use -L
and -I instead, respectively.
The POSIX standard allows implementations to have a limit on the size of arguments to the exec functions. This limit could be as low as 4096 bytes includ‐
ing the size of the environment. For scripts to be portable, they must not rely on a larger value. However, I know of no implementation whose actual limit
is that small. The --show-limits option can be used to discover the actual limits in force on the current system.
SEE ALSO
find(1), locate(1), locatedb(5), updatedb(1), fork(2), execvp(3), Finding Files (on-line in Info, or printed)
BUGS
The -L option is incompatible with the -I option, but perhaps should not be.
It is not possible for xargs to be used securely, since there will always be a time gap between the production of the list of input files and their use in
the commands that xargs issues. If other users have access to the system, they can manipulate the filesystem during this time window to force the action of
the commands xargs runs to apply to files that you didn't intend. For a more detailed discussion of this and related problems, please refer to the ``Secu‐
rity Considerations'' chapter in the findutils Texinfo documentation. The -execdir option of find can often be used as a more secure alternative.
When you use the -I option, each line read from the input is buffered internally. This means that there is an upper limit on the length of input line that
xargs will accept when used with the -I option. To work around this limitation, you can use the -s option to increase the amount of buffer space that xargs
uses, and you can also use an extra invocation of xargs to ensure that very long lines do not occur. For example:
somecommand | xargs -s 50000 echo | xargs -I '{}' -s 100000 rm '{}'
Here, the first invocation of xargs has no input line length limit because it doesn't use the -i option. The second invocation of xargs does have such a
limit, but we have ensured that the it never encounters a line which is longer than it can handle. This is not an ideal solution. Instead, the -i option
should not impose a line length limit, which is why this discussion appears in the BUGS section. The problem doesn't occur with the output of find(1) be‐
cause it emits just one filename per line.
The best way to report a bug is to use the form at http://savannah.gnu.org/bugs/?group=findutils. The reason for this is that you will then be able to
track progress in fixing the problem. Other comments about xargs(1) and about the findutils package in general can be sent to the bug-findutils mailing
list. To join the list, send email to bug-findutils-request@gnu.org.
XARGS(1)
xargs - build and execute command lines from standard input
SYNOPSIS
xargs [-0prtx] [-E eof-str] [-e[eof-str]] [--eof[=eof-str]] [--null] [-d delimiter] [--delimiter delimiter] [-I replace-str] [-i[replace-str]]
[--replace[=replace-str]] [-l[max-lines]] [-L max-lines] [--max-lines[=max-lines]] [-n max-args] [--max-args=max-args] [-s max-chars] [--max-chars=max-
chars] [-P max-procs] [--max-procs=max-procs] [--interactive] [--verbose] [--exit] [--no-run-if-empty] [--arg-file=file] [--show-limits] [--version]
[--help] [command [initial-arguments]]
DESCRIPTION
This manual page documents the GNU version of xargs. xargs reads items from the standard input, delimited by blanks (which can be protected with double or
single quotes or a backslash) or newlines, and executes the command (default is /bin/echo) one or more times with any initial-arguments followed by items
read from standard input. Blank lines on the standard input are ignored.
The command line for command is built up until it reaches a system-defined limit (unless the -n and -L options are used). The specified command will be in‐
voked as many times as necessary to use up the list of input items. In general, there will be many fewer invocations of command than there were items in
the input. This will normally have significant performance benefits. Some commands can usefully be executed in parallel too; see the -P option.
Because Unix filenames can contain blanks and newlines, this default behaviour is often problematic; filenames containing blanks and/or newlines are incor‐
rectly processed by xargs. In these situations it is better to use the -0 option, which prevents such problems. When using this option you will need to
ensure that the program which produces the input for xargs also uses a null character as a separator. If that program is GNU find for example, the -print0
option does this for you.
If any invocation of the command exits with a status of 255, xargs will stop immediately without reading any further input. An error message is issued on
stderr when this happens.
OPTIONS
--arg-file=file
-a file
Read items from file instead of standard input. If you use this option, stdin remains unchanged when commands are run. Otherwise, stdin is redi‐
rected from /dev/null.
--null
-0 Input items are terminated by a null character instead of by whitespace, and the quotes and backslash are not special (every character is taken lit‐
erally). Disables the end of file string, which is treated like any other argument. Useful when input items might contain white space, quote marks,
or backslashes. The GNU find -print0 option produces input suitable for this mode.
--delimiter=delim
-d delim
Input items are terminated by the specified character. Quotes and backslash are not special; every character in the input is taken literally. Dis‐
ables the end-of-file string, which is treated like any other argument. This can be used when the input consists of simply newline-separated items,
although it is almost always better to design your program to use --null where this is possible. The specified delimiter may be a single character,
a C-style character escape such as \n, or an octal or hexadecimal escape code. Octal and hexadecimal escape codes are understood as for the printf
command. Multibyte characters are not supported.
-E eof-str
Set the end of file string to eof-str. If the end of file string occurs as a line of input, the rest of the input is ignored. If neither -E nor -e
is used, no end of file string is used.
--eof[=eof-str]
-e[eof-str]
This option is a synonym for the -E option. Use -E instead, because it is POSIX compliant while this option is not. If eof-str is omitted, there is
no end of file string. If neither -E nor -e is used, no end of file string is used.
--help Print a summary of the options to xargs and exit.
-I replace-str
Replace occurrences of replace-str in the initial-arguments with names read from standard input. Also, unquoted blanks do not terminate input items;
instead the separator is the newline character. Implies -x and -L 1.
--replace[=replace-str]
-i[replace-str]
This option is a synonym for -Ireplace-str if replace-str is specified. If the replace-str argument is missing, the effect is the same as -I{}.
This option is deprecated; use -I instead.
-L max-lines
Use at most max-lines nonblank input lines per command line. Trailing blanks cause an input line to be logically continued on the next input line.
Implies -x.
--max-lines[=max-lines]
-l[max-lines]
Synonym for the -L option. Unlike -L, the max-lines argument is optional. If max-lines is not specified, it defaults to one. The -l option is dep‐
recated since the POSIX standard specifies -L instead.
--max-args=max-args
-n max-args
Use at most max-args arguments per command line. Fewer than max-args arguments will be used if the size (see the -s option) is exceeded, unless the
-x option is given, in which case xargs will exit.
--interactive
-p Prompt the user about whether to run each command line and read a line from the terminal. Only run the command line if the response starts with `y'
or `Y'. Implies -t.
--no-run-if-empty
-r If the standard input does not contain any nonblanks, do not run the command. Normally, the command is run once even if there is no input. This op‐
tion is a GNU extension.
--max-chars=max-chars
-s max-chars
Use at most max-chars characters per command line, including the command and initial-arguments and the terminating nulls at the ends of the argument
strings. The largest allowed value is system-dependent, and is calculated as the argument length limit for exec, less the size of your environment,
less 2048 bytes of headroom. If this value is more than 128KiB, 128Kib is used as the default value; otherwise, the default value is the maximum.
1KiB is 1024 bytes. xargs automatically adapts to tighter constraints.
--verbose
-t Print the command line on the standard error output before executing it.
--version
Print the version number of xargs and exit.
--show-limits
Display the limits on the command-line length which are imposed by the operating system, xargs' choice of buffer size and the -s option. Pipe the
input from /dev/null (and perhaps specify --no-run-if-empty) if you don't want xargs to do anything.
--exit
-x Exit if the size (see the -s option) is exceeded.
--max-procs=max-procs
-P max-procs
Run up to max-procs processes at a time; the default is 1. If max-procs is 0, xargs will run as many processes as possible at a time. Use the -n
option or the -L option with -P; otherwise chances are that only one exec will be done.
EXAMPLES
find /tmp -name core -type f -print | xargs /bin/rm -f
Find files named core in or below the directory /tmp and delete them. Note that this will work incorrectly if there are any filenames containing newlines
or spaces.
find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f
Find files named core in or below the directory /tmp and delete them, processing filenames in such a way that file or directory names containing spaces or
newlines are correctly handled.
find /tmp -depth -name core -type f -delete
Find files named core in or below the directory /tmp and delete them, but more efficiently than in the previous example (because we avoid the need to use
fork(2) and exec(2) to launch rm and we don't need the extra xargs process).
cut -d: -f1 < /etc/passwd | sort | xargs echo
Generates a compact listing of all the users on the system.
xargs sh -c 'emacs "$@" < /dev/tty' emacs
Launches the minimum number of copies of Emacs needed, one after the other, to edit the files listed on xargs' standard input. This example achieves the
same effect as BSD's -o option, but in a more flexible and portable way.
EXIT STATUS
xargs exits with the following status:
0 if it succeeds
123 if any invocation of the command exited with status 1-125
124 if the command exited with status 255
125 if the command is killed by a signal
126 if the command cannot be run
127 if the command is not found
1 if some other error occurred.
Exit codes greater than 128 are used by the shell to indicate that a program died due to a fatal signal.
STANDARDS CONFORMANCE
As of GNU xargs version 4.2.9, the default behaviour of xargs is not to have a logical end-of-file marker. POSIX (IEEE Std 1003.1, 2004 Edition) allows
this.
The -l and -i options appear in the 1997 version of the POSIX standard, but do not appear in the 2004 version of the standard. Therefore you should use -L
and -I instead, respectively.
The POSIX standard allows implementations to have a limit on the size of arguments to the exec functions. This limit could be as low as 4096 bytes includ‐
ing the size of the environment. For scripts to be portable, they must not rely on a larger value. However, I know of no implementation whose actual limit
is that small. The --show-limits option can be used to discover the actual limits in force on the current system.
SEE ALSO
find(1), locate(1), locatedb(5), updatedb(1), fork(2), execvp(3), Finding Files (on-line in Info, or printed)
BUGS
The -L option is incompatible with the -I option, but perhaps should not be.
It is not possible for xargs to be used securely, since there will always be a time gap between the production of the list of input files and their use in
the commands that xargs issues. If other users have access to the system, they can manipulate the filesystem during this time window to force the action of
the commands xargs runs to apply to files that you didn't intend. For a more detailed discussion of this and related problems, please refer to the ``Secu‐
rity Considerations'' chapter in the findutils Texinfo documentation. The -execdir option of find can often be used as a more secure alternative.
When you use the -I option, each line read from the input is buffered internally. This means that there is an upper limit on the length of input line that
xargs will accept when used with the -I option. To work around this limitation, you can use the -s option to increase the amount of buffer space that xargs
uses, and you can also use an extra invocation of xargs to ensure that very long lines do not occur. For example:
somecommand | xargs -s 50000 echo | xargs -I '{}' -s 100000 rm '{}'
Here, the first invocation of xargs has no input line length limit because it doesn't use the -i option. The second invocation of xargs does have such a
limit, but we have ensured that the it never encounters a line which is longer than it can handle. This is not an ideal solution. Instead, the -i option
should not impose a line length limit, which is why this discussion appears in the BUGS section. The problem doesn't occur with the output of find(1) be‐
cause it emits just one filename per line.
The best way to report a bug is to use the form at http://savannah.gnu.org/bugs/?group=findutils. The reason for this is that you will then be able to
track progress in fixing the problem. Other comments about xargs(1) and about the findutils package in general can be sent to the bug-findutils mailing
list. To join the list, send email to bug-findutils-request@gnu.org.
XARGS(1)
Labels:
Programming
2:50 PM
Optimize Find Command On Linux
1. Basic find command
# find -name "TestFile"
2. Find Files Using Name and Ignoring Case
# find -iname "TestFile"
3. Limit Search To Specific Directory Level Using mindepth and maxdepth
# find / -maxdepth 3 -name passwd
-maxdepth --> will go 3 directories below -- / 1st; /etc 2nd; /usr/bin 3rd
# find / -mindepth 3 -maxdepth 5 -name passwd
will go 3 depths first and upto 5 -- so will not disply under /; /usr; /usr/bin
4. Executing Commands on the Files Found by the Find Command.
user -exec {} /;
# find -iname "TestFile" -exec md5sum {} \;
5. Inverting the match.
To inver the match use the "-not" switch
# find / -not -iname "TestFile"
6. List inodes of the files
# ls -i1 test*
16187429 test-file-name
16187430 test-file-name
# find -inum 16187430 -exec mv {} new-test-file-name \;
# ls -i1 *test*
16187430 new-test-file-name
16187429 test-file-name
7. Find file based on the File-Permissions
You can :
* Find files that match exact permission
* Check whether the given permission matches, irrespective of other permission bits
* Search by giving octal / symbolic representation
# find . -perm -g=r -type f -exec ls -l {} \;
Will display all files with group permission read. Not files with readonly group permission
# find . -perm g=r -type f -exec ls -l {} \;
Will dispay files with 040 permission. i.e files with group read only permisison
# find . -perm 040 -type f -exec ls -l {} \;
Will dispay files with 040 permission. i.e files with group read only permisison
8. Find all empty files (zero byte file) in your home directory and its subdirectory
# find ~ -empty
Need to check diff
# find . -empty -not -name "test" -- name not equal to test
# find . -not -empty -name ".*" -- no empty files
9. Finding the Top 5 Big Files
# find /var -type f -exec ls -s {} \; | sort -n -r | head -5
# find /var -type f -size +10M -exec ls -lh {} \;
10. Finding the Top 5 Small Files
# find /var -type f -exec ls -s {} \; | sort -n | head -5
This will most probably list zero byte files or empty files!!!
So to list the smaller files other than the ZERO byte files.
# find /var -not -empty -type f -exec ls -s {} \; | sort -n | head -5
11. Find Files by Size
use the -size switch -- + for greater than; - for lesser than
Find files bigger than the given size
# find / -size +100M
Find files smaller than the given size
# find / -size -100M
Find files that matches the exact given size
# find / -size 100M
Note: – means less than the give size, + means more than the given size, and no symbol means exact given size.
12. Find files based on file types
use -type switch
Find only the socket files.
# find . -type s
Find all directories
# find . -type d
Find only the normal files
# find . -type f
Find all the hidden files
# find . -type f -name ".*"
Find all the hidden directories
# find -type d -name ".*"
13. Creaing aliases:
use the alias command
# alias lslarge="find /var -type f -size +10M -exec ls -lh {} \;"
# lslarge -- will display greater than 10MB files in /var
14. Find Files Based on Access / Modification / Change Time
You can find files based on following three file time attribute.
1. Modification time of the file. Modification time gets updated when the file content modified.
2. Access time of the file. Access time gets updated when the file accessed.
3. Change time of the file. Change time gets updated when the inode data changes.
# min argument treats its argument as minutes. For example, min 60 = 60 minutes (1 hour).
# time argument treats its argument as 24 hours. For example, time 2 = 2*24 hours (2 days)
* -mmin n File’s data was last modified n minutes ago.
* -mtime n File’s data was last modified n*24 hours ago.
* -amin n File was last accessed n minutes ago
* -atime n File was last accessed n*24 hours ago
* -cmin n File’s status was last changed n minutes ago. inode change
* -ctime n File’s status was last changed n*24 hours ago.
14. Find files whose content got updated/Modified within last 1 hour/1Day
# find . -mmin -60 --
# find / -mtime -1 -- finds all the files (under root file system /) that got updated within the last 24 hours (1 day)
15. Find files which got accessed before 1 hour/1Day
# find -amin -60 -- find files in the current directory and sub-directories, which got accessed within last 1 hour (60 minutes)
# find / -atime -1 --
16. Find files which got changed exactly before 1 hour/1day :: inode change
# find . -cmin -60 --
# find / -ctime -1 -- finds all the files (under root file system /) that got changed within the last 24 hours (1 day).
17. Restricting the search only to unhidden files.
# find . -mmin -15 \( ! -regex ".*/\..*" \)
Refer the regex statement
18. Find files modified/accessed/changed after modifying a refrence file
Syntax: # find -newer FILE
# find -newer /etc/passwd -- Modified after
# find -anewer /etc/hosts -- Accessed after
# find -cnewer /etc/fstab -- Changed after
19. Searching Only in the Current Filesystem
use -xdev switch -- Don’t descend directories on other filesystems.
# find / -xdev -name "*.log"
Will search only /, not other mount points mounted under /.
# find / -name "*.log"
This will search all FS starting from /.
20. Using more than one { } in same command
# find -name "*.txt" cp {} {}.bkup \;
21. Redirecting errors to /dev/null
# find -name "*.txt" 2>>/dev/null
22. Substitute space with underscore in the file name.
# find . -type f -iname “*.mp3″ -exec mv “s/ /_/g” {} \;
# find -name "TestFile"
2. Find Files Using Name and Ignoring Case
# find -iname "TestFile"
3. Limit Search To Specific Directory Level Using mindepth and maxdepth
# find / -maxdepth 3 -name passwd
-maxdepth --> will go 3 directories below -- / 1st; /etc 2nd; /usr/bin 3rd
# find / -mindepth 3 -maxdepth 5 -name passwd
will go 3 depths first and upto 5 -- so will not disply under /; /usr; /usr/bin
4. Executing Commands on the Files Found by the Find Command.
user -exec {} /;
# find -iname "TestFile" -exec md5sum {} \;
5. Inverting the match.
To inver the match use the "-not" switch
# find / -not -iname "TestFile"
6. List inodes of the files
# ls -i1 test*
16187429 test-file-name
16187430 test-file-name
# find -inum 16187430 -exec mv {} new-test-file-name \;
# ls -i1 *test*
16187430 new-test-file-name
16187429 test-file-name
7. Find file based on the File-Permissions
You can :
* Find files that match exact permission
* Check whether the given permission matches, irrespective of other permission bits
* Search by giving octal / symbolic representation
# find . -perm -g=r -type f -exec ls -l {} \;
Will display all files with group permission read. Not files with readonly group permission
# find . -perm g=r -type f -exec ls -l {} \;
Will dispay files with 040 permission. i.e files with group read only permisison
# find . -perm 040 -type f -exec ls -l {} \;
Will dispay files with 040 permission. i.e files with group read only permisison
8. Find all empty files (zero byte file) in your home directory and its subdirectory
# find ~ -empty
Need to check diff
# find . -empty -not -name "test" -- name not equal to test
# find . -not -empty -name ".*" -- no empty files
9. Finding the Top 5 Big Files
# find /var -type f -exec ls -s {} \; | sort -n -r | head -5
# find /var -type f -size +10M -exec ls -lh {} \;
10. Finding the Top 5 Small Files
# find /var -type f -exec ls -s {} \; | sort -n | head -5
This will most probably list zero byte files or empty files!!!
So to list the smaller files other than the ZERO byte files.
# find /var -not -empty -type f -exec ls -s {} \; | sort -n | head -5
11. Find Files by Size
use the -size switch -- + for greater than; - for lesser than
Find files bigger than the given size
# find / -size +100M
Find files smaller than the given size
# find / -size -100M
Find files that matches the exact given size
# find / -size 100M
Note: – means less than the give size, + means more than the given size, and no symbol means exact given size.
12. Find files based on file types
use -type switch
Find only the socket files.
# find . -type s
Find all directories
# find . -type d
Find only the normal files
# find . -type f
Find all the hidden files
# find . -type f -name ".*"
Find all the hidden directories
# find -type d -name ".*"
13. Creaing aliases:
use the alias command
# alias lslarge="find /var -type f -size +10M -exec ls -lh {} \;"
# lslarge -- will display greater than 10MB files in /var
14. Find Files Based on Access / Modification / Change Time
You can find files based on following three file time attribute.
1. Modification time of the file. Modification time gets updated when the file content modified.
2. Access time of the file. Access time gets updated when the file accessed.
3. Change time of the file. Change time gets updated when the inode data changes.
# min argument treats its argument as minutes. For example, min 60 = 60 minutes (1 hour).
# time argument treats its argument as 24 hours. For example, time 2 = 2*24 hours (2 days)
* -mmin n File’s data was last modified n minutes ago.
* -mtime n File’s data was last modified n*24 hours ago.
* -amin n File was last accessed n minutes ago
* -atime n File was last accessed n*24 hours ago
* -cmin n File’s status was last changed n minutes ago. inode change
* -ctime n File’s status was last changed n*24 hours ago.
14. Find files whose content got updated/Modified within last 1 hour/1Day
# find . -mmin -60 --
# find / -mtime -1 -- finds all the files (under root file system /) that got updated within the last 24 hours (1 day)
15. Find files which got accessed before 1 hour/1Day
# find -amin -60 -- find files in the current directory and sub-directories, which got accessed within last 1 hour (60 minutes)
# find / -atime -1 --
16. Find files which got changed exactly before 1 hour/1day :: inode change
# find . -cmin -60 --
# find / -ctime -1 -- finds all the files (under root file system /) that got changed within the last 24 hours (1 day).
17. Restricting the search only to unhidden files.
# find . -mmin -15 \( ! -regex ".*/\..*" \)
Refer the regex statement
18. Find files modified/accessed/changed after modifying a refrence file
Syntax: # find -newer FILE
# find -newer /etc/passwd -- Modified after
# find -anewer /etc/hosts -- Accessed after
# find -cnewer /etc/fstab -- Changed after
19. Searching Only in the Current Filesystem
use -xdev switch -- Don’t descend directories on other filesystems.
# find / -xdev -name "*.log"
Will search only /, not other mount points mounted under /.
# find / -name "*.log"
This will search all FS starting from /.
20. Using more than one { } in same command
# find -name "*.txt" cp {} {}.bkup \;
21. Redirecting errors to /dev/null
# find -name "*.txt" 2>>/dev/null
22. Substitute space with underscore in the file name.
# find . -type f -iname “*.mp3″ -exec mv “s/ /_/g” {} \;
Labels:
Programming
10:00 AM
Buah serta biji Pala dapat pulihkan diabetes
Written By Andara on Wednesday, January 9, 2013 | 10:00 AM
Sobat andaras.blogpot.com, pada kesempatan kali ini kita coba sharing tentang manfaat buah pala dalam kedokteran. Hal ini berawal dari keinginantahuan yang tinggi pada faedah buah serta biji pala ( myristica fragans hout ), nyatanya berbuah kesuksesan. Salah seorang dosen fakultas farmasi Universitas Padjadjaran ( UNPAD ), dr. Keri Lestari Dandan, M.Si. dapat sukses bikin obat antidiabetes militus ( DM ), yang terbuat dari ekstrak biji pala. tak hanya sebagai neutraseutical antidiabetes, tablet ekstrak biji pala ini lalu dapat jadikan obat antidislipidemik.
Pada dies natalis ke-55 UNPAD, tablet ekstrak biji pala ini dipamerkan di aula UNPAD, untuk dapat diapresiasi oleh civitas academika UNPAD serta penduduk, selasa ( 11/9 ).
Dr. Keri Lestari mengatakan, tablet ekstrak biji pala ini telah diujicobakan pada relawan ( manusia ), serta akhirnya dapat diakselerasi dengan baik. “bahkan clearen medical-nya ataupun penelitian kesehatan telah keluar. saat ini tinggal memasuki step ke-2, ” ungkap Keri.
Menurut Keri, dari hasil pantauan pada relawan, tak ada dampak samping yang membahayakan, justru menujukkan parameter perbaikan pada kandungan gula didalam tubuh. tetapi Keri mengatakan, penyembuhan melewati tablet ekstrak biji pala ini amat bergantung pada individu, terlebih saat menjaga pola makan serta gaya hidup.
“Dalam penyembuhan penyakit diabetes, pasien tak hanya diberi obat antidiabetes, juga mesti diintervensi pola makan serta gaya hidup yang baik, ” tuturnya.
Walaupun telah terdafar serta terstandar di obat herbal, tetapi tablet ekstrak biji pala antidiabates penemuan Keri serta kawan-kawan, sedang didaftarkan ke badan pengawas obat serta makanan ( pom ) RI dan diseminasi pada laboratorium obat. Keri amat meyakini, obat antidiates dari ekstrak biji pala ini dapat diproduksi massal pada th. 2013.
“Sekarang tetap didalam sistem untuk terdaftar di badan pom. Ya mudah-mudahan, th. 2013 dapat diproduksi massal. Minta doanya saja, ” tutur Keri.
Pasien DM
Ketekunan Keri pada buah serta biji pala telah lama dikerjakan sejak pendidikan S1, S2, serta S3, sampai memperoleh beasiswa meneliti buah serta biji pala ke Yonsei PUniversity Korea. Perihal ini didasari dikarenakan Keri ada didalam lingkungan keluarga yang menderita DM, serta lebih jauhnya lagi pasien DM di Indonesia menempati peringkat ke-4 dunia.
“Dari sana timbul keinginantahuan pada biji pala. kabarnya, buah serta biji pala dapat mengobati penyakit diabetes. hingga awal penelitian pada biji pala untuk dibuatkan obat antidiabetes, ” tuturnya.
Th. 2008 dikerjakan joint research denghan Korea, serta ditemukan kegiatan ekstrak biji pala sebagai agonis ganda PPAR alfa serta gamma. diartikan, ekstrak biji pada punya potensi untuk pengelolaan penyakit DMT2. th. 2009 dikerjakan uji preklinik ditemukan kegiatan antihiperlikenik serta antidisipidemik pada hewan. Thn 2010, uji toksitas selular ( MMT ) serta uji toksitas akut tunjukkan keamanan pemakaian ekstrak, dan didapatkan hak paten untuk pembuatan serta pemakaian ekstrak biji pala sebagai antihiperglikemik ( p00201000179 ).
Th. 2011 dikerjakan uji toksisitas sub kronik serta modifikasi ekstrasi serta formulasi. th. 2012 dihasilkan ekstrak biji pala bebas safrol serta miristisin dan hasil uji toksisitas sub kritis. Akhirnya pemakaian ekstrak dengan berulang ini safe. Di Indonesia sepanjang ini buah serta biji pala cuma untuk bumbu masakan ataupun penganan. walau sebenarnya memiliki kandungan agonis ganda PPAR alfa serta gamma, yang berguna untuk orang DM.
Sesaat didunia sekarang ini sedang gencar dikerjakan penelitian agonis PPAR, terhitung di amerika. tetapi sayang, agonis ganda PPAR yang di teliti ini rontok serta berefeksamping pada tumor, dikarenakan terbuat berbahan sintetis.
“Sementara agonis PPAR yang di teliti fakultas farmasi serta fakultas kedokteran UNPAD, yaitu yang bersumber dari alam atau ekstrak biji pala. Dari hasil penelitian agonis ganda PPAR dari biji pala ini tidak menyebabkan dampak samping terhitung pada tumor. Justru sebaliknya berikan daya lebih pada tubuh, dan dapat memperbiki kegiatan lemak serta kandungan glukosa didalam tubuh, ” tuturnya.
Dapat Pulih
Keri mengatakan, ditemukannya tablet ekstrak biji pala, penyakit DM di Indonesia ataupun didunia dapat sembuh. walaupun penyakit DM terus alami tanda-tanda kenaikkan bersamaan gaya hidup penduduk dunia, terhitung pola makan dan kerap konsumsi yang manis-manis. “Penyakit DM lalu banyak berkembang dikarenakan factor keturunan, ” tandasnya.
Thn ini dapat didapatkan hak paten pembuatan serta pemakaian ekstrak biji pala sebagai antidislipidemik ( p0021100949 ). Namun pemakaian ekstrak biji pala, dikerjakan manufaktur sediaan ekstrak biji pala sebagai neutraseuticael serta antidislipidemik bekerja bersama dengan PT Kimia Farma tbk.
Pada step ini dikembangkan teknologi formulasi sediaan yang pas serta mencukupi standar mutu, dan dikerjakan uji preklinik serta uji klinik untuk mengetaui kegiatan ekstrak sesudah formulasi.
“Intinya tablet ekstrak biji pala ini safe dikonsumsi seluruh usia, asal cocok dosis. tak hanya mengobati DM juga menambah vitalitas manusia, namun penurunan kandungan gula serta lemak didalam tubuhnya tidak mencolok serta penetrasinya amat baik, ” tuturnya.
Pada dies natalis ke-55 UNPAD, tablet ekstrak biji pala ini dipamerkan di aula UNPAD, untuk dapat diapresiasi oleh civitas academika UNPAD serta penduduk, selasa ( 11/9 ).
Dr. Keri Lestari mengatakan, tablet ekstrak biji pala ini telah diujicobakan pada relawan ( manusia ), serta akhirnya dapat diakselerasi dengan baik. “bahkan clearen medical-nya ataupun penelitian kesehatan telah keluar. saat ini tinggal memasuki step ke-2, ” ungkap Keri.
Menurut Keri, dari hasil pantauan pada relawan, tak ada dampak samping yang membahayakan, justru menujukkan parameter perbaikan pada kandungan gula didalam tubuh. tetapi Keri mengatakan, penyembuhan melewati tablet ekstrak biji pala ini amat bergantung pada individu, terlebih saat menjaga pola makan serta gaya hidup.
“Dalam penyembuhan penyakit diabetes, pasien tak hanya diberi obat antidiabetes, juga mesti diintervensi pola makan serta gaya hidup yang baik, ” tuturnya.
Walaupun telah terdafar serta terstandar di obat herbal, tetapi tablet ekstrak biji pala antidiabates penemuan Keri serta kawan-kawan, sedang didaftarkan ke badan pengawas obat serta makanan ( pom ) RI dan diseminasi pada laboratorium obat. Keri amat meyakini, obat antidiates dari ekstrak biji pala ini dapat diproduksi massal pada th. 2013.
“Sekarang tetap didalam sistem untuk terdaftar di badan pom. Ya mudah-mudahan, th. 2013 dapat diproduksi massal. Minta doanya saja, ” tutur Keri.
Pasien DM
Ketekunan Keri pada buah serta biji pala telah lama dikerjakan sejak pendidikan S1, S2, serta S3, sampai memperoleh beasiswa meneliti buah serta biji pala ke Yonsei PUniversity Korea. Perihal ini didasari dikarenakan Keri ada didalam lingkungan keluarga yang menderita DM, serta lebih jauhnya lagi pasien DM di Indonesia menempati peringkat ke-4 dunia.
“Dari sana timbul keinginantahuan pada biji pala. kabarnya, buah serta biji pala dapat mengobati penyakit diabetes. hingga awal penelitian pada biji pala untuk dibuatkan obat antidiabetes, ” tuturnya.
Th. 2008 dikerjakan joint research denghan Korea, serta ditemukan kegiatan ekstrak biji pala sebagai agonis ganda PPAR alfa serta gamma. diartikan, ekstrak biji pada punya potensi untuk pengelolaan penyakit DMT2. th. 2009 dikerjakan uji preklinik ditemukan kegiatan antihiperlikenik serta antidisipidemik pada hewan. Thn 2010, uji toksitas selular ( MMT ) serta uji toksitas akut tunjukkan keamanan pemakaian ekstrak, dan didapatkan hak paten untuk pembuatan serta pemakaian ekstrak biji pala sebagai antihiperglikemik ( p00201000179 ).
Th. 2011 dikerjakan uji toksisitas sub kronik serta modifikasi ekstrasi serta formulasi. th. 2012 dihasilkan ekstrak biji pala bebas safrol serta miristisin dan hasil uji toksisitas sub kritis. Akhirnya pemakaian ekstrak dengan berulang ini safe. Di Indonesia sepanjang ini buah serta biji pala cuma untuk bumbu masakan ataupun penganan. walau sebenarnya memiliki kandungan agonis ganda PPAR alfa serta gamma, yang berguna untuk orang DM.
Sesaat didunia sekarang ini sedang gencar dikerjakan penelitian agonis PPAR, terhitung di amerika. tetapi sayang, agonis ganda PPAR yang di teliti ini rontok serta berefeksamping pada tumor, dikarenakan terbuat berbahan sintetis.
“Sementara agonis PPAR yang di teliti fakultas farmasi serta fakultas kedokteran UNPAD, yaitu yang bersumber dari alam atau ekstrak biji pala. Dari hasil penelitian agonis ganda PPAR dari biji pala ini tidak menyebabkan dampak samping terhitung pada tumor. Justru sebaliknya berikan daya lebih pada tubuh, dan dapat memperbiki kegiatan lemak serta kandungan glukosa didalam tubuh, ” tuturnya.
Dapat Pulih
Keri mengatakan, ditemukannya tablet ekstrak biji pala, penyakit DM di Indonesia ataupun didunia dapat sembuh. walaupun penyakit DM terus alami tanda-tanda kenaikkan bersamaan gaya hidup penduduk dunia, terhitung pola makan dan kerap konsumsi yang manis-manis. “Penyakit DM lalu banyak berkembang dikarenakan factor keturunan, ” tandasnya.
Thn ini dapat didapatkan hak paten pembuatan serta pemakaian ekstrak biji pala sebagai antidislipidemik ( p0021100949 ). Namun pemakaian ekstrak biji pala, dikerjakan manufaktur sediaan ekstrak biji pala sebagai neutraseuticael serta antidislipidemik bekerja bersama dengan PT Kimia Farma tbk.
Pada step ini dikembangkan teknologi formulasi sediaan yang pas serta mencukupi standar mutu, dan dikerjakan uji preklinik serta uji klinik untuk mengetaui kegiatan ekstrak sesudah formulasi.
“Intinya tablet ekstrak biji pala ini safe dikonsumsi seluruh usia, asal cocok dosis. tak hanya mengobati DM juga menambah vitalitas manusia, namun penurunan kandungan gula serta lemak didalam tubuhnya tidak mencolok serta penetrasinya amat baik, ” tuturnya.
9:35 AM
Tutorial Java - Install glassfish
Sobat andaras.blogspot.com, pada kesempatan yang lalu kita sudah mempelajari bagaimana cara menginstall java yang akan digunakan sebagai environment java (baca disini). Pada kesempatan kali ini kita akan mempelajari menginstall server java dengan menggunakan glassfish yang terdapat pada installer java_ee_sdk-6u4-jdk7-windows.
Labels:
Programming
2:37 PM
Tutorial Java - Install Java EE
Written By Andara on Tuesday, January 8, 2013 | 2:37 PM
Labels:
Programming
1:25 PM
Related Posts Widget with Thumbnails for Blogger
Written By Andara on Friday, November 16, 2012 | 1:25 PM
Labels:
SEO
11:32 AM
ADD META TAGS at Blogspot
Meta tags are HTML tags that provide additional information about your
blog that is unseen by visitors but available to search engines. The blogger usual use meta content for description and keywords.The
meta description tag, for example, provides a short summary of the page
content. The keyword meta tags show the keywords and keyword phrases a
visitor might use to find your blog. Because of abuse of meta tags
search engines have become smarter and most no longer place emphasis on
keywords to establish page ranking however keyword meta tags are still
used by some search engines so it is a good idea to include them.
How to Add Meta Tags to a Blogger Blogspot Blog Home Page
1. Login to Blogger if not already logged in
2. Navigate to Design > Edit HTML
3. Back up your template as a precaution by downloading full template to your computer.
4. Check the Expand Widget Templates box
5. Find these lines which will be near the top of your template:
6. Paste the following code immediately below
7. Enter your blog description between the single quote marks under description. Maximum 150 characters
8. Enter the keywords of your blog between the single quote marks under keywords. Ensure you separate each keyword or keyword phrase by a comma. Make sure your keywords do not exceed 200 characters
By way of example here are the meta tags I use for the home page of Blog Know How:
How to Add Meta Tags to a Blogger Blogspot Blog Home Page
1. Login to Blogger if not already logged in
2. Navigate to Design > Edit HTML
3. Back up your template as a precaution by downloading full template to your computer.
4. Check the Expand Widget Templates box
5. Find these lines which will be near the top of your template:
<head>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>
6. Paste the following code immediately below
<title><data:blog.pageTitle/></title>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<meta content='Place your blog description here' name='description'/>
<meta content='Place your blog keywords here(separated by commas)'
name='keywords'/>
</b:if>
7. Enter your blog description between the single quote marks under description. Maximum 150 characters
8. Enter the keywords of your blog between the single quote marks under keywords. Ensure you separate each keyword or keyword phrase by a comma. Make sure your keywords do not exceed 200 characters
By way of example here are the meta tags I use for the home page of Blog Know How:
<b:if cond='data:blog.url == http://andaras.blogspot.com/'>
<meta content='andaras is a blog having content about my family,tips,tricks, programming ,seo, and lot more' name='description'/>
<meta content='php tutorial, php IDE,php programming, javascript tips,tricks, ajax, jquery, pentaho data integration,eclipse plugin,seo' name='keywords'/>
</b:if>
Labels:
SEO