Linux Flashcards

1
Q

Pwd

A

Present working directory

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

What is this symbol: ~

A

Tilde

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

What does the ~ sign expand to?

A

The full path for your home directory

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

Why is understanding where you are at any given time in your file system important?

A

This information can help you build paths to other files or help you if you get lost.

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

By default, Pwd will list the “logical” path of your current directory. What does this mean?

A

It will treat say linked paths as if they were the actual paths.

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

If you want to see the actual physical path of the directory in which you are working, what flag can you use?

A

pwd -P

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

What is the command for listing files and directories?

A

ls

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

How do you find out what files are in another directory?

A

Pass a path to the ls command.

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

It is common for Unix and Linux based machines to have ‘invisible’ or ‘hidden’ files that are prefixed with a ___.

A

‘dot’

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

What flag can you use to see hidden files?

A

ls -a

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

What is the flag for listing files and directories in long form?

A

ls -l

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

What is symlink short for?

A

Symobolic link

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

What flag can you use to see sizes of files in kilobytes and megabytes?

A

ls -lh

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

What is the default method of sorting a list of files and directories?

A

By name

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

How can we change the list function to sort by size (largest first)?

A

ls -lS

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

What flag can we use to list files and directories by the last time they were modified?

A

ls -lt

17
Q

How can we reverse the sort of any of the sorting flags for the ls command?

A

-r

18
Q

What is the command for creating a link?

A

ln

19
Q

By default, the ln command will create a ____ link between files.

A

hard

20
Q

What happens when you create a hard link?

A

Hard links create an identical copy of the linked file on disk, which gets updated automatically as the source file gets updated.

21
Q

How do we create a link to a file using the ln command?

A

We call the ln command with two arguments - the first being the source file and the second being the target file.

22
Q

Can hard links connect two file systems?

A

No they only work on the current file system. Symbolic links can link to files on different file systems.

23
Q

If the source file of a hard link gets deleted, what will happen to the target file?

A

It will continue to live as an independent file, despite the severed link.

24
Q

If the file you are trying to link a file that already exists, you will get an error. How can you force the system to link the files anyway (deleting whatever you have saved in that file).

A

-f (force)

25
Q

Do hard links work for directories?

A

No, only symlinks

26
Q

How do we create a symlink?

A

ln -s

27
Q

Which of the kinds of links are more powerful and more common?

A

Symlinks

28
Q

How do you change directories?

A

cd

29
Q

What one argument does cd take?

A

The path to the directory you wish to naviagate to.

30
Q

What is the special path . . used for?

A

Moving to the current directories parent directory.

31
Q

What happens when you call cd without any arguments?

A

You will go back to the home directory.

32
Q

What command do you use to create new directories?

A

mkdir

33
Q

What flag can you use to make nested directories?

A

mkdir -p parent_file/sub_file/double_sub

34
Q

When would you use the -v flag?

A

Using the -v flag can provide useful reporting when writing scripts that will execute a lot of commands for you.

35
Q

What is the name of the -v flag?

A

Verbose Output