Tag Info

New answers tagged


There is also stat: $ touch test $ ln -s test test_l $ stat test File: `test' Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: fc00h/64512d Inode: 4309 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 1000/ vagrant) Gid: ( 1000/ vagrant) Access: 2015-09-11 11:37:59.864165922 +0000 Modify: 2015-09-11 ...


From one of the sections that you cite: Optional utilities that are present only on systems supporting the associated option; see Codes for information on the options in this volume of IEEE Std 1003.1-2001 The mandatory utilities are the ones that are not marked as optional. For example basename has no annotation to indicate that it's optional, so ...


All utilities are mandatory except when they are marked special. Look e.g. at the documentation for the get command that is maked with the "Development" tag. Check e.g. Chapter 1.7.1 and look for the tag "optional".


Alternatively you can use a simple script: #!/bin/bash ls -alFQ | grep '^l' The Unix mantra is to have small simple utilities that can be chained together to achieve complex task. So while this is technically not a POSIX utility, it's very close to one. If you want to get fancy you can only select what portion of the string to return: #!/bin/bash ...


Two utilities could do that for you, fileand readlink: file some_symlink will display some_symlink: symbolic link to 'some_target' readlink some_symlink will exit with code 0 whereas readlink some_file will exit with code 1 Note that exit code is stored in variable $?, and can be displayed with echo $?.


You're looking for test: -h pathname True if pathname resolves to a file that exists and is a symbolic link. False if pathname cannot be resolved, or if pathname resolves to a file that exists but is not a symbolic link. If the final component of pathname is a symlink, that symlink is not followed. Most shells have it as a builtin, but test also ...

Top 50 recent answers are included