1) How to check if the final destination file of a soft link actually exists or not ?
2) ls –ltr
shows permission, user, group, size, date time, name etc. what command would you use if you want to see only the name column (nothing else, without grep
or awk
command)
1) How to check if the final destination file of a soft link actually exists or not ?
To achieve this with simple linux commands you can use stat -L
, this will throw an error if the destination file does not exists.
Also this command will return 0
if the destination file exists or >0
if it doesn't. So you can use echo $?
after using it and check if it is not 0.
2) ls –ltr shows permission, user, group, size, date time, name etc. what command would you use if you want to see only the name column (nothing else, without grep or awk command)
You can just type ls -1
to get file names alone.