bash shell commands Flashcards

Learn all of the bash shell commands.

1
Q

What is the command to search the man pages using keywords?

A

man -k

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

What is the cd command used for?

A

Change the working directory. cd

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

Where does cd with no destination take you?

A

home directory.

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

When using cd, what does an absolute directory reference always begin with?

A

/

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

What does the pwd command do?

A

Displays the current working directory. (present working directory)

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

what does . represent when using cd?

A

The current directory.

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

What does .. represent when using cd?

A

The parent directory.

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

Where doe “cd -“ take you?

A

The previous working directory.

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

What is the ls command used for?

A

List the contents of a directory.

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

What does -F do in the ls command?

A

Puts a forward slash at the end of each directory and an * at the end of each executable in the current directory.

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

What does ls -a do?

A

Includes directory entries whose names begin with a dot (.).

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

What does ls -R do?

A

Recursively lists subdirectories encountered.

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

What does ls -l do?

A

List in long format. If the output is to a terminal, a total sum for all the file sizes is output on a line before the long listing.

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

What is the ? used for in the ls command?

A

A metacharacter wildcard character to represent one character in a pattern for text matching.

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

What is the * used for in the ls command?

A

A metacharacter wildcard character to represent any number of characters in a pattern for text matching.

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

What is file globbing?

A

The process of pattern matching using wildcards.

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

What are [] used for in the ls command?

A

Metacharacter wildcards that represent a single position and give you multiple options for file globbing.

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

What does the touch command do?

A

Sets the modification and access times of files. If any file does not exist, it is created with default permissions.

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

What does the cp command do?

A

Copies the contents of the source_file to the target_file or the contents of each named source_file is copied to the destination target_directory.

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

What does a trailing / when used with the destination parameter for the cp command?

A

Indicates that the destination is a directory.

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

What does the ln -s command do?

A

Creates a new symbolic directory entry (symbolic link) that points to another file and has the same modes as the other file. The linked files do not share the same contents.

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

What does ln command do?

A

Creates a new directory entry (hard link) that points to another file and has the same modes as the other file. The linked files share the same contents.

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

What does the mv command do?

A

Renames the file named by the source operand to the destination path named by the target operand. This form is assumed when the last operand does not name an already existing directory. OR Moves each file named by a source operand to a destination file in the existing directory named by the directory operand.

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

What does the rm command do?

A

Attempts to remove the non-directory type files specified on the command line.

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

What does the mkdir command do?

A

make directories command creates the directories named as operands, in the order specified, using mode rwxrwxrwx (0777) as modified by the current umask(2)

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

What does the -p flag do in the mkdir command?

A

Creates intermediate directories as required.

27
Q

What does the rmdir command do?

A

Removes the directory entry specified by each directory argument, provided it is empty.

28
Q

What does rm -r do?

A

Removes files from the specified directory argument, and then the directory itself.

29
Q

What does the file command do?

A

Determines the file arguments filetype by performing three tests: filesystem tests, magic tests, and language tests.

30
Q

What does the cat command do?

A

Reads files sequentially, writing them to the standard output.

31
Q

What does the more command do?

A

Reads a text file then writes it to standard out but stops after it displays each page of data. It is a pager utility.

32
Q

What does the less command do?

A

Pager utility that writes text from a file to standard output but stops after each page of data, allows forward and backward movement in the file, and does not have to read the entire input file before starting.

33
Q

What does the tail command do?

A

Displays the last part of a file to standard output. Default is last ten lines.

34
Q

What does -n do when used with the tail command?

A

Specifies the number of lines to display to standard output.

35
Q

What does -f do when used with the tail command?

A

Causes tail to not stop when end of file is reached, but rather to wait for additional data to be appended to the input. Got for viewing logs in real time.

36
Q

What does the head command do?

A

Displays the first lines of a file to standard output. Default is first ten lines.

37
Q

What does the ps command do?

A

Displays a header line, followed by lines containing information about all of your processes that have controlling terminals.

38
Q

What does -e do in ps?

A

Displays all processes running on the system.

39
Q

What does -f do in ps?

A

Display the uid, pid, parent pid, recent CPU usage, process start time, controlling tty, elapsed CPU usage, and the associated command.

40
Q

What are the headers displayed in ps -f?

A

UID, PID, PPID, C, STIME, TTY, TIME, CMD.

41
Q

What does the top command do?

A

Displays a sorted list of system processes. The default sorting key is pid, but other keys can be used instead. Various output options are available.

42
Q

What does the kill command do?

A

Sends a signal to the processes specified by the pid operands.

43
Q

What is the default signal sent in the kill command?

A

TERM - Terminates if possible.

44
Q

What is the command to list all of the available signals in the kill command?

A

kill -l

45
Q

What does kill -9 do?

A

Sends the SIGKILL signal to PID to cause it to terminate immediately (kill).

46
Q

What does kill -15 do?

A

Sends the SIGTERM signal to PID to request its termination. This is the default signal sent with kill.

47
Q

What does the killall command do?

A

Kills processes selected by name.

48
Q

What does the mount command do?

A

Mounts file systems.

49
Q

What is the output of mount?

A

A list of media devices currently mounted on the system.

50
Q

What is the basic form for the mount command to mount a media device in the virtual directory.

A

mount -t type device directory. type is filesystem type, device is the location of the device file, and directory is the location in the virtual directory for the mount point.

51
Q

What does the umount command do?

A

Removes a removable media device.

52
Q

What is the format for the umount command?

A

umount [directory | device]

53
Q

What does the df command do?

A

Displays statistics about the amount of free disk space on the specified filesystem or on the filesystem of which file is a part.

54
Q

What is the -h flag for with the df command?

A

“Human-readable” output.

55
Q

What does the du command do?

A

Displays disk usage statistics.

56
Q

What is the number at the left of each line in the du command output?

A

The number of disk blocks that each file or directory takes.

57
Q

What does the sort command do?

A

Sorts or merges records (lines) of text and binary files

58
Q

What does -n do for the sort command?

A

Sort fields numerically by arithmetic value.

59
Q

What is the grep command do?

A

Searches any given input files, selecting lines that match one or more patterns.

60
Q

What is the format for the grep command?

A

grep [options] pattern [file]

61
Q

What does the -v flag do with the grep command?

A

Selected lines are those not matching any of the specified patterns.

62
Q

What does the -n flag do with the grep command?

A

–line-number Provides the line number for each line of output.

63
Q

What is the -c flag for the grep command?

A

–count Only a count of selected lines is written to standard output.