DEV Community

loading...

Using terminal

helen8297 profile image Helen Kent Updated on ・1 min read

I want to be able to use the terminal properly with GitHub but I have only used it once in a meetup (codebar in Birmingham) and it was very useful, but quite a whistle stop tour. I'm going to get my head around terminal and then learn how to use it with GitHub. I found the following at macworld.com, macpaw.com and git-tower.com

  • To list the directory you're in
ls 
Enter fullscreen mode Exit fullscreen mode
  • To show where you currently are (stands for print working directory)
pwd
Enter fullscreen mode Exit fullscreen mode
  • To go to your home folder
cd
Enter fullscreen mode Exit fullscreen mode
  • To go from the home folder to another one (desktop for instance, type
cd Documents

or

cd Desktop/thefoldername
Enter fullscreen mode Exit fullscreen mode
  • To go to the directory above the one you're currently in
cd ..
Enter fullscreen mode Exit fullscreen mode
  • To go back to the directory you were in before
cd -
Enter fullscreen mode Exit fullscreen mode
  • "~". This sign stands for your user account's home folder. So, instead of typing something like
cd /Users/your-username/projects/
Enter fullscreen mode Exit fullscreen mode

You should use this shorthand form

cd ~/Desktop
Enter fullscreen mode Exit fullscreen mode

-To make a new folder, you call the "make directory" command

mkdir nameofnewfolder
Enter fullscreen mode Exit fullscreen mode

To delete a folder you type rm -r then the file path e.g.

rm -r ~/downloads/nameofthefolder     
Enter fullscreen mode Exit fullscreen mode

(the -r stands for recursive)

  • To go to the root level of your startup disk. Don't fiddle around with this though unless you know what you're doing.
cd /,
Enter fullscreen mode Exit fullscreen mode

Type bc to get a calculator working!

Vocab:
relative path = is path relative to the directory you're currently in - jumping from one to next
absolute path = is the path relative to the root -giving the whole address thing

Discussion (6)

Collapse
georgecoldham profile image
George

Great summary of the most used commands!

How are you finding the new career so far?

Collapse
helen8297 profile image
Helen Kent Author

Thank you! I hope they’re all right?!
Not in the new one yet. I’ve applied to bootcamp and have got to the second round. Keeping fingers crossed!
How are you?

Collapse
georgecoldham profile image
George • Edited

They are all good! Another really useful command is the man command.

man is short for manual, it gives the full docs and how to use every (native) terminal command.

Eg:

man mkdir

Things are busy as ever haha, what’s next on your list of learning then?

Thread Thread
helen8297 profile image
Helen Kent Author

Ooh thanks I’ll have to try it out! Well I set up my own github site so I might go through the HTML & continue css on codecademy and at the same time use it to make stuff on that. And then JavaScript with watch and code. Got into the second round of bootcamp, hooray!

Thread Thread
georgecoldham profile image
George

Sounds awesome! Let me know if you need help with anything or want a mini code review or something 🤷‍♀️

Thread Thread
helen8297 profile image
Helen Kent Author

Ah that’d be good! Thank you!

Forem Open with the Forem app