Unix description

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/41

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

42 Terms

1
New cards

stdin (0)

Default input source, usually the keyboard

2
New cards

stdout (1)

Default output destination, usually the screen

3
New cards

stderr (2)

Standard error output channel, used for error messages

4
New cards

>

redirects stdout to a file (overwrites file)

5
New cards

>>

Appends the stdout to a file

6
New cards

<

Redirects a file into stdin

7
New cards

2>

Redirects stderr to a file (overwrites file)

8
New cards

2>>

Appends stderr to a file

9
New cards

> file 2> &1

Redirects both stdout and stderr to the same file

10
New cards

/dev/null

A special file that discards all data written to it (“bit bucket”).

11
New cards

| (pipe operator)

Sends stdout of one command into stdin of another

12
New cards

head/tail

Display the first or last lines of a file

13
New cards

cut

Extrafcts specific columns or charcters from each line

14
New cards

tr

Translates or deletes characters (e.g., lowercase to uppercase).

15
New cards

sort

Sorts lines of text (with options like - r for reverse)

16
New cards

sed

Steam editor for filtering and transforming text

17
New cards

grep

Searches text using patterns or regular expressions

18
New cards

test command

Evaluates conditions and returns 0 (true) or 1 (false)

19
New cards

-f

Tests if a regular file exists

20
New cards

-d

Tests if a directory exists

21
New cards

-z

Checks if a string is empty

22
New cards

= / !=

Tests for string equality or inequality

23
New cards

-eq / -It / -gt

Tests for a string equality or inequality

24
New cards

if-then-else

Conditional statement that executes commands based on a test

25
New cards

case

Pattern-matching control structure for multiple options

26
New cards

while loop

Repeats commands while a condition is true

27
New cards

for loop

Iterates over a list of values

28
New cards

&&

Logical AND: RUNS SECOND COMMAND IF FIRST SUCCEEDS

29
New cards

||

Logical OR: runs second command if first fails

30
New cards

function_name() {}

Defines a resuable set of commands

31
New cards

return

Exits a function and returns a value

32
New cards

find [path] [criteria] [action]

Searches files and performs actions

33
New cards

-name “pattern”

Search by filename.

34
New cards

-type f / -type d

Search for files or directories

35
New cards

-mtime +30

Finds files modified more than 30 days ago.

36
New cards

-size +1M

Finds files larger than 1MB

37
New cards

-exec command {} ;

Executes a command on each file found

38
New cards

-delete

Deletes matching files

39
New cards

read

Reads input from the user or a file

40
New cards

$#

Number of positional parameters (arguments)

41
New cards

$0

Name of the script

42
New cards

$1, $2, …

Positional parameters passed to the script