10-13-2011
How to bin/find w/ -follow without searching both link and target
I am interested in searching links to files not found within a directory, so I use the -follow option. However, the dir may contain links to files that are also found within the dir. That means if I bin/find a bunch of files then search their contents using grep, I get redundant information. An easy way to ignore links to files that are found in the same tree that I'm searching? Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I create a file touch 1201093003 fichcomp
and inside a repertory (which hava a lot of files) I want to list all files created before this file :
find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long
but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies
2. Shell Programming and Scripting
Hi,
I want to search a string in unix binary execuateble.
I know one command available : strings
Can anyone tell me the other commands available to search in unix bin. (1 Reply)
Discussion started by: senthil_is
1 Replies
3. UNIX for Dummies Questions & Answers
Hey,
How can one ZIP the target of a soft/symbolic link in unix (if dodag@ is a symbolic link for the path car/reno/*.*, how can I zip car/reno/*.*, with using only dodag as my reference)?
Thxnk you. (1 Reply)
Discussion started by: galz
1 Replies
4. UNIX for Dummies Questions & Answers
Hi,
Is it possible to change the target of a symbolic link?
What I currently have is:
/home/Data1
/home/Data2
/home/Stores
In the Stores directory, I did: ln -s /home/Data1 /home/Stores/abc
$ pwd
/home/Stores
$ ls -latr
lrwxrwxrwx 1 dandy dandy 46 Feb 12 16:38 abc ->... (5 Replies)
Discussion started by: dandyrandy
5 Replies
5. UNIX for Dummies Questions & Answers
Hello,
I'm trying to create a program in perl called myfind.pl;
To use the program:
(at the command line)$ program.pl keyword filename
note: the keyword is any word or regular expression
and it should display the result just like when you 'cat' the file name but with the keyword in... (2 Replies)
Discussion started by: Horizon666
2 Replies
6. Red Hat
hi there,
Would you able to advise that why the syntax or statement below couldn't work as expected ?
/usr/bin/find /backup -name "*tar*" -mtime +2 -exec /bin/rm -f {} \; 1> /dev/null 2>&1
In fact, I was initially located it as in crontab job, but it doesn't work at all. So, I was... (9 Replies)
Discussion started by: rauphelhunter
9 Replies
7. Shell Programming and Scripting
I have a target directory, there are some files and directories in "target_dir".
I have a symbol link: my_link -> <target_dir>
The target directory name is NOT known to the script (because it is varying), while the link name is always fixed.
In a shell script, how to remove both the... (1 Reply)
Discussion started by: princelinux
1 Replies
8. UNIX for Dummies Questions & Answers
Hi everybody,
I read about treads realted to this issue but they did not resovle issue given below.
Please help me resolve issue given below
I have html file under /srv/www/htdocs/actual_folder
ls actual_folder/
test.html
and following link works... (0 Replies)
Discussion started by: newbielgn
0 Replies
9. Solaris
Hi Guys,
OS:- Solaris 10 64Bit
I have a small query.
On one server a user is facing sed command issue.
He gets error regarding sed for this location
/users/hoy/2999/batch5/bin/internal.sh: /usr/local/bin/sed: not found
How ever the sed is actually present at this location on server:-... (13 Replies)
Discussion started by: manalisharmabe
13 Replies
10. Shell Programming and Scripting
Hello all,
On a Solaris box, I am trying to move the target of a symbolic link.
Let's say the symbolic link looks like the following:
/dir1/dir2/link -> /some/dir/target
I would like to know of a simple way to move the target of the symbolic link and not the link itself. I'd like to move... (4 Replies)
Discussion started by: ejianu
4 Replies
LN(1) BSD General Commands Manual LN(1)
NAME
link, ln -- make links
SYNOPSIS
ln [-Ffhinsv] source_file [target_file]
ln [-Ffhinsv] source_file ... target_dir
link source_file target_file
DESCRIPTION
The ln utility creates a new directory entry (linked file) which has the same modes as the original file. It is useful for maintaining mul-
tiple copies of a file in many places at once without using up storage for the ``copies''; instead, a link ``points'' to the original copy.
There are two types of links; hard links and symbolic links. How a link ``points'' to a file is one of the differences between a hard and
symbolic link.
The options are as follows:
-F If the target file already exists and is a directory, then remove it so that the link may occur. The -F option should be used with
either -f or -i options. If none is specified, -f is implied. The -F option is a no-op unless -s option is specified.
-h If the target_file or target_dir is a symbolic link, do not follow it. This is most useful with the -f option, to replace a symlink
which may point to a directory.
-f If the target file already exists, then unlink it so that the link may occur. (The -f option overrides any previous -i options.)
-i Cause ln to write a prompt to standard error if the target file exists. If the response from the standard input begins with the char-
acter 'y' or 'Y', then unlink the target file so that the link may occur. Otherwise, do not attempt the link. (The -i option over-
rides any previous -f options.)
-n Same as -h, for compatibility with other ln implementations.
-s Create a symbolic link.
-v Cause ln to be verbose, showing files as they are processed.
By default, ln makes hard links. A hard link to a file is indistinguishable from the original directory entry; any changes to a file are
effectively independent of the name used to reference the file. Hard links may not normally refer to directories and may not span file sys-
tems.
A symbolic link contains the name of the file to which it is linked. The referenced file is used when an open(2) operation is performed on
the link. A stat(2) on a symbolic link will return the linked-to file; an lstat(2) must be done to obtain information about the link. The
readlink(2) call may be used to read the contents of a symbolic link. Symbolic links may span file systems and may refer to directories.
Given one or two arguments, ln creates a link to an existing file source_file. If target_file is given, the link has that name; target_file
may also be a directory in which to place the link; otherwise it is placed in the current directory. If only the directory is specified, the
link will be made to the last component of source_file.
Given more than two arguments, ln makes links in target_dir to all the named source files. The links made will have the same name as the
files being linked to.
When the utility is called as link, exactly two arguments must be supplied, neither of which may specify a directory. No options may be sup-
plied in this simple mode of operation, which performs a link(2) operation using the two passed arguments.
COMPATIBILITY
The -h, -i, -n and -v options are non-standard and their use in scripts is not recommended. They are provided solely for compatibility with
other ln implementations.
The -F option is FreeBSD extention and should not be used in portable scripts.
SEE ALSO
link(2), lstat(2), readlink(2), stat(2), symlink(2), symlink(7)
STANDARDS
The ln utility conforms to IEEE Std 1003.2-1992 (``POSIX.2'').
The simplified link command conforms to Version 2 of the Single UNIX Specification (``SUSv2'').
HISTORY
An ln command appeared in Version 1 AT&T UNIX.
BSD
February 14, 2006 BSD