Commands Flashcards

1
Q

passwd

A

changes the current user password

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

echo

A

prints the text/string given to it to the screen, standard out, by default

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

-n

A

no new line

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

ls -d /*/

A

file structure and hierarchy that Linux implements to organize everything

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

pwd

A

“Print Working Directory” - This command tells you the path of the directory file you are navigating.

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

ls

A

“List Segments” - This command tells you what files are in the directory you are navigating. You can use the -a option to show hidden files. Hidden files in Linux start with a .

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

.

A

The . character represents the directory you are currently navigating.

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

..

A

This represents the directory that is directly above you.

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

cd

A

“Change directory” - This command takes an argument of a directory and puts you into that directory.

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

touch

A

creates a file in your working directory

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

mkdir

A

creates a directory in your working directory

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

mv

A

“Move” command takes two arguments:

The Source: The file you want to move.
The Destination: The location where you want to move the file.

use mv to rename files. Use the -r or “recursive” option to move an entire directory.

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

cp

A

“Copy” command also takes two arguments:

The source file to copy.
The destination location for the copy.

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

rm

A

delete files; if you would like to delete a directory and everything it contains, you can provide the -r or “recursive” option. This can be very dangerous, especially if you provide the -f or “force” option. You may end up accidentally deleting important files if you are not careful.

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

rmdir

A

“Remove Directory” is how to delete directories. This directory needs to be empty.

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

head

A

information from the head or top of a file

17
Q

tail

A

pulls lines from the tail (bottom) of a file

18
Q

sort

A

sorting the lines of a file

19
Q

uniq

A

grabbing only the unique lines of a file. It is often useful to use with sort

20
Q

wc

A

count of some input

21
Q

>

A

redirects the STDOUT to a file and overwrites anything that may have been in the file previously

22
Q

> >

A

appends the STDOUT to a file and appends the information to what was already in the file

23
Q

|

A

edirects the STDOUT to another command. This is also called a “pipe”.

24
Q

2> /dev/null

A

common addition to a command. Sometimes you do not want to see errors. Adding 2>

/dev/null will redirect STDERR so you do not see it

25
Q

find

A

Find takes at least two arguments. The first argument is the directory you want to look inside. The second argument is what you are looking for in the file system. find has many options for finding based on size, name, and more.

26
Q

locate

A

Locate works similarly to find. locate is generally the faster command. locate uses a database/cache to quickly store where a file is located. It is important to run the updatedb command often if you use locate so your database is up to date.

27
Q

which

A

Which takes another command as an argument and will tell you where the binary for that command lives in the file system.

28
Q

file

A

determining the type of a file

29
Q

useradd

A

requires you to have already encrypted the password if you want password protection. This is a good command to use for scripting

30
Q

adduser

A

tool for creating users

31
Q

groupadd

A

analogous to useradd, which is better for scripting

32
Q

addgroup

A

analogous to adduser, which is easier to use and set up a group

33
Q

grep

A

grep -r ‘’ –> will search all directories & files starting from current directory

grep ‘’ – will search all files for search terms