Unable to use grep on terminal application

Asked by Melissa Alleva

I have a Mac that uses parallels so that I can use ubuntu in order to utilize the grep command to extract data from a file for a cybersecurity class. The problem is I can’t get the command to read the file, even though the files are downloaded to the ubuntu VM. I am not a programmer, and this is the first time I have even had this type of assignment. The root directory is not showing my credentials like I have seen on various YouTube videos. Please help.

Thank you,
Melissa

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Is the file readable by your user?
Doesn't MacOS have the grep utility?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2
Revision history for this message
Melissa Alleva (malleva) said :
#3

Thank you for your response.

On Sat, Nov 20, 2021 at 5:25 PM actionparsnip <
<email address hidden>> wrote:

> Your question #699570 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> actionparsnip requested more information:
> Yes... It does
>
> https://support.apple.com/en-gb/guide/terminal/apd8a205299-1c4c-4845-902a-6190e132b006/mac
>
> MacOS has the grep command.
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> You received this question notification because you asked the question.
>

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#4

Did you copy the file to the Ubuntu file system? What is it's name (case sensitive)

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

What is the command that you enter, and which response do you get?

Revision history for this message
Melissa Alleva (malleva) said :
#6

I did copy the files needed to the Ubuntu desktop, why am I not able to copy them to the parallels shared folder? Or change directory to the parallel desktop. When I try to change directory to the desktop it reads bash: cd: desktop: no such file or directory found? See screenshot.

Thank you,
Melissa

Sent from my iPhone

> On Nov 21, 2021, at 7:31 AM, Manfred Hampl <email address hidden> wrote:
>
> Your question #699570 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> Manfred Hampl requested more information:
> What is the command that you enter, and which response do you get?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> You received this question notification because you asked the question.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#7

Did you run:

cd ~/Desktop
grep something filename.txt

Obviously change the "something" for actual text and "filename.txt" for the actual file name (case sensitive. Use TAB to autocomplete the file name).

As stated by Manfred, can you please give the command(s) you are using and the full output.

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

1. Attaching images does not work, they do not arrive at launchpad questions.

2. The folder that represents the desktop usually is named Desktop with a capital D, so the command probably must be
cd Desktop

3. For diagnostic purposes please provide the full output that you receive for the following commands (to be executed in a terminal window):

uname -a
lsb_release -crid
apt-cache policy grep
ls ~

Revision history for this message
Melissa Alleva (malleva) said :
#9

Attached screenshot for info you requested.

Thank you.

Sent from my iPhone

> On Nov 21, 2021, at 12:25 PM, actionparsnip <email address hidden> wrote:
>
> Your question #699570 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> Status: Open => Needs information
>
> actionparsnip requested more information:
> Did you run:
>
> cd ~/Desktop
> grep something filename.txt
>
> Obviously change the "something" for actual text and "filename.txt" for
> the actual file name (case sensitive. Use TAB to autocomplete the file
> name).
>
> As stated by Manfred, can you please give the command(s) you are using
> and the full output.
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> You received this question notification because you asked the question.

Revision history for this message
Melissa Alleva (malleva) said :
#10

Trying to use grep command as shown on screenshot to read alert.txt file shown on desktop below.

Sent from my iPhone

> On Nov 21, 2021, at 1:00 PM, Melissa Alleva <email address hidden> wrote:
>
> Attached screenshot for info you requested.
>
> Thank you.
>
> <image0.jpeg>
>
>
> Sent from my iPhone
>
>> On Nov 21, 2021, at 12:25 PM, actionparsnip <email address hidden> wrote:
>>
>> Your question #699570 on Ubuntu changed:
>> https://answers.launchpad.net/ubuntu/+question/699570
>>
>> Status: Open => Needs information
>>
>> actionparsnip requested more information:
>> Did you run:
>>
>> cd ~/Desktop
>> grep something filename.txt
>>
>> Obviously change the "something" for actual text and "filename.txt" for
>> the actual file name (case sensitive. Use TAB to autocomplete the file
>> name).
>>
>> As stated by Manfred, can you please give the command(s) you are using
>> and the full output.
>>
>> --
>> To answer this request for more information, you can either reply to
>> this email or enter your reply at the following page:
>> https://answers.launchpad.net/ubuntu/+question/699570
>>
>> You received this question notification because you asked the question.

