command-line-commands.md 1.8 KB
Newer Older
karen Carias's avatar
karen Carias committed
1
# Command Line basic commands
2 3 4

## Start working on your project

5
* In Git, when you copy a project you say you "clone" it. To work on a git project locally (from your own computer), you will need to clone it. To do this, start by signing in at GitLab.com.. To do it, go to your [GitLab.com](https://gitlab.com) account
6

karen Carias's avatar
karen Carias committed
7
* When you are on your Dashboard, click on the project that you'd like to clone, which you'll find at the right side of your screen
8 9 10

![Select a project](basicsimages/select_project.png)

karen Carias's avatar
karen Carias committed
11
* To work in the project, you can copy a link to the Git repository through a SSH or a HTTPS protocol. SSH is easier to use after it's been [setup](create-your-ssh-keys.md). When you're in the project, click on the HTTPS or SSH button at the right side of your screen. Then copy the link (you'll have to paste it on your shell in the next step)
12

karen Carias's avatar
karen Carias committed
13
![Copy the HTTPS or SSH](basicsimages/https.png)
14

karen Carias's avatar
karen Carias committed
15
## On the command line
16

karen Carias's avatar
karen Carias committed
17
* To clone your project, go to your computer's shell and type the following command
karen Carias's avatar
karen Carias committed
18 19 20 21
```
git clone PASTE HTTPS OR SSH HERE
```

karen Carias's avatar
karen Carias committed
22
* A clone of the project will be created in your computer
karen Carias's avatar
karen Carias committed
23 24 25 26 27

* Go into a project, directory or file to work in it
```
cd NAME-OF-PROJECT-OR-FILE
```
28

karen Carias's avatar
karen Carias committed
29
* Go back one directory or file
30
```
karen Carias's avatar
karen Carias committed
31
cd ../
32 33
```

karen Carias's avatar
karen Carias committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
* To see what’s in the directory that you are in
```
ls
```

* Create a directory
```
mkdir NAME-OF-YOUR-DIRECTORY
```

* Create a README.md or file in directory
```
touch README.md
nano README.md
#### ADD YOUR INFORMATION
#### Press: control + X
#### Type: Y
#### Press: enter
```

* Remove a file
```
rm NAME-OF-FILE
```

* Remove a directory and all of its contents
```
rm -rf NAME-OF-DIRECTORY
```

* View history in the command line
```
history
```

* Carry out commands for which the account you are using lacks authority. (You will be asked for an administrator’s password)
```
sudo
```