Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-18-2003, 04:08 PM
|
#1
|
LQ Newbie
Registered: Jun 2003
Posts: 5
Rep:
|
ls -laL command for Symbolic Link
I have a file in a directory, /home/map/.profile, and this file is a symbolic link to another file.
When i type ls -laL I get:
-rwxr-x--- 44 root sb 258 Jun 18 11:58 .profile
Under Unix, I would get information that tells me where the file really lives.
How do I find this out under Linux? I can tell by the 44 that it is a symbolic link but I don't know where it really is.
Thanks,
Jim
Red Hat Linux
|
|
|
06-18-2003, 04:37 PM
|
#2
|
Senior Member
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142
Rep:
|
The L option shows info about the file the link points to, not about the link itself. Run it without the L, and you'll get what you want.
I have a ~/mnt with links to the mount points in /mnt...
Code:
[nemo@xxxxx mnt]$ ls
cdrom floppy usb
[nemo@xxxxx mnt]$ ls -laL
total 20
drwxrwxr-x 2 nemo nemo 4096 May 14 16:51 .
drwx------ 33 nemo nemo 4096 Jun 18 16:25 ..
drwxr-xr-x 2 root root 4096 Apr 5 15:23 cdrom
drwxr-xr-x 2 root root 4096 Apr 5 15:23 floppy
drwxr-xr-x 2 root root 4096 Apr 5 20:35 usb
[nemo@xxxxx mnt]$ ls -la
total 8
drwxrwxr-x 2 nemo nemo 4096 May 14 16:51 .
drwx------ 33 nemo nemo 4096 Jun 18 16:25 ..
lrwxrwxrwx 1 nemo nemo 10 May 14 16:51 cdrom -> /mnt/cdrom
lrwxrwxrwx 1 nemo nemo 11 May 14 16:51 floppy -> /mnt/floppy
lrwxrwxrwx 1 nemo nemo 8 May 14 16:51 usb -> /mnt/usb
|
|
|
06-19-2003, 08:02 AM
|
#3
|
LQ Newbie
Registered: Jun 2003
Posts: 5
Original Poster
Rep:
|
Thanks for the reply.
Maybe its not a link. Here is the output:
root@acct01 two]# ls -la
total 32
drwx------ 2 two sb 4096 Nov 19 2002 .
drwxr-xr-x 53 root root 4096 Jun 18 11:58 ..
-rw-r--r-- 1 two sb 24 Nov 19 2002 .bash_logout
-rw-r--r-- 1 two sb 191 Nov 19 2002 .bash_profile
-rw-r--r-- 1 two sb 124 Nov 19 2002 .bashrc
-rw-r--r-- 1 two sb 820 Nov 19 2002 .emacs
-rwxr-x--- 44 root sb 258 Jun 18 11:58 .profile
-rw-r--r-- 1 two sb 3511 Nov 19 2002 .screenrc
[root@acct01 two]# pwd
/home/two
The file .profile does not really live in the directory /home/two. It's the same file under every /home/ subdirectory.
I was hoping to see .profile with the -> to tell me where it really is.
Thanks,
Jim
|
|
|
06-19-2003, 11:07 AM
|
#4
|
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
|
If it's a hard link, it won't point to anywhere, since it actually shares the same inode and is, in fact, the same file as the one in /home/* (a file with multiple hard links will not be deleted until the last name is removed -- a file can have many names). The 44 tells you that this file actually has 44 names. . .
(man ln, man ls)
You could find all instances of the file by using find or locate. . .
Last edited by moses; 06-19-2003 at 11:10 AM.
|
|
|
06-19-2003, 12:36 PM
|
#5
|
LQ Newbie
Registered: Jun 2003
Posts: 5
Original Poster
Rep:
|
Moses,
Thanks for the reply.
I tried locate .profile and it shows all of the paths, but some of the .profile files are local, and some are part of the linked 44.
/home/coe/.profile
/home/bas/.profile
/home/cyb/.profile
/home/kek/.profile
/home/ril/.profile
/home/dob/.profile
/home/anm/.profile
/home/ttt/.profile
/u1/uv/sample/.profile
/u1/uv/sample/?.profile
/u1/uv/.profile
/u1/sbplus/SB+/.profile
/u1/sbplus/SBDEMO/.profile
Is there any way to just display the ones that are linked?
|
|
|
06-20-2003, 03:07 AM
|
#6
|
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
|
You might try the find command with the -links option (man find). You could probably do something like this:
Code:
find / -name .profile -links 44
If you KNOW all the files are under /home (there may be some in /etc), then you can limit the search to just /home (find /home -name . . .).
|
|
|
06-20-2003, 08:26 AM
|
#7
|
LQ Newbie
Registered: Jun 2003
Posts: 5
Original Poster
Rep:
|
That did it! Thanks Moses..
Jim
|
|
|
06-22-2003, 12:37 PM
|
#8
|
LQ Newbie
Registered: Jun 2003
Posts: 4
Rep:
|
.profile is the scripts which is executed when u log in.. it will be in ur home directory itself(to chk home dir : at shell prompt type : echo $HOME or chk 6th field in '/etc/passwd' to know ur home dir"
|
|
|
All times are GMT -5. The time now is 03:13 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|