3. Introduction To Linux Commands Flashcards

1
Q

What command lists the files and sub-directories in a given directory(displays the contents of a directory)?

A

The “ls” command

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

How would you list the files and directories in a directory you are not currently in?

A

ls “directory path”

The path can either be an absolute path or a relative path

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

How would you list the contents of a directory, including the hiding files and sub-directories?

A

ls -a

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

Which command is used to create a new user in Linux?

A

sudo adduser username

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

In Linux which command is used to display the name of the current user?

A

whoami

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

What is the sudo command?

A

It is a command used to give the current user temporary admin privileges.

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

What type of user is created with the “sudo adduser username” command?

A

A regular user with no admin privillages.

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

Which command will you use to create a user with admin privileges?

A

sudo -u root adduser username

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

What command is used to clear the screen of your terminal?

A

clear

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

What command is used from one directory to another?

A

cd path

NB: The path can be relative or absolute

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

What command is used to move to the previous directory you were in?

A

cd -

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

Where are the command files found in Linux?

A

The bin and sbin directories.
The bin directory contains regular commands, while the sbin directory contains commands meant to be executed by admins(the types of commands you will need to add sudo to, to make it work)

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

What command is used to change the current user’s password?

A

passwd

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

What is the purpose of the cat command?

A

Concatinitinating the content of files and displaying said contents on the terminal.

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

Using the cat command how will you display the contents of a file?

A

cat filename.extension

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

using the cat command how will you join/concatenate the contents of multiple files and write them in a new file?

A

cat filename.ext filename.ext > newfilename.ext
It also replaces the content in the new file if there is already content.

16
Q

using the cat command how will you append the contents of one file in another file?

A

cat file1name.ext&raquo_space; file2name.ext

17
Q

Using the cat command how will you display how many lines exist in a certain file?

A

cat -n filename.txt