CLI Checkoff

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

1/30

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.

31 Terms

1
New cards

What command prints the current working directory?

pwd

2
New cards

How do we change directory?

cd

3
New cards

How do you change to the parent directory?

cd ..

4
New cards

How do you change to the home directory quickly?

cd ~ or just cd

5
New cards

What’s the difference between an absolute and relative path?

Absolute starts at root /; relative starts from your current pwd

6
New cards

Create a new directory called project.

mkdir project

7
New cards

Create an empty file called notes.txt.

touch notes.txt

8
New cards

Copy file.txt to backup.txt.

cp file.txt backup.txt

9
New cards

Copy a directory and its contents.

cp -r dir1 dir2

10
New cards

Rename old.txt to new.txt.

mv old.txt new.txt

11
New cards

Move report.txt into the docs/ directory.

mv report.txt docs/

12
New cards

Delete file.txt.

rm file.txt

13
New cards

Delete a directory and everything inside it.

rm -r dirname

14
New cards

Safely delete interactively (prompt before delete).

rm -ri dirname

15
New cards

List all files in current directory

ls

16
New cards

Show hidden files too

ls -a

17
New cards

View a file’s contents at once.

cat file.txt

18
New cards

View a long file one page at a time.

less file.txt

19
New cards

How do you clear the terminal?

clear

20
New cards

Search for “error” in log.txt.

grep "error" log.txt

21
New cards

Case-insensitive search for “error” in log.txt

grep -i "error" log.txt

22
New cards

Find all .txt files in current directory and subdirectories.

find . -name "*.txt"

23
New cards

Pipe output of ls into grep to find .py files.

ls | grep ".py"

24
New cards

Show all recently run commands

history

25
New cards

Search history for “grep”.

history | grep grep

26
New cards

Append “hello” to notes.txt without overwriting.

echo "hello" >> notes.txt

27
New cards

Save output of ls into list.txt, replacing existing file.

ls > list.txt

28
New cards

What is the root directory called?

/

29
New cards

What is the single dot . in a directory?

A link to the current directory.

30
New cards

What is the double dot .. in a directory?

A link to the parent directory

31
New cards

Show a directory tree structure visually.

tree