Terms in this set (104)

fdisk

The fdisk command is a menu-based command available with Linux for hard disk configuration. This command can perform the following tasks:
Delete a partition on a hard disk.
Create a partition on a hard disk.
Change the partition type.
Display the partition table.
Note: The sfdisk command-line utility is an alternative to the fdisk command.

Answer option A is incorrect. The ping command-line utility is used to test the connectivity with a host on a TCP/IP-based network. This is achieved by sending out a series of packets to a specified destination host. On receiving the packets, the destination host responds with a series of replies. These replies can be used to determine whether or not the network is working properly.

The ping command provides the information about the connectivity with the remote devices. The ping command verifies the network connectivity. It tells the minimum, average, and maximum times it takes for ping packets to find the specified system and return. This can also validate the reliability of the path to a specified system. The following is the syntax of the ping command:

ping ip address
Answer option D is incorrect. The netstat command is used to print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.

Answer option B is incorrect. The route command is used to manipulate the kernel's IP routing tables. It sets up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig program.
By the octal representation of the file access permission, John is restricting the group members to only read the file named "secure".

John is providing all rights to the owner of the file.

According to the scenario, chmod 741 secure will give all access permissions to the owner, only read access permission to the group members, and only execute access permission to other users.

The Octal format is the numeric representation of access rights in which every octal digit combines read, write, and execute permissions. For example, in 0764, the numeral "0" is the representation of the octal format and is optional. The last three digits are permissions for the owner, group, and other users respectively. The table given below explains the meaning of the octal notations:
Octal Digit Text Equivalent Binary Equivalent Meaning of Symbols
0 --- 000 All types of access are denied.
1 --x 001 Only Execute access is allowed.
2 -w- 010 Only Write access is allowed.
3 -wx 011 Write and Execute access are allowed.
4 r-- 100 Only Read access is allowed.
5 r-x 101 Read and Execute access are allowed.
6 rw- 110 Read and Write access are allowed.
7 rwx 111 All types of access are allowed.

