2. Codecademy: Learn the Command Line Flashcards

1
Q

(Left angle bracket)

A

Redirect standard output to a command.

For some reason, the app is deleting the actual less than symbol, also referred to as the left angle bracket

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

’ > ‘

A

Redirect standard output of a command to a file, overwriting its previous contents.

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

’&raquo_space; ‘

A

Redirect standard output of a command, appending original contents of a file.

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

’ | ‘

A

Pipe symbol; Redirect standard output of a command to another command.

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

*

A

The asterisk acts as a wildcard to select files and directories.

(E.g., cp m*.txt Movies/ copies all .txt files stating with the letter ‘m’ into the Movies/ directory)

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

wc

A

Output number of lines, words, and characters

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

sort

A

Order the contents of the standard input alphabetically for the standard output.

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

uniq

A

Filter out adjacent, duplicate lines in a file.

(best used in a pipeline with ‘sort’ e.g.,
$sort deserts.txt | uniq
which sorts the contents of desert.txt alphabetically, making duplicates adjacent and filtering them out of the output of the uniq command)

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

-r or -R

A

Meaning “recursive,” when following a command it acts as an option

(See rm -r and grep -R)

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

ls -a

A

List all files and directories in the working directory, including any hidden files (files starting with ‘ . ‘ are hidden by default)

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

ls -l

A

List all files and directories in long format

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

ls -t

A

List all files and directories by date last modified

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

ls -alt

A

List all files and directories, including hidden files, in long format, by date last modified

(ls options can be combined in any combination, e.g., ls -al, ls -at, ls -lt)

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

rm -r

A

Remove directory and all of its contents (permanently!!)

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

-i

A

disregard case/case insensitive

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

grep -R

A

Search all files in a directory and output file names and lines containing matched results.

17
Q

grep -Rl

A

Search all files in a directory and output only file names with matched results.

18
Q

sed

A

Stands for “stream editor.” Accepts, modifies, then prints standard input based on an expression containing other commands.

(See ‘s’ and ‘g’)

19
Q

s

A

sed expression meaning substitute ‘this string’ of the standard input for ‘that string’ in the standard output. (Only substitutes first instance of ‘this string’ unless ‘g’ expression is used).

(using the following syntax: sed s/this/that filename
e.g., sed s/snow/rain forests.txt)

20
Q

g

A

sed expression meaning global or search globally

e.g., $sed s/snow/rain/g forests.txt

21
Q

Redirection

A

Reroutes standard input, standard output and standard error

using commands including >, >, |, etc

22
Q

nano

A

a command line text editor

Type nano followed by the filename you would like to open; if filename does not exist a new file will be created

23
Q

~

A

The tilde symbol represents the user’s home directory.

24
Q

.

A

Files starting with ‘ . ‘ are hidden files.

25
Q

USER

A

Environment variable that denotes computer owner’s name or current user

26
Q

PS1

A

Environment variable that defines the makeup and style of the command prompt

(default ends with $)

27
Q

PATH

A

Environment variable that lists which directories contain scripts.

28
Q

du

A

print the disk usage of a directory

29
Q

du -h

A

print list of sizes of subdirectories in a directory in ‘human readable format’

30
Q

du -sh

A

print the total size of directory in ‘HRF’

31
Q

du - a

A

du -a print list of the sizes of all files/directories

32
Q

du -ah

A

print list of sizes of all files/directories in HRF

33
Q

Ctrl + a

A

Move cursor to front of line

34
Q

Ctrl + e

A

Move cursor to end of line

35
Q

Ctrl + u

A

Clear current line

36
Q

Ctrl + l

A

Clear terminal window (not history)

37
Q

Toggle previous commands

A

Up and Down arrow keys