carzhero2014
Posts: 1
Joined: Tue Jun 09, 2020 9:12 am

Check Understanding of Basic Pi Terminal Commands

Tue Jun 09, 2020 9:39 am

Hi Guys,
I haven't gotten my Pi yet because I lost it and I would like your help in checking if I am correct with what the functions do and explain the 3 that I am unsure about.

pwd shows you the current directory (print working directory).

ls will list the contents of the directory.

cd
is used to change the directory. For example, cd edward with switch you to a child directory called “Edward” while cd.. returns focus to the parent directory.

mkdir newdir will create a new directory, where “newdir” is the directory label. You can also create a succession of new directories with mkdir -p /home/edward/newdir1/newdir2, where both newdir1 and newdir2 are created, but this will only work with the -p


These 3 I am not sure what they are. It would be appreciated if someone explains what they do.

touch mytext.txt

nano mytext.txt

rm mytext.txt

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26716
Joined: Sat Jul 30, 2011 7:41 pm

Re: Check Understanding of Basic Pi Terminal Commands

Tue Jun 09, 2020 11:03 am

Smells like spam to me, or someone on a homework assignment.

But just in case.

touch updates the timestamp on a file to the current time
nano is an editor
rm remove a file

All these could easily be found using a search engine....
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Check Understanding of Basic Pi Terminal Commands

Tue Jun 09, 2020 11:07 am

cd is used to change the directory. For example, cd edward with switch you to a child directory called “Edward”
Wrong!

User avatar
jojopi
Posts: 3274
Joined: Tue Oct 11, 2011 8:38 pm

Re: Check Understanding of Basic Pi Terminal Commands

Tue Jun 09, 2020 11:11 am

carzhero2014 wrote:
Tue Jun 09, 2020 9:39 am
while cd.. returns focus to the parent directory.
Also wrong.

man command will show the manual for command, so you do not have to ask the internet every time.

pidd
Posts: 724
Joined: Fri May 29, 2020 8:29 pm
Location: Birkenhead, Wirral, UK
Contact: Website

Re: Check Understanding of Basic Pi Terminal Commands

Tue Jun 09, 2020 11:42 am

jojopi wrote:
Tue Jun 09, 2020 11:11 am
carzhero2014 wrote:
Tue Jun 09, 2020 9:39 am
while cd.. returns focus to the parent directory.
Also wrong.

man command will show the manual for command, so you do not have to ask the internet every time.
Not sure which way you meant it but neither "man command" nor "man cd" works for me?

"cd.." needed a space "cd .."

jowage
Posts: 9
Joined: Sat Jun 06, 2020 3:21 pm

Re: Check Understanding of Basic Pi Terminal Commands

Tue Jun 09, 2020 11:49 am

pidd wrote:
Tue Jun 09, 2020 11:42 am
jojopi wrote:
Tue Jun 09, 2020 11:11 am
carzhero2014 wrote:
Tue Jun 09, 2020 9:39 am
while cd.. returns focus to the parent directory.
Also wrong.

man command will show the manual for command, so you do not have to ask the internet every time.
Not sure which way you meant it but neither "man command" nor "man cd" works for me?

"cd.." needed a space "cd .."
"help cd"

and cd edward will not go to directory "Edward" because file paths and names are case sensitive

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Check Understanding of Basic Pi Terminal Commands

Tue Jun 09, 2020 11:53 am

pidd wrote:
Tue Jun 09, 2020 11:42 am
jojopi wrote:
Tue Jun 09, 2020 11:11 am
carzhero2014 wrote:
Tue Jun 09, 2020 9:39 am
while cd.. returns focus to the parent directory.
Also wrong.

man command will show the manual for command, so you do not have to ask the internet every time.
Not sure which way you meant it but neither "man command" nor "man cd" works for me?

"cd.." needed a space "cd .."

The "Don't shoot the Messenger" reply -

cd is something that is built in to the shell (command line processor) that you are using. So you would need man bash, and then search for cd, which would give you this -
cd [-L|[-P [-e]] [-@]] [dir]
Change the current directory to dir.

User avatar
bensimmo
Posts: 4654
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Check Understanding of Basic Pi Terminal Commands

Tue Jun 09, 2020 11:59 am

If the plate comes back or not at least a search will.pick it up and I may as well add.

If you're starting out, have a look at this.

https://www.raspberrypi.org/magpi-issue ... ash_v1.pdf

User avatar
CaptainMidnight
Posts: 89
Joined: Sun Nov 03, 2019 4:32 pm
Location: UK

Re: Check Understanding of Basic Pi Terminal Commands

Tue Jun 09, 2020 2:11 pm

I'd also highly recommend some of the free to download raspberry pi books (you can also buy print versions at low cost).

Here's the one about the command line.

https://magpi.raspberrypi.org/books/com ... nd-edition
"Never get out of the boat." Absolutely goddamn right!
Unless you were goin' all the way...

Return to “Beginners”