Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
✔ 32 bit
✔ 64 bit
✔ True
✔ arch
✔ lscpu
✔ cat /proc/cpuinfo
A CPU flag...
✔ dmidecode
Choose all of the following statements that are true in regard to virtual RAM:
(choose three)
✔ MBR
✔ GPT
The fdisk command is a tool used for working with the MBR partitioned disks.
✔ True
Which of the following is the valid device file name for the first IDE hard drive on the system?
✔ /dev/hda
✔ VGA
✔ DVI
✔ Running the script will invoke /bin/csh to interpret the rest of the file
What does this shell script do? FOO=/tmp/foo if [ ! –d $FOO ]; then mkdir $FOO fi
Given the following part of a script: if [ -f $1 ]; then echo “I am here” fi What is the meaning of
$1?
✔ A=”Hello”
✔ A=`pwd`
How would you finish your script with an exit code of 42?
✔ exit 42
The if command looks for what exit code to consider a condition to be true?
✔0
Given the following script: while [ ! –f /tmp/foo ]; do echo –n “.” process_data > /tmp/foo done
Which of the following are true?
(choose two)
✔ If a file called /tmp/foo exists, process_data won’t be run
✔ process_data will be called at most once
Chapter 9:
sh - use to file a script shell command
ex. sh test.sh
= - use for assigning a variable with value and needs no spaces between
ex. human=”cancer” for assigning / no spaces between the “=”
ex. if [ $human = “cancer” ] for comparing /must have spaces between every characters
read - like a scanner in a nutshell
ex. read test
echo $test
# see the next line for the sample output
$1 = to call a variable the number “1” can be changed up to 255
ex. $human # it will print the word “cancer” if called and also can be used in boolean
$1 - like command read and used when executing script shell, unlike read it is required when
executing a script.
ex. echo “$1”
username# sh test.sh reeeee
output:
reeeee
-f - file name
ex. touch test.sh
if test -f tesh.sh; then #This is true such that tesh.sh exist
-d directory location
ex. if test -d /home; then #This is true such that tesh.sh exist
fi - to end the if looping condition, done in for and while looping and esac in case looping
for S in *; do
echo "Doing something to $S"
done
# “*” is a glob so it will print all your filename/folders at $S
i=0
while [ $i -lt 3 ]; do
echo $i
i=$(( $i + 1))
exit
done
#it supposed to print 3x but there’s the exit command; it will only print only 1
exit - disregards the remaining ling codes and stops the execution of the shell.
Chapter 10:
CPU
A Central Processing Unit (CPU or processor) is one of the most important hardware
components of a computer. It performs the decision making as well as the calculations that
need to be performed to properly run an operating system. The processor is essentially a
computer chip.
On a x86_64 the system processes data 64 bits at a time. A x86_64 system is also capable of
also processing data 32 bits at a time in a backward compatible mode. One of the main
advantages to a 64 bit system is that the system is able to work with more memory.
You can see the family your CPU belongs to, using the these three commands:
arch
lscpu
cat /proc/cpuinfo
arch (cmd):
lscpu (cmd)
cat /proc/cpuinfo (cmd and more detailed)
dmidecode
The system board of many computers contains what is known as Basic Input and Output
System (BIOS). System Management BIOS (SMBIOS) is the standard that defines the data
structures and how to communicate information about computer hardware. The dmidecode
command is able to read and display the information from SMBIOS.
dmidecode (cmd)
lsusb
To display the devices connected to the system via USB, execute the lsusb command:
The verbose option, -v, for the lsusb command shows a great amount of detail about each
device:
lsusb (cmd)
Disk devices (AKA, hard drives)
An old term used to describe an internal hard disk is "fixed disk", as the disk is fixed (not
removable). This term gave rise to several command names: the fdisk, cfdisk and sfdisk
commands, which are tools for working with the MBR partitioned disks.
The GPT disks use a newer type of partitioning, which allows the user to divide the disk into
more partitions than what MBR supports. GPT also allows having partitions which can be larger
than two terabytes (MBR does not). The tools for managing GPT disks are named similar to the
fdisk counterparts: gdisk, cgdisk, and sgdisk.
There is also a family of tools that attempts to support both MBR and GPT type disks. This set
of tools includes the parted command and the graphical gparted tool.
Peripheral Devices
The motherboard has buses that allow for multiple devices to connect to the system, including
the Peripheral Component Interconnect (PCI) and Universal Serial Bus (USB). The motherboard
also has connectors for monitors, keyboards and mice.
In order to view all of the devices connected by the PCI bus, execute the lspci command.
lscpi
To view the amount of RAM in your system, including the virtual RAM, execute the free
command. The free command has a -m option to force the output to be rounded to the nearest
megabyte and a -g option to force the output to be rounded to the nearest gigabyte:
chapter 10 keyterms
/dev/
Hardware devices are made available through special files under the /dev directory.
/dev/sd*
Partitions are given unique numbers for each device. For example, if a USB hard drive had two
partitions, they could be associated with the /dev/sda1 and /dev/sda2 device files.
Examples:
/dev/hda /dev/hdb
a = first installed hardware hard drive
b= second installed hardware hard drive
/dev/sda1
1 = partition
driver
Drivers are software programs that allow the operating system to communicate with the device.
optical disks
Optical disks, often referred to as CD-ROMs, DVDs, or Blue-Ray are removable storage media.
partition
Hard drives are divided into partitions. A partition is a logical division of a hard drive, designed to
take a large amount of available storage space and break it up into smaller "chunks".
power supplies
Power supplies are the devices that convert alternating current (120v, 240v) into direct current,
which the computer uses at various voltages (3.3v, 5v, 12v, etc.).
swap
a virtual ram utilized by a hard disk drive but it is much slower than an actual RAM (Random
Access Memory)