Popular Linux Commands Flashcards

(20 cards)

1
Q

What does the pwd command do?

A

Print Working Directory - Shows you the full path of the directory you are currently in.

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

What does the ls command do?

A

List - Shows the files and subdirectories in the current directory. Useful options include ls -l (long format, detailed info) and ls -a (shows hidden files, which start with a dot).

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

What does the cd command do?

A

Change Directory - Moves you to a different directory. Use cd [directory_name] to go to a specific location, cd .. to go up one level (parent directory), or cd ~ (or just cd) to go back to your home directory.

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

What does the mkdir command do?

A

Make Directory - Creates a new, empty directory (folder). For example, mkdir projects.

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

What does the rmdir command do?

A

Remove Directory - Deletes an empty directory. If the directory contains files, this command will fail.

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

What does the touch command do?

A

Creates a new, empty file. For example, touch newfile.txt. It can also be used to update the modification timestamp of an existing file.

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

What does cp do?

A

Copy - Copies a file or directory from one location to another. Use cp [source] [destination]. For directories, you need the recursive option: cp -r [source] [destination].

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

What does mv do?

A

Move - Moves a file or directory. This is also used to rename files. Use mv [old_name] [new_name].

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

What does rm do?

A

Remove - Deletes a file. Use rm -r to recursively delete a directory and all its contents (use with caution! ⚠️).

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

What does the cat command do?

A

Concatenate - Displays the entire contents of a file on the standard output (your terminal screen). Often used for quickly viewing small files, like cat notes.txt.

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

What does the less command do?

A

Displays the contents of a file one screenful at a time, allowing you to scroll up and down. This is ideal for viewing large files, unlike cat. (Press ‘q’ to quit).

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

What does the head command do?

A

Displays the beginning (by default, the first 10 lines) of a file. Useful for quickly checking the start of a log file.

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

What does tail do?

A

Displays the end (by default, the last 10 lines) of a file. Use tail -f to “follow” a file, showing new lines as they are added (great for monitoring log files in real-time).

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

What does the man command do?

A

Manual - Displays the manual page (documentation) for any command. For example, man ls will show you all the options for the ls command. (Press ‘q’ to quit).

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

What does the clear command do?

A

Clears the entire terminal screen, giving you a fresh, empty prompt.

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

What does the wget command do?

A

Web Get - Non-interactively downloads files from the web (HTTP, HTTPS, and FTP). It can work in the background and is robust against network interruptions (it can resume downloads). Use case: Downloading a specific file or even an entire website for offline viewing. Example: wget https://example.com/file.zip.

17
Q

What does the sync command do?

A

Remote Sync - Synchronizes files and directories between two locations, locally or remotely. It is much faster than cp or scp for backups because it only transfers the differences (or “delta”) between the source and destination files. Use case: Creating efficient and incremental backups of large directories, or synchronizing a local folder with a server folder. Example: rsync -avz /local/path/ user@remote:/destination/path.

18
Q

What does the nano command do?

A

A simple, user-friendly command-line text editor. Unlike more complex editors like vim or emacs, nano is intuitive and shows the most common commands (like Ctrl+O for Save and Ctrl+X for Exit) right at the bottom of the screen. Use case: Editing configuration files, writing quick notes, or creating shell scripts directly within the terminal environment. Example: nano filename.txt.

19
Q

What does the vim command do?

A

Vi IMproved - A highly powerful, configurable, and efficient modal text editor. It operates using modes (Normal/Command, Insert, Visual, etc.). It allows you to perform complex text manipulation with minimal keystrokes, making it extremely fast for editing code and configuration files. (vimtutor command gives a great tutorial on understanding the fundamentals)