linux Flashcards

1
Q

What is the root directory? What is the command to go there?

A

It’s the most base directory that contains literally everything else on the machine

cd /

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

What does this command do?

cd /

A

Go to root directory

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

How do you go to your home directory?

A

cd
OR
cd ~

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

What does this command do?

cd

A

Go to home directory

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

What does this command do?

cd ~

A

Go to home directory

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

How do you go to parent directory?

A

cd ..

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

What does this command do?

cd ..

A

Go to parent directory

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

command for creating a folder

A

mkdir /some/directory

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

Command to output a literal/string

A

echo “some_string”

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

Command to write output to file

A

echo “some_string” > filename.txt # overwrites

echo “some_string”&raquo_space; filename.txt # appends

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

Commands to view contents of a file and then exit viewing mode

A

cat filename
OR
less filename

q to quit viewing mode

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

Commands to copy, move, or delete? Same for files and folders or different?

A

cp to copy
mv to move
rm to delete (files only)
rmdir to delete (empty folders only)

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

How do you rename a file or folder?

A

mv path path_renamed

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

How to count words or lines in a file?

A

wc file_name # words

wc -l file_name # lines

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

How to count the numbers of files in a folder?

A

ls folder_path | wc -l

the pipe input lists the files, one on each line; the pipe output counts the # of lines

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

How can you tell if a folder or file path is relative or absolute?

A

Absolute paths START with a “/”; relative paths don’t.

17
Q

How do you look up details about a command right in the terminal?

A

man whatever_command # man stands for manual

18
Q

How do you create or find a hidden file?

A

All hidden filenames start with a “.”

19
Q

How do you run a command as a superuser from your regular user account?

A

sudo

20
Q

What’s the “curl” command in shell?

A

Used to interface with a URL (hence the “url” part of “curl”)