Linux commands Flashcards

1
Q

Print the current working directory.

A

pwd

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

Change the directory

A

cd /path/to/directory

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

List files and directories in the current directory (list)

A

ls -l

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

List files and directories in the current directory (hidden)

A

ls -a

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

Create a new empty file

A

touch [filename]

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

Copy files

A

cp source_file destination_file

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

Remove files

A

rm [filename]

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

Move or rename files or directories.

A

mv source destination

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

View the contents of a file.

A

cat [filename]

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

Create a new directory.

A

mkdir [directory_name]

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

Open the file in the text editor.

A

nano filename

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

Removes directories

A

rm -r [directory_name]

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

Copies directories

A

cp -r

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

Searches for patterns within files.

A

grep ‘pattern’ filename

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

Modifies the permissions of files or directories

A

chmod permissions filename

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

Changes the owner and/or group of files or directories.

A

chown owner:group filename

17
Q

Shows the amount of disk space used and available on file systems.

18
Q

Searches for files and directories in a directory hierarchy.

A

find /path/to/search -name filename

19
Q

Prints text or variables to the terminal.

A

echo [text]

20
Q

Shows the first few lines of a file (default is 10 lines).

A

head [filename]

21
Q

Shows the last few lines of a file (default is 10 lines).

A

tail [filename]

22
Q

Sorts the lines of a text file alphabetically

A

sort [filename]

23
Q

Runs commands with elevated privileges (as a superuser)

A

sudo [command]

24
Q

Sorts the lines of a text file numerically

A

sort -n [filename]

25
Q

Display Running Processes

26
Q

Terminate Processes

A

kill [pid]

27
Q

Check Disk Usage of Files/Directories

A

du [directory]

28
Q

Monitor System Processes

29
Q

List Information About Block Devices

30
Q

Displays the number of lines, words, and characters in a file.

A

wc filename.txt

31
Q

Lists files in the directory sorted by modification time, in reverse order (oldest to newest).

32
Q

Allows you to view the contents of a file one screen at a time.

A

less filename.txt

33
Q

It shows the list of commands you’ve previously executed.

34
Q

Shows the manual (documentation) for a given command.

A

man [command]