Revision history for this message
Manfred Hampl (m-hampl) said :
#11

Repeating: Screenshots do not work in mail attachments.

If you want to show an image, then you have to upload it to some image hosting service and paste the link to the image into your question document.

All output is plain text.
Why don't you just use copy and paste?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#12

You are using a text based interface and a text based forum.... So why a screenshot????

Just copy the text and paste as an update. Makes more sense wouldn't you say?

Revision history for this message
Melissa Alleva (malleva) said :
#13

I thought a screenshot would be useful to giving you the information you needed? Can we please get to a resolution?????

Sent from my iPhone

> On Nov 21, 2021, at 1:21 PM, actionparsnip <email address hidden> wrote:
>
> Your question #699570 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> actionparsnip requested more information:
> You are using a text based interface and a text based forum.... So why a
> screenshot????
>
> Just copy the text and paste as an update. Makes more sense wouldn't you
> say?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> You received this question notification because you asked the question.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#14

Not without the command and output. The whole thing is text based. Please copy the text from the terminal and paste as an update.

Revision history for this message
Manfred Hampl (m-hampl) said :
#15

"I thought a screenshot would be useful"

Please look at your launchpad question document https://answers.launchpad.net/ubuntu/+question/699570
It is not possible to add a screenshot to a launchpad question document.

Due to the fact that everything in a terminal window is just plain text, you can copy and paste the contents into the question document as text.

We want to see:

1. the "grep" command that you execute and the output that you receive

2. the output of the following commands
uname -a
lsb_release -crid
apt-cache policy grep
ls ~

That should help finding a resolution.

Revision history for this message
Melissa Alleva (malleva) said :
#16

parallels@parallels-Parallels-Virtual-Platform:~$ cd desktop
bash: cd: desktop: No such file or directory
parallels@parallels-Parallels-Virtual-Platform:~$ uname -a
Linux parallels-Parallels-Virtual-Platform 5.11.0-37-generic
#41~20.04.2-Ubuntu SMP Fri Sep 24 09:06:38 UTC 2021 x86_64 x86_64 x86_64
GNU/Linux
parallels@parallels-Parallels-Virtual-Platform:~$ lsb_release ~crid
Usage: lsb_release [options]

lsb_release: error: No arguments are permitted
parallels@parallels-Parallels-Virtual-Platform:~$ apt-cache policy grep
grep:
  Installed: 3.4-1
  Candidate: 3.4-1
  Version table:
 *** 3.4-1 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
parallels@parallels-Parallels-Virtual-Platform:~$ ls
192.168.1.170:56564 Desktop Downloads Music Public Videos
alert.text Documents fontconfig Pictures Templates

On Sun, Nov 21, 2021 at 2:30 PM Manfred Hampl <
<email address hidden>> wrote:

> Your question #699570 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> Manfred Hampl requested more information:
> "I thought a screenshot would be useful"
>
> Please look at your launchpad question document
> https://answers.launchpad.net/ubuntu/+question/699570
> It is not possible to add a screenshot to a launchpad question document.
>
> Due to the fact that everything in a terminal window is just plain text,
> you can copy and paste the contents into the question document as text.
>
> We want to see:
>
> 1. the "grep" command that you execute and the output that you receive
>
> 2. the output of the following commands
> uname -a
> lsb_release -crid
> apt-cache policy grep
> ls ~
>
> That should help finding a resolution.
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/ubuntu/+question/699570
>
> You received this question notification because you asked the question.
>

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#17

The command is

cd ~/Desktop

Not

cd ~/desktop

Linux is VERY case sensitive, so capitals matters and is why you were told that the directory couldn't be found.

Revision history for this message
Launchpad Janitor (janitor) said :
#18

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.