LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 02-24-2015, 07:20 AM   #1
arun natarajan
Member
 
Registered: Jun 2014
Posts: 108

Rep: Reputation: Disabled
how to view only hard links


Hi All,

Is there any command or shell scripting to view only the link files under / .
 
Old 02-24-2015, 07:50 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,206

Rep: Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675Reputation: 2675
what do you mean by that?
when you execute ls -l you will see something like this:
Code:
eporand@elxj3lld12-mf:/tmp/a$ ls -la
total 0
drwxr-xr-x  2 user group 140 Feb 24 14:46 .
drwxrwxrwt 17 root    root      580 Feb 24 14:45 ..
-rw-r--r--  3 user group   0 Feb 24 14:46 asdf
-rw-r--r--  3 user group   0 Feb 24 14:46 asdf1
-rw-r--r--  1 user group   0 Feb 24 14:46 asdf2
-rw-r--r--  3 user group   0 Feb 24 14:46 asdf3
-rw-r--r--  1 user group   0 Feb 24 14:46 asdf4
at the hardlinked files you will see the number of hard links.
also you can check the man page of find (see -links)
 
1 members found this post helpful.
Old 02-24-2015, 10:11 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,806

Rep: Reputation: 4179Reputation: 4179Reputation: 4179Reputation: 4179Reputation: 4179Reputation: 4179Reputation: 4179Reputation: 4179Reputation: 4179Reputation: 4179Reputation: 4179
Quote:
Originally Posted by arun natarajan View Post
Hi All,
Is there any command or shell scripting to view only the link files under / .
As suggested, you can read the man page on the find command, and also read the man page on the ls command. BOTH have ample documentation to let you do what you're after. And if you want to write a shell script to do this, that's certainly something that can be done.
 
Old 02-24-2015, 10:25 AM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,459

Rep: Reputation: 2053Reputation: 2053Reputation: 2053Reputation: 2053Reputation: 2053Reputation: 2053Reputation: 2053Reputation: 2053Reputation: 2053Reputation: 2053Reputation: 2053
Every file/dir that's not a sym link is a hard link. So a simple inverse sym link search would return everything that is not a sym link, and is therefore a hard link.

Last edited by suicidaleggroll; 02-24-2015 at 10:28 AM.
 
Old 02-24-2015, 11:59 AM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,400

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Quote:
Originally Posted by suicidaleggroll View Post
Every file/dir that's not a sym link is a hard link.
And for that matter, every symlink has at least one hard link, i.e., the directory entry that points to the inode that contains the symlink. The only things in the filesystem that do not have a hard link are deleted files that are held open by some process and will be removed as soon as they are closed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard links and soft links - the esoteric details tekra Linux - General 2 10-09-2014 01:15 AM
Choosing between soft links and hard links. tekra Linux - General 6 01-03-2013 07:36 PM
technical question about hard links v soft links 7stud Linux - Newbie 2 02-23-2007 06:57 PM
links (hard links and soft links..) sachitha Programming 1 08-10-2005 12:10 PM
How To View Links Using RealPlayer zensufi Linux - Software 5 07-29-2004 05:43 PM


All times are GMT -5. The time now is 03:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration