WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: grep  (Read 2592 times)

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
grep
« on: June 02, 2016, 01:41:55 AM »
Code: [Select]
tc@box:~$ which grep
/bin/grep

Code: [Select]
tc@box:~$ sudo find / -name "grep"
/bin/grep
/bb/grep
/tmp/tcloop/xorg-intel/bin/grep

Clarification for wiki. Based on above my system uses faster grep? Does /bin/grep standard in all xorg-* extensions? Xvesa does not include grep. So only those running Xvesa or non-graphic would benefit from the extra GNU grep install for speed?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11225
Re: grep
« Reply #1 on: June 02, 2016, 07:57:28 AM »
Hi nitram
Actually, that does not tell you which  grep  is really being used since  /bin/grep  could be an executable or a link to an
executable. To find out, run:
Code: [Select]
ls -l /bin/grep

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: grep
« Reply #2 on: June 02, 2016, 01:56:20 PM »
Thanks Rich.

Actually it is a link to xorg-intel's /bin/grep, so looks like the faster grep is being used?

Code: [Select]
tc@box:~$ ls -l /bin/grep
lrwxrwxrwx 1 root root 31 Jun  2 14:26 /bin/grep -> /tmp/tcloop/xorg-intel/bin/grep

Does /bin always take precedence over /bb ?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11225
Re: grep
« Reply #3 on: June 02, 2016, 02:18:44 PM »
Hi nitram
Quote
Does /bin always take precedence over /bb ?
Precedence is determined by the  $PATH  variable.

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: grep
« Reply #4 on: June 02, 2016, 03:28:34 PM »
Thanks again. For those learning like me, /etc/profile provides system wide profile and path info:
Code: [Select]
# /etc/profile: system-wide .profile file for the Bourne shells
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/bb"

Not sure where /$HOME/.local/bin fits into this, will figure out with a bit of experimentation.

To wrap up, Jason or any dCore users know if GNU grep is automatically installed with all xorg-* SCEs?
If not, will just provide brief explanation in the wiki, thanks.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11225
Re: grep
« Reply #5 on: June 02, 2016, 06:21:20 PM »
Hi nitram
Quote
Not sure where /$HOME/.local/bin fits into this, will figure out with a bit of experimentation.
The  $HOME  variable expands to a path to the home directory of the current user. The default user is  tc , so it expands to:
Code: [Select]
tc@box:~$ echo $HOME
/home/tc
tc@box:~$
If you created a user nitram and logged in as nitram, it would look like this:
Code: [Select]
nitram@box:~$ echo $HOME
/home/nitram
nitram@box:~$
/$HOME/.local/bin  shows up at the beginning of  $PATH  :
Code: [Select]
tc@box:~$ echo $PATH
/home/tc/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/sda3/tce/ondemand
tc@box:~$
/$HOME/.local/bin  is a good place for scripts and executables that should be unique to a particular user.

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: grep
« Reply #6 on: June 03, 2016, 07:39:57 AM »
As for if the grep package from Debian/Ubuntu is installed as a part of any SCE, then that is the grep that is used and that helps sce-import performance tremendously.  Below is my $PATH on my dCore-trusty:

/home/jason/Applications/.bin:/usr/bin:/home/jason/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/bb:/etc/sysconfig/tcedir/ondemand

Notice how /bb is near the last on the list, busybox apps are only used when their full versions are not installed.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11225
Re: grep
« Reply #7 on: June 03, 2016, 07:54:37 AM »
Hi Jason W
Your path  $PATH  has  /usr/bin  listed twice.

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: grep
« Reply #8 on: June 03, 2016, 08:07:32 AM »
Thanks.  That must be due to an application tacking that on to the beginning of PATH, as with the /home/jason/Applications, as neither of those is at the beginning of PATH in either ~/.profile or /etc/profile.   If I remember enlightenment takes the directory used by "--prefix=" when compiling and adds it to the beginning of the PATH. 


Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: grep
« Reply #9 on: June 03, 2016, 05:10:53 PM »
Thanks all, will just add detailed notes to wiki so users can check for themselves which  grep  they're using.

Offline nitram

  • Hero Member
  • *****
  • Posts: 1054
Re: grep
« Reply #10 on: June 05, 2016, 08:09:34 PM »
dCore's grep wiki was updated to best of my abilities. Simple case study at the bottom, quite a difference, /bb/grep vs GNU Grep. Thanks again for all the help. Due to re-organizing the link may be moved later, but it's here now in case it helps someone else. Got me curious, will need to check my TC6 install later: http://wiki.tinycorelinux.net/dcore:handling_extensions?&#notice_about_grep.