Page 40 - Raspberry Pi as a Foundation for Boosting Computer and Technology Literacy
P. 40
3 Fundamentals of the Linux system and terminal usage
Table 3.2 Frequently used commands for managing files and directories
Command Description
touch path-to-file Create a file
cat path-to-file Print out the file contents
less path-to-file Read a large file
rm path-to-file Remove an existing file
cp /old/path /new/path Copy a file or directory from one path to another
mv /old/path /new/path Move a file or directory from one path to another
(can be used for renaming)
pwd Print working directory
cd path-to-directory Change directory
ls path-to-directory List the contents inside a directory
mkdir path-to-directory Make a new directory
rmdir path-to-directory Remove an existing directory
automatically launches inside a current user’s home folder by default
(i.e., denoted by ‘~’).
Above are some of the frequently used commands for navigating di-
rectories, creating directories and files, as well as copying, moving, and
deleting them (Table 3.2).
System resource monitoring
Like every other operating system, Linux obscures its components and
inner workings from the user behind various layers of abstraction.
In this case, at the highest level is the user space, where user pro-
cesses operate. This space includes various GUI programs (e.g. a web
browser), servers (e.g. a display server), and shells (e.g. bash). These
user processes run in user mode, which restricts their RAM access to
a limited subset and ensures only safe CPU operations are executed.
The data from the user space are received and processed by the kernel,
which is responsible for such kernel processes as memory and process
management as well as handling device drivers. This middle level is
referred to as kernel space, with the processes running in kernel mode,
granting them unrestricted access to the CPU and RAM. This distinc-
tion in access privileges between kernel and user modes is fundamen-
tal for system stability and security. Finally, the CPU starts reading
and executing the kernel’s instructions from the RAM and interfaces
with other hardware devices (Ward 2021, 2–3).
To see this in action, one can run the top command to check what
processes are currently running on the system as well as how much
40