Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Hi, i'm learning Linux (Beginner). i have a few command questions hoping someone could answer, please

 

 

1 - i was working on the command line and forgot where i was. What command would I use to find which directory I'm in?

 

2 - Write the commands. On the desktop of your computer there is a file called cat and inside there is a file called dog. Using command line commands, navigate from the desktop to dog, make a new file and name it kitten, go to cat and print a list of content.

 

 

Thank You

 

 

Link to post
Share on other sites

1.  pwd

 

2. This sounds like you're working on an assignment of some sorts, so I'm not going to directly answer.

 

You should look up each of these steps individually.

 

Creating files and printing files. I'm sure you know how to traverse seeing question 1 

Community Standards || Tech News Posting Guidelines

---======================================================================---

CPU: R5 3600 || GPU: GTX 1080 || Memory: 16GB @ 3200 || Cooler: Noctua D15 || PSU: 750W EVGA G2 || Case: Define C

Link to post
Share on other sites
1 hour ago, Slottr said:

1.  pwd

 

2. This sounds like you're working on an assignment of some sorts, so I'm not going to directly answer.

 

You should look up each of these steps individually.

 

Creating files and printing files. I'm sure you know how to traverse seeing question 1 

 

 

for the second one, i came up with this, does it look correct?? Thank You

 

- find Cat -dog

- touch kitten

- pr <option(s)> <cat>

 

 

Link to post
Share on other sites

 

1 hour ago, Clueless_Gamer said:

for the second one, i came up with this, does it look correct?? Thank You

 

- find Cat -dog

- touch kitten

- pr <option(s)> <cat>

the format for find is wrong.  "find ./cat/dog" is probably what your looking for

https://www.man7.org/linux/man-pages/man1/find.1.html

 

touch is correct, as it will make a empty file named kitten

https://linux.die.net/man/1/touch

 

I have never heard of the command "pr", learn something new every day. This is however just a formatter, so it wont do you much.

https://linux.die.net/man/1/pr

 

 

Probably looking for something along the lines of this.

cd ~/Desktop/cat/dog && touch kitten && find ../

 

Link to post
Share on other sites
Quote

1 - i was working on the command line and forgot where i was. What command would I use to find which directory I'm in?

The command you are looking for is pwd.

Quote

2 - Write the commands. On the desktop of your computer there is a file called cat and inside there is a file called dog. Using command line commands, navigate from the desktop to dog, make a new file and name it kitten, go to cat and print a list of content.

I don't understand what you mean by having a file inside another file. Do you mean there is a directory named cat which contains a directory named dog? Also, what do you mean by "navigate from the desktop"? The desktop usually refers to a GUI environment -- not a command line. Do you maybe mean the commonly found Desktop directory in a user's home directory? I'm going to assume "yes" to both of my questions.

 

I'm assuming you have a directory structure like this:

/

/home/

/home/username/

/home/username/Desktop/

/home/username/cat/

/home/username/dog/

 

Assuming you are already in /home/username/Desktop, you would type " cd ~/dog" to change to the dog directory. You would then type "touch kitten" to create that file. You could then type "cd ~/cat" to change to that directory. Finally, you would type "ls" to list the contents of that directory.

 

Commands to know:

~ is not a command, but it is shorthand for the current user's home directory.

cd - change directory.

pwd - show the current directory

ls - list the contents of a directory

cat - concatenate; it is used to join two files together, but it is also commonly used to display the contents of a single file to the screen.

Link to post
Share on other sites
On 9/18/2020 at 1:14 AM, Clueless_Gamer said:

Hi, i'm learning Linux (Beginner). i have a few command questions hoping someone could answer, please

 

 

1 - i was working on the command line and forgot where i was. What command would I use to find which directory I'm in?

 

2 - Write the commands. On the desktop of your computer there is a file called cat and inside there is a file called dog. Using command line commands, navigate from the desktop to dog, make a new file and name it kitten, go to cat and print a list of content.

 

 

Thank You

 

 

https://sourceforge.net/projects/linuxcommand/files/TLCL/17.10/TLCL-17.10.pdf/download

Grumpy Old Man

    Since 1899

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×