Terminal Command Line Flashcards

1
Q

How to know where a Terminal window is at?

A

At the top of the window it shows the location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Is it possible to have multiple terminal windows/tabs opened?

A

Yes, sure! It works like a browser. You can merge windows so that they get gathered together under the form of tabs under one single window.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Is it possible to restaure multiple windows so that you can get back where you left off?

A

Sure. It can:

Window > Save Windows as Group…

To reopen:

Window > Open Window Group > Select Group name

It will restaure windows with their location on screen and their repository where you left off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to clear all the previous commands and get back to an empty screen?

A

clear + return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Is it possible to save all the commands and results from a terminal window?

A

yes, just like on other softwares: cmd + S.

It will save as a text file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Is it possible to use copy and paste in Terminal?

A

Sure yes!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does ~ lecorre$ mean when starting a Terminal window?

A

It is the location where the Terminal is at. By default it goes to the User root

  • The tilde (~) means base user’s directory (the Home)
  • It is followed by the name of the current user.
  • The $ : The dollar sign prompt (or a prompt ending with a dollar sign) means that UNIX is now ready to interpret and execute your commands as typed in from your keyboard.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What’s the shortcut to initiate previously typed commands without having to retype them?

A

Just use the up arrow ↑

If you went back to much you can use the same trick with down arrow ↓

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to access the history of commands?

A

history + return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to change directory

A

cd + name of directory

Stands for “change directory”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to know where you are at?

A
  1. The title of the Terminal Window
  2. the directory always shows at teh left of the command invite (at the left of the dollar sign)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the difference between relative and absolute paths?

A

A path is a list of components (directory or file names) separated by a slash (/).
An absolute path starts from the root directory and works its way down: /A/B/file.
A relative path starts from some contextually-determined parent directory and works its way down from there: A/B/file.
In a terminal context, the default parent directory for a relative path is the present working directory, which you can print using the pwd command.

A path is how you refer to a file or directory. A path like /A/B/file is a concise description of how to find a file:

  1. start at the system root directory /,
  2. move to the A directory,
  3. next move to the B directory,
  4. and end with file.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Is there a shortcut for:

cd /Users/username/Documents

A

Yes:

cd ~/Documents/
On Mac OS, just as on all UNIX systems, the tilde (~) stands for current user directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What’s the shortcut to get back to user’s root directory?

A

just type cd and return without anything else:

cd + return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to get back one step up in folder hierarchy? Like let’s say from User/Documents to User/

A

cd .. + return

You can also combine this in one command if you already know which other folder you want to target. Like from Documents if you want to access Pictures, you can type:

cd ../Pictures

Which literally means “get back one directory above and enter Pictures”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Do we need to know all paths by heart to use Terminal?

A

No, we can use autocompletion thanks to the tab key!

If several options are possible, press twice on tab key to see what are the possible options. Only the one ending with / are folders. The others are files.

17
Q
A