Terminal
Mac:
- Click the "spotlight search" icon in the top right corner.
- Search for "terminal".
- Click terminal to open it (right click it to run as admin).
Windows:
- Click the search bar in the bottom left corner.
- Search for "command prompt".
- Click terminal to open it (right click and say "run as administrator" to run as admin).
Basic Terminal Commands
Shortcuts:
-
.
: current directory -
..
: previous directory -
~
: home directory
Directory (folder):
-
pwd
: print current directory (if you're lost, or need the full path to the current directory you're in) -
ls
: list everything in current directory (super useful to know which files/folders you can currently access) -
ls [directory path]
: list everything in current [directory path] -
cd [directory path]
: change directory to [directory path]cd /home/users/Shreya/Documents/terminal.md
-
cd .
: change directory to current directory (doesn't really do much) -
cd ..
: change directory to previous directory (useful) -
cd ../some_folder_name
: change directory to some_folder_name directory in previous directory (sort of like going back one and into another folder) -
cd .
: change directory to home directory
Opening files (in terminal, you don't need this if you're using GitHub desktop)
In file:
-
vi
: open file -
[ECS] -> *+w+q
: save file - more useful commands: https://www.cs.colostate.edu/helpdocs/vi.html
Running a program
-
./[program_name.extension]
[any other expected arguments]-
./sumarray.js
(week 2) -
./romanint.js 78
(week 3)
-
Find more useful commands: https://www.techrepublic.com/article/16-terminal-commands-every-user-should-know/
Not sure which command to use or how it works? Google it! Everyone uses terminal so there's a lot of useful content/blogs/video tutorials online. You can also ask your mentor for help if you're not sure where to start.