CLI-beginning Flashcards

1
Q

Most commands can take [***], sometimes also called options or flags: arguments that modify how a command is carried out.

A

switches

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

The timestamp indicates…

A

the last time teh content was modified

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

Do we always need to be within a directory to use the list command?

A

No, we can pass the path of a directory as argument to the ls command.

For instance, from your home directory, you can type:

ls Documents/

ls Documents/my-website

ls Documents/my-website/css

Etc.

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

How to get the terminal to indicate the current location (current directory) by showing its absolute path?

A

pwd

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

Single-character arguments can often be [***]

A

combined together

ls -l -F

can be replaced by

ls -lF

(dash + lowercase “L” for details + uppercase “F” for trailing slash after directories’ names)

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

What character can be used when writting paths as a shortcut /alias for your home directory?

A

the tilde character: ~

For instance, the two following paths are actually the same:

  • /Users/lecorre/Documents/my-website
  • ~/Documents/my-website
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the command to create a new directory/folder?

A

mkdir

Ex: mkdir css

Will create a folder named css in the active directory

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

What default character is used for the prompt?

A

The dollar character:

$

(It can be customized)

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

What is the command to list with the following options:

  • with the details
  • by time –> with the newest files at the bottom
A

ls -ltr

ls = listing

  • l = with the details
  • t = order by time (newest first)
  • r = reverse order
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which switch will order by time with newest content first?

A

-t

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

What does the double dot stand for?

A

As on the web, the double dot (..) symbol represents the current directory’s parent.

So it also works from a shell prompt:

ls ..

cd ..

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

What is the switch for the ls (list) command that will add a trailing slash to the directories—to make it easier to distinguish files from folders?

A

-F

(dash + uppercased “F”)

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

Which switch will reverse the order?

A

-r

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

What does -rw-r–r-rwxr-xr-x mean on the output of a list command? And what does it mean when there’s a d before?

A

It’s the about the permissions: read, write, execute.

If there’s a d before, it’s to indicate that it’s a directory (not a file);

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

How to list the current working directory’s files and subdirectories?

A

By typing:

ls

(lowercase “L” and “S” –> like listing)

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

What is the command to remove a folder/directory? And what should we be aware of?

A

rm -r

Ex: rm -r css

It will remove the css folder in the active directory . It’s immediate and without confirmation! And it won’t even be placed in the thrash bin! It’s an immediate definitive deletion!

17
Q

What is the command to change directory?

A

cd

18
Q

What is the switch to get the details?

A

-l

(dash + lowercase “L”)

19
Q

The file size is indicated in…

A

bytes

20
Q

How can we distinguish between directories and files in the output of the ls -l or ls -lF command?

A

A d will show a the beginning of a line.

A trailing slash will follow the name if the command contained the argument -F