Linux Commands Flashcards

To learn commonly used basic Linux commands.

1
Q

Command to list directory contents?

A

ls [options]

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

Command to create a new directory?

A

mkdir [options] [directory name]

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

Command to change to a directory?

A

cd /[directory path]

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

Command to copy files and directories?

A

cp [options] [source] [destination]

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

Command to display a file’s content to the standard output device (usually your monitor)?

A

cat [filename]

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

Command to change a file’s permission?

A

chmod [options] mode [filename]

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

Command to change a file’s owner?

A

chown [options] filename

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

Command to clear a command line screen/window for a fresh start?

A

clear

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

Command to display or set the system date and time?

A

date [options]

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

Command to display used and available disk space?

A

df [options]

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

Command to determine how much space each file takes up?

A

du [options]

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

Command to determine what type of data is within a file?

A

file [options] [filename]

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

Command to search for files matching a provided pattern?

A

find [pathname] [expression]

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

Command to search files or output for a particular pattern?

A

grep [options] pattern [filename]

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

Command to stop a process?

A

kill [options] pid

Note:
If a process refuses to stop, use “kill -9 pid”

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

Command to view the contents of a file one page at a time?

A

less [options] [filename]

17
Q

Command to create a shortcut?

A

ln [options] [source] [destination]

18
Q

Command to search a copy of your file system for the specified filename?

A

locate [filename]

19
Q

Command to send a print job?

A

lpr [filename]

20
Q

Command to display information for a specified command?

A

man [command]

21
Q

Command to rename or move file(s) or directories?

A

mv [options] [source] [destination]

22
Q

Command to allow system administrator to change any password?

A

passwd [name] [new password]

23
Q

Command to display a snapshot of currently running processes?

A

ps [options]

24
Q

Command to display the pathname for the current directory?

A

pwd

25
Q

Command to remove (delete) files and/or directories?

A

rm [options] [directory or filename]

26
Q

Command to delete empty directories?

A

rmdir [options] [directory]

27
Q

Command to remotely log into another Linux server, over the network?

A

ssh [options] [user]@[hostname]

Note:
To leave an SSH session type “exit”

28
Q

Command to switch to another user account?

A

su [options] [user[arguments]]

29
Q

Command to display the last n lines of a file (default is 10)?

A

tail [options] [filename]

30
Q

Command to store and extract files from a tarfile (.tar) or tarball (.tar.gz or .tgz)?

A

tar [options][filename]

31
Q

Command to display the resources being used on your system?

A

top

Note:
Press “q” to quit

32
Q

Command to create an ampty file with a specified filename?

A

touch [filename]

33
Q

Command to display who is logged onto the system?

A

who [options]

34
Q

Command to stop a service?

A

service [servicename] stop

35
Q

Command to start a service?

A

service [servicename] start

36
Q

Command to restart a service?

A

service [servicename] restart

37
Q

Command to display server uptime?

A

uptime

38
Q

Command to display the status of a service

A

service [servicename] status