How Do I Know If A File Has A Hard Link To It?

ok I know when I create a soft link, it shows a ----> in a long listing and is colored (if ls --color) in aqua.

But hard links don't do this. How can I tell if a file/dir has a hard link to it or if it points to another file?


Similar Content



Kinds Of Links In Linux And Use Of Unlink

Hello, I am learning about file types in Linux, and i see there are hard and symbolic links, also I saw that unlink function in C deletes a link to a file and decrements the intern link counter. The problem is that i don't understand what link is deleted when unlink is called. Is it the parents link to that file?

The Behaviour Of Single & Double Quotes In Writing & Running Aliases?

This isn't a problem, more a how or a why:

I have always written an alias (alias ln="ln -sv") which changes the instruction for a "hard" link into one for a "soft". This worked fine until I needed a hard link, so, as part of the alias, I decided to give myself a reminder of what I was doing. After a bit of a struggle, I ended up with this (which I stuffed into my .bash_aliases file):

alias ln="echo -e 'Symbolic (soft) Link (use \033[1;36mhln\033[0m for Hard Link)\nuse \033[1;36m-f\033[0m for force'; ln -sv "

and it works:

Symbolic (soft) Link (use hln for Hard Link )
use -f for force
ln: missing file operand
Try 'ln --help' for more information.

(OK, no operand was supplied here, but the stuff we're talking about works fine).

Recently, however, I needed to look at the construction of the alias, ran "alias ln" & got:

alias ln='echo -e '\''Symbolic (soft) Link (use \033[1;36mhln\033[0m for Hard Link)\nuse \033[1;36m-f\033[0m for force'\''; ln -sv'

Now, I can (sort of) understand the logic of what's going on here, but not entirely - viz:

..1...'...............Open 'protected' mode (was double quote)
........echo -e....Command: invoke "echo -e"
..2...'...............matches 1: Closes 'protected' mode
........\.............invoke newline(\)? Or is this simply an scape character? (Yes it is see http://www.linuxquestions.org/questi...-quote-861714/)
..3...'...............Reopen 'protected' mode (or an escaped single quote - if so why?)
..4...'...............0pens 'protected' mode for "message" code
........Symbolic (soft) Link (use \033[1;36mhln\033[0m for Hard
........Link)\nuse \033[1;36m-f\033[0m for force
..5...'...............5 matches 4 (closes message code),
........\.............invoke newline(\) - or see above
..6...'...............6 matches 3 & closes the section started @ 'reopen'
..7...'...............Reopens 'protected' mode
........; ln -sv......New command[ ; ], creates link
..8...'...............8 matches 7 - the end (or is it?)

I would guess that the "alias" command has some built built in function that does all this - I have saved the the modified version as an alias & it works fine - but although I have read the excellent post:

http://www.linuxquestions.org/questi...-quote-861714/

I don't understand why the system has both double & single quotes. I have always felt that as long as the command line was explained & demonstrated in simple language it was easier to work with that than any point & click system. I grew up with CPM, DOS, Qemm, Desqview, WP5.1, DbII and these were great programs with great (especially WP51) manuals - but, ahh! - those days have gone

Any suggestions gratefully received

dmk

Hard Disk Damaged?

I tried to install Debian 8 and 7 but I get error message at partitioning stage:

"Failed to create a file system
The ext4 file system creation in partition #1 of SCSI1 (0,0,0) (sda) failed."

After that I couldn't advance further.

I booted from a live Debian and the HardDisk actually shows there with some older files on it.

I tried to install even Windows but from the start it shows the computer doesn't have a Hard Disk Drive so the installation stops right at the start.

Any ideas what is wrong and is there any fix?

In A Cpp Application I Am Deleting A File On A Partition, But Space Is Not Freeing..

1) deleting file using remove() call
2) no other hard link for the file
3) tried to close file descriptor using following scripts then remove() call
-------
for fd in $(ls /proc/$$/fd); do
case "$fd" in
0|1|2|255)
;;
*)
eval "exec $fd>&-"
;;
esac
done
-------

But space not freed

4) I tried with truncate() and then remove() call Now files deleted and space freed

Is it the only and right way to do this?

How To View Only Hard Links

Hi All,

Is there any command or shell scripting to view only the link files under / .

Soft Link

Hello everyone!
I wonder if you can help me with the following:
If you have the following directory and subdirectories,
UDIR1 ---MAIN DIRECTORY
under UDIR1 there is two subdirectories: UDIR11 AND UDIR12
under UDIR11 there is a subdirectory: UDIR111
under UDIR12 there are two subdirectories: UDIR121 and UDIR122
Given the above scenario:
1- How to create a soft link of the directory UDIR111 under the directory UDIR12, and then how do you name the soft link UDIR111-sl

Thanks so muchhhhhhhhhh to anyone who can help!!

Regards,
Carlos

Terminal Not Responding

i m running file following tcl script but terminal shows nothing no error no nam file nothing
whats wrong with this script??????


set ns [new Simulator]

set nf [open out.nam w]
$ns namtrace-all $nf

proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0
}

for {set i 0} {$i < 7} {incr $i} {
set n($i) [$ns node]
}

for {set i 0} {$i < 7} {incr $i} {
$ns duplex-link n($i) n([expr ($i+1)%7]) 1mb 10ms dropTail

$ns at 5.0 "finish"

$ns run

i write ns example3.tcl on terminal but terminal shows nothing even after waiting for long. when choose to close terminal it shows msg something running want to kill terminal

Possible To Create Symbolic Link On Live USB For Main System?

Hello all,

I was going through LFS yesterday and planned to change the symbolic link from "{bin/sh}{dash}" to "{bin/sh}{bash}". Unfortunately, I disconnected from bin/sh but forgot to create another link. Now the system won't boot and failed to shutdown. Wondering if I can make a symbolic link for it on the Live USB or is there another solution? The Distro is Linux Mint 17.1.

Thanks.

How To Patch OSPF In Ns2.34

Hi mates,

I am trying to patch ospf in ns-2.34 i have downloaded the patch file from link:

http://sourceforge.net/projects/ospf...s/ospf4ns2.34/

$ cd ns-allinone-2.34/
$ patch -p0 < 20-ospf4ns2.34-examples.patch

Using : $ cd ns-2.34/
# make install

$ cd tcl/ex/ospf/
$ mkdir out_ospf0 out_ospf1 out_ospf2 out_ospf3 out_ospf4 out_ospf5 out_ospf6 out_ospf7 out_ospf8 out_ospf9
$ ns ospf0.tcl

i followed the procedure from below LQ link post no #3

http://www.linuxquestions.org/questi...-a-4175492253/

it is successfully patchinf file but it is showing error when i execute ospf0.tcl file



Quote:
(TCL) Creating simulator & trace files...
(TCL) Setting up nodes and links...
(TCL) Configuring traffic objects...
(TCL) Configuring routing protocol...
invalid command name "Agent/rtProto/OSPF"
while executing
"Agent/rtProto/OSPF set helloInterval 1"
(file "ospf0.tcl" line 132)



pls anyone suggest me ideas to get rid of this err.

Thanks in Advance,

Pon

Mounted Fat32. But Read Only

Hello,

i mounted a fat32 partition located in my external 500GB USB Hard Disk to /mnt/fat32 using su root at shell.

then i see it is read only for my user account. the gnome file manager shows all the files and folders, but i cannot past or create anything.

so i #chmod 777 /mnt/fat32

but problem still remain same.