I am facing issue when I am trying to run any command from /usr/bin/ folder. I can see a link to the files exists in this folder but when I run giving absolute path it gives me below error.
1. $ /usr/bin/awk
-bash: /usr/bin/awk: No such file or directory
2. $ man awk
sh: /usr/bin/gunzip: No such file or directory
fgets: No such file or directory
Error reading man page /usr/share/man/man1/awk.1.gz
No manual entry for awk
Below command shows that the links exist in the folder
$ ls -ltr /usr/bin/awk
lrwxrwxrwx. 1 root root 14 Nov 28 10:16 /usr/bin/awk -> ../../bin/gawk
$ ls -ltr /usr/bin/gunzip
lrwxrwxrwx. 1 root root 16 Nov 28 10:25 /usr/bin/gunzip -> ../../bin/gunzip
and when I am running the command without pointing to /usr/bin I am getting the below message. Seems like the commands are find just like the links are not working. Does that mean I have to rebuild the links? is there a quick way to rebuild them?
Thanks!!
$ /bin/awk
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
Usage: awk [POSIX or GNU style options] [--] 'program' file ...
POSIX options: GNU long options:
-f progfile --file=progfile
-F fs --field-separator=fs
-v var=val --assign=var=val
-m[fr] val
-O --optimize
-W compat --compat
-W copyleft --copyleft
-W copyright --copyright
-W dump-variables[=file] --dump-variables[=file]
-W exec=file --exec=file
-W gen-po --gen-po
-W help --help
-W lint[=fatal] --lint[=fatal]
-W lint-old --lint-old
-W non-decimal-data --non-decimal-data
-W profile[=file] --profile[=file]
-W posix --posix
-W re-interval --re-interval
-W source=program-text --source=program-text
-W traditional --traditional
-W usage --usage
-W use-lc-numeric --use-lc-numeric
-W version --version
To report bugs, see node `Bugs' in `gawk.info', which is
section `Reporting Problems and Bugs' in the printed version.
gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.
Examples:
gawk '{ sum += $1 }; END { print sum }' file
gawk -F: '{ print $1 }' /etc/passwd
What happens when you run a command in /usr/bin that is not symlinked? On my system "yes" is an example of that.
$
$ ls -l /usr/bin/yes
-rwxr-xr-x 1 root root 20352 Nov 27 2006 /usr/bin/yes
$ /usr/bin/yes | sed 2q
y
y
$
Also does /usr/bin/awk fail for root?
Also try this:
$
$ ls -l /usr/bin/awk | od -c
0000000 l r w x r w x r w x 1 r o o
0000020 t r o o t 1 4 J u n 2 4
0000040 2 0 1 0 / u s r / b i n /
0000060 a w k - > . . / . . / b i n
0000100 / g a w k \n
0000106
$
$
It yes command is working exactly as your example.
# /usr/bin/yes | sed 2q
y
y
# ls -l /usr/bin/yes
-rwxr-xr-x. 1 root root 25664 May 16 2013 /usr/bin/yes
Ahamed101 - It seems like I have to create the links again. but a bit concerned if that is the actual cause of issue, because it was working fine previously before I mounted /tmp to another device and then mounted on /usr's device and now moved back to /'s device.
I don't follow that surgery you attempted on your filesystem, but assuming you got stuff back to the original location it should be working now. Try to manually recreate a single and see if that helps. I don't think it will help, but maybe it is worth a try. Try a different shell... maybe your shell's environment is screwed up. Also post the output from df -k .