Tuesday, June 25, 2013

[LINUX_Newbies] Re: Grep questions

 



--- In LINUX_Newbies@yahoogroups.com, Cameron Simpson <cs@...> wrote:
>
> | Is root where the program files are?
>
> Root is where you start.

The meaning of root in Linux can be somewhat confusing as it may refer to the root user's home directory /root, or more commonly the root of the filesystem / Whoever initially designed these features must have been asleep at the keyboard when this snafu escaped them. Context usually sorts any potential confusion out though.

"Root is where you start."

I'm not sure what that means. Where you start (your origin) is your current working directory, which you can find with the pwd (print working directory) command. Although echo $PWD works too.

>
> Of you look at your $PATH variable by going:
>
> echo $PATH
>
> you will see a list of directories, separated by colons.
> Program files like in those directories.
>
> Normally there will be a "bin" directory in your own home directory,
> eg "/home/name/bin", at the start of your $PATH. This lets you write
> your own commands and have somewhere to put them.

I don't know what distribution you run but having a home bin directory in a user's path by default is definitely not normal.

>
> | Ist home where the data files are?
>
> Your home directory is where your files live, be they data or
> program. "/home" is a common convention for where the user home
> directories are stored. So in there is probably "/home/name"
> containing your files, and "/home/some-other-name" containing the
> files of another user.

While we're echoing things out of our environment one can either:

echo $HOME

or

echo ~

to see what their shell thinks their home directory is.

cd with no arguments will take you to your home directory too.

>
> | | A better command for your example might be:
> | |
> | | grep -r "thisismyAIM" . > resu.txt
> | |
> | | *
> | | grep -r "thisismyAIM" . > resu.txt
> | | Is this better then
> | | grep -r "thisismyAIM" * > resu.txt
> |
> | Slightly. "*" will not match files/directories starting with a dot ("."),
> | like .ssh. That is a convention to "hide" configuration files as a
> | matter of convenience.
> | It may be what you want, or it may not.
> |
> | *
> | So if I am searching for my data files like
> | text.txt
> | pic.gif
> | movie.avi
> |
> | then it is the same and I can use both like:
> | grep -r "thisismyAIM" . > resu.txt
> | grep -r "thisismyAIM" * > resu.txt
> | ?
>
> Pretty much, yes.
>
> | Searching * will missing the "dot" names.
>
> This is becuase then you type:
>
> grep thisismyAIM *
>
> the shell expands the "*" into a list of your files in the current
> directory, so the actual command that is _run_ looks like this:
>
> grep thisismyAIM movie.avi pic.gif text.txt
>
> (whatever the real files are, of course). The expansion of "*" will
> not include any "dot" files like ".bash_profile". This is a
> convenience.
>
> Cheers,
> --
> Cameron Simpson <cs@...>
>
> Clymer's photographs of this procedure show a very clean head. This is a lie.
> There is oil in here, and lots of it. - Mike Mitten, rec.moto, 29sep1993
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (17)
Recent Activity:
To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.
.

__,_._,___

No comments:

Post a Comment