Driving crazy with a simple question:
Code: Select all
ps -ef | grep skype
grep: command not found
What I'm missing here?
Thanks in advance,
Code: Select all
ps -ef | grep skype
grep: command not found
I guess you are missing grep (though I don't know why).What I'm missing here?
Code: Select all
apt-cache policy grep
Code: Select all
echo $PATH
Code: Select all
verdow@w1-techcage-02 ~ $ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Code: Select all
ps -ef | /bin/grep skype
No, it's with the same user and session...RedWagon wrote:are you switching users or using different terminal sessions when it doesn't work? Grep is there at /bin/grep so the problem is most likely with the shell finding grep and not the installation of grep itself. Do you have a weird partition table? Also run echo $PATH right after it doesn't work to see if your PATH is being changed by something.
No, it means that the terminal session can't find the command 'grep'.BrianD wrote:umm...
if the report you're getting back says
grep: command not found
that would indicate that the program `grep` is reporting "command not found"
Thanks for your answeres team.DrHu wrote:Instead of trying to fix a compound command, just use grep itself: does it then work or not ?
In a terminal, checkIf you get a response, then YES grep is working and there is something else incorrect, even though it looks fine from your code display |grep
- grep
--your response is ?- /bin/grep
--your response is ?
Even though I don't have skype installed, if i cut and past your command I do get a response--whether or not there is none or more spaces before the grep command
- ps -ef | grep skype
MintuserID 6016 3445 0 14:13 pts/0 00:00:00 grep --colour=auto skype
Code: Select all
$ grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
$ /bin/grep
Usage: /bin/grep [OPTION]... PATTERN [FILE]...
Try `/bin/grep --help' for more information.
Code: Select all
$ ps -ef | grep skype
renton 7905 7782 0 10:53 pts/0 00:00:00 grep --colour=auto skype
$ sudo ps -ef | grep skype
grep: command not found
Using sudo would be running that command as a different user, root.Maybe a problem combining with SUDO?
Code: Select all
sudo echo $PATH
Code: Select all
su
echo $PATH
exit
...actually, both of those should display the same information. if you invoke "su" by itself, it will su to root and keep the current environment. to su to root and use root's environment, you should invoke it withRedWagon wrote:Using sudo would be running that command as a different user, root.Maybe a problem combining with SUDO?
There's no reason to run that command as root. Using root with these commands won't hurt anything, but if you keep arbitrarily running stuff as root you have a much higher chance of breaking something. Root has a different path than other users, and when you use sudo you're using root's $PATH to find commands. However, runningwill display the path of the user running sudo and not root's which is weird. Paste back root's path by runningCode: Select all
sudo echo $PATH
Code: Select all
su echo $PATH exit
Code: Select all
su -
echo $PATH
exit
Well, you're right about su - showing a different path but check this out:...actually, both of those should display the same information. if you invoke "su" by itself, it will su to root and keep the current environment. to su to root and use root's environment, you should invoke it with
Code: Select all
verdow@w1-techcage-02 ~ $ echo $PATH
/home/verdow/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
verdow@w1-techcage-02 ~ $ sudo echo $PATH
/home/verdow/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
verdow@w1-techcage-02 ~ $ su
Password:
w1-techcage-02 verdow # echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
w1-techcage-02 verdow # exit
exit
verdow@w1-techcage-02 ~ $ su -
Password:
w1-techcage-02 ~ # echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
w1-techcage-02 ~ # exit
logout
verdow@w1-techcage-02 ~ $
hint given, previously.RedWagon wrote:how would I add /home/verdow/.bin to the user environment so that su will see it? It's really handy having my scripts in my home directory, but none of them can be run as root until I create a symbolic link from ~/.bin/script to /usr/local/bin/script
I have no idea what's happening with that... it's just "strange"RedWagon wrote: I know this tread has become sidetracked, but we're still here to hep with the grep issue talacasto.