Linux Commands Flashcards

1
Q

cat filename

A

prints contents of file to screen

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

grep searchterm filename

A

search file for search term

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

sort filename

A

sort file alphabetically

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

sort -r filename

A

sort file z-a

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

uniq filename

A

removes duplicates that are beside each other

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

awk ‘{print $1, $2}’ filename

A

print column 1 and 2 of file

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

awk ‘{print $1, “eats”, $2}’ filename

A

prints column 1 and 2 with eats between them

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

wc filename

A

counts words in file

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

wc -l filename

A

counts number of lines in a file

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

pwd

A

prints pathway to folder

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

ls

A

prints contents of file your in

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

cd foldername

A

move into folder

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

cd ..

A

go back a folder

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

sort file > sorted_file.txt

A

create new file called sorted_file and save contents there

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

sort file&raquo_space; sorted_file.txt

A

add the sorted contents of the file to the end of sorted file

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

cat file1 file2 > file3

A

joins file1 and file2 and puts contents into new file called file3

17
Q

cp file1 file2

A

copy contents of file1 to file2

18
Q

mkdir name

A

make a new folder called name

19
Q

rm file

A

remove file

20
Q

*

A

means all files in same directory

21
Q

rm*

A

removes all files

22
Q

ls*

A

lists all files

23
Q

ls temp*

A

lists all files starting with temp

24
Q

sort -n file

A

sort file in numerical order

25
Q

uniq -c

A

tells you how many times a line repeated