The most useful numbers to memorize are 4, 2, and 1. Other numbers have the effect of adding the smaller numbers. (For example, 6 = 4 + 2, and rw- has the effect of r"mixed with -w-.)

Examples:
Octal Notations Explanation
743 All rights for the file owner, Read Only for the group, and Read and Write permissions for other users
711 All rights for the file owner, Execute Only for the group and other users
444 Read Only rights for all members
000 No member has any access rights.

Answer option B is incorrect. The textual representation of 741 will be -rwx-rw---x.

There are 10 characters in the Linux file directory listing in which the first character shows the file type and the next 9 characters are permissions, consisting of three groups: owner, group, and other users. Each group consists of three symbols rwx (in this order). If some permission is denied, they are replaced with a dash "-". The final letter is most commonly a lowercase x or a hyphen, although other letters can be possible. If another letter is shown, that indicates the usage of a less common permission bit. If a lowercase letter is shown, that means the execute bit is set.

For example:

Permission: -rwxrw-r--
Position number: 0123456789

The symbol in the position 0 ("-") is the type of the file. It is "d" if the item is a directory, "l" if it is a link, or "-" if the item is a regular file.
The symbols in positions 1 to 3 ("rwx") are permissions for the owner of the file.
The symbols in positions 4 to 6 ("rw-") are permissions for the group.
The symbols in positions 7 to 9 ("r--") are permissions for other users.
The following table explains the meaning of the r, w, and x symbols:
Symbols Explanation
r Read access is allowed.
w Write access is allowed.
x Execute access is allowed.
- It replaces "r", "w" or "x", depending upon which access type is denied.

Some examples based on the above explanation are as follows:
Text Notations Explanation
-rwxr-xr-- This is a file. The owner has All Rights, the group has Read and Execute rights, and other users have Read Only rights.
drw-r----- This is a directory. The owner has Read and Write rights, and the group and other users have no rights.
lr-------- This is a list. The owner has Read Only rights, and the group and other users have no rights.

Answer option C is incorrect. Users who are not the file's owner, and who are not members of the file's group, do not have permission to write.

Filesystem permissions are the access rights to handle any file or directory in a filesystem. Every file and directory will have user access permissions, which are of the following types:
Read access
Write access
Execute access
In the Linux system, permissions are held by three types of users:
The user who is the owner of the file
The group belonging to that owner
Other users
The chmod command is used to change the access mode of a file. The syntax of the command is:

chmod who=permissions filename

Here, "who" refers to the owner of the file, group members, or other users, and permissions refers to "rwx".

For example, chmod 755 File.txt will give all access permissions to the owner and the read and execute permissions to the group members and other users.
jobs
top
ps

The jobs command displays all the processes running in the background or foreground in the current shell. If no process is running within the shell, this command returns with no information.

Syntax:

jobs [option]

Common options:
-p: Shows only the PID of processes.
-l: Lists only jobs that change their status since the last notification.
ps is short for process status. This command shows a list of the currently running processes. The key piece of information is usually the pid, which is the process id. Once you have the pid, you can use it to monitor the process status.

A sample 'ps' output might look like this:
PID TTY TIME CMD
6874 pts/9 0:00 ksh
6877 pts/9 0:01 csh
418 pts/9 0:00 csh

ps -l, displays processes including those that are in a wait state.
ps -ef, which is commonly used by admins, displays full information about each of the processes currently running.

To get repetitive updates, the top command can be used in place of ps. After the status of a process is found, you can perform operation on the selected process.

The top command is used to produce a frequently-updated list of processes. By default, the processes are ordered by percentage of CPU usage, with only the "top" CPU consumers shown. This command shows how much processing power and memory are being used, as well as other information about the running processes. The following figure demonstrates the output of the top command:

Answer option B is incorrect. nice is a command that is used to change the priority of a process in the kernel's scheduler. A niceness of -20 is the highest priority and 19 is the lowest priority. The default niceness for processes is inherited from its parent process, usually 0. The lower the nice value, the highest its priority on the CPU. For example, when specifying a very low priority, the following command can be entered:

nice -n 19 cc -c *.c &

The above command runs the cc command in the background at the highest possible priority.
John is providing all rights to the owner of the file.
By the octal representation of the file access permission, John is restricting the group members to only read the file named "secure".

According to the scenario, chmod 741 secure will give all access permissions to the owner, only read access permission to the group members, and only execute access permission to other users.

The Octal format is the numeric representation of access rights in which every octal digit combines read, write, and execute permissions. For example, in 0764, the numeral "0" is the representation of the octal format and is optional. The last three digits are permissions for the owner, group, and other users respectively. The table given below explains the meaning of the octal notations:
Octal Digit Text Equivalent Binary Equivalent Meaning of Symbols
0 --- 000 All types of access are denied.
1 --x 001 Only Execute access is allowed.
2 -w- 010 Only Write access is allowed.
3 -wx 011 Write and Execute access are allowed.
4 r-- 100 Only Read access is allowed.
5 r-x 101 Read and Execute access are allowed.
6 rw- 110 Read and Write access are allowed.
7 rwx 111 All types of access are allowed.

The most useful numbers to memorize are 4, 2, and 1. Other numbers have the effect of adding the smaller numbers. (For example, 6 = 4 + 2, and rw- has the effect of r"mixed with -w-.)

Examples:
Octal Notations Explanation
743 All rights for the file owner, Read Only for the group, and Read and Write permissions for other users
711 All rights for the file owner, Execute Only for the group and other users
444 Read Only rights for all members
000 No member has any access rights.

Answer option D is incorrect. The textual representation of 741 will be -rwx-rw---x.

There are 10 characters in the Linux file directory listing in which the first character shows the file type and the next 9 characters are permissions, consisting of three groups: owner, group, and other users. Each group consists of three symbols rwx (in this order). If some permission is denied, they are replaced with a dash "-". The final letter is most commonly a lowercase x or a hyphen, although other letters can be possible. If another letter is shown, that indicates the usage of a less common permission bit. If a lowercase letter is shown, that means the execute bit is set.

For example:

Permission: -rwxrw-r--
Position number: 0123456789

The symbol in the position 0 ("-") is the type of the file. It is "d" if the item is a directory, "l" if it is a link, or "-" if the item is a regular file.
The symbols in positions 1 to 3 ("rwx") are permissions for the owner of the file.
The symbols in positions 4 to 6 ("rw-") are permissions for the group.
The symbols in positions 7 to 9 ("r--") are permissions for other users.
The following table explains the meaning of the r, w, and x symbols:
Symbols Explanation
r Read access is allowed.
w Write access is allowed.
x Execute access is allowed.
- It replaces "r", "w" or "x", depending upon which access type is denied.

Some examples based on the above explanation are as follows:
Text Notations Explanation
-rwxr-xr-- This is a file. The owner has All Rights, the group has Read and Execute rights, and other users have Read Only rights.
drw-r----- This is a directory. The owner has Read and Write rights, and the group and other users have no rights.
lr-------- This is a list. The owner has Read Only rights, and the group and other users have no rights.

Answer option A is incorrect. Users who are not the file's owner, and who are not members of the file's group, do not have permission to write.

Filesystem permissions are the access rights to handle any file or directory in a filesystem. Every file and directory will have user access permissions, which are of the following types:
Read access
Write access
Execute access
In the Linux system, permissions are held by three types of users:
The user who is the owner of the file
The group belonging to that owner
Other users
The chmod command is used to change the access mode of a file. The syntax of the command is:

chmod who=permissions filename

Here, "who" refers to the owner of the file, group members, or other users, and permissions refers to "rwx".

For example, chmod 755 File.txt will give all access permissions to the owner and the read and execute permissions to the group members and other users.
mke2fs

The mke2fs command is used to create ext2, ext3, and ext4 filesystems. The commonly used mke2fs command options are as follows:
Options Descriptions
-b It specifies the size of blocks in bytes.
-i It specifies the bytes/inode ratio.
-N It overrides the default calculation of the number of inodes that should be reserved for the filesystem.
-m It specifies the percentage of the filesystem blocks reserved for the super-user.
-c It checks the device for bad blocks before creating the file system.
-l It specifies the size of each inode in bytes.
-L It sets the volume label for the filesystem to new-volume-label.

Answer option B is incorrect. The fsck command is used to check and optionally repair one or more Linux filesystem.

Answer option D is incorrect. The mkswap command is used to set up a Linux swap area on a device or in a file. After creating the swap area, a user needs the swapon command to start using it. Usually swap areas are listed in the /etc/fstab file so that they enabled at boot time by a swapon -a command in boot scripts. The syntax of the mkswap command is as follows:

mkswap [-c] [-vN] [-f] [-p PSZ] [-L label] device [size]

Here,
The -c option checks the device (if it is a block device) for bad blocks before creating the swap area. If any are found, the count is printed.
The -f option allows the creation of a swap area larger than the file or partition it resides on.
The -p PSZ option specifies the page size to use.
The -L label option specifies a label to allow enabling the swap space via a label name.
Answer option C is incorrect. The e2fsck command is used to check the second extended filesystem of a Linux computer.
;