Commands, Shells, Processes, and Files

Contents

1. Commands, Shells, Processes, and Files#

1.1. Overview#

This module covers the overall course organization and introduces fundamental Linux operating system concepts:

  • The Linux kernel

  • Process lifecycles and management

  • File system structure and permissions

  • User accounts and authentication

  • Basic terminal commands and shell execution


1.2. Course Organization#

  • Remote Virtual Desktop (VD) Access

  • Canvas Learning Management System

  • Class Slack Channel

  • Official Course Website

  • Interactive Lectures

  • Hands-on Practical Exercises (recitations and homeworks)

  • Midterm and Final Examinations


1.3. Course Agenda#

  • Lectures & Practical Recitations: Conducted remotely using dedicated virtual machines.

  • Homework Assignments: Completed on the virtual desktops. Checked in place by the instructor.

  • Midterm Examination: October 20, 2026.

  • Final Examination: December 15, 2026.


1.4. Course Topics#

  • Command Line Interface (CLI): Core system commands, directory traversal, process control, user accounts.

  • Operating System Virtualization: KVM virtualization and VM management workflows.

  • Package Management: Software installation using apt, dnf, rpm, and dpkg.

  • Networking: TCP/IP concepts, diagnostic utilities, interface configuration, network services.

  • Network File System (NFS): Remote storage mounting and sharing between Linux systems.

  • Shell Scripting: bash scripting, awk, grep, sed, regular expressions.

  • Task Control and Scheduling: Systemd, systemctl, and unit files. Deferred execution via at and automated recurring jobs via cron.

  • Python for Linux administration: venv and Conda environments, Jupyter Notebooks, various modules, and scripting.

  • Software Compilation: Source code compilation, Makefiles, shared and static libraries.

  • System Security: Password security policies, brute-force mitigation, iptables, port scanning analysis.

  • GPU Computing: CUDA architecture, PyTorch framework, neural networks.


1.5. Hardware Architecture Overview (Intel Core i7 Example)#

  • Execution Flow: The operating system and applications load from disk storage into system RAM.

  • Kernel Control: The operating system kernel manages hardware devices and process scheduling.

  • Key Components:

    • CPU: Central Processing Unit (executes program instructions).

    • RAM: Random Access Memory (main system storage for active processes).

    • PCIe: Peripheral Component Interconnect Express (high-speed expansion bus, such as PCIe 3.0/4.0/5.0).

    • PCH: Platform Controller Hub (coordinates communications between PCIe, USB, and SATA controllers).

    • DMI: Direct Memory Interface (interconnects CPU and PCH).

    • LPC: Low Pin Count bus (connects lower-bandwidth I/O devices).

+-------------------------------------------------------+
|                       CPU                             |
|  +---------------------+     +---------------------+  |
|  |     CPU Cores       |     |  Memory Controller  |  |
|  +---------------------+     +----------+----------+  |
+-----------------------------------------|-------------+
                                          | System Bus / DMI
+-----------------------------------------v-------------+
|              PCH (Platform Controller Hub)            |
|  +------------------+  +---------------+  +--------+  |
|  | PCIe Controllers |  | SATA / Storage|  | USB /  |  |
|  | (High-Speed Bus) |  | (HDDs / SSDs) |  | LPC    |  |
|  +------------------+  +---------------+  +--------+  |
+-------------------------------------------------------+

title

Accessible Image Description:

  • Overview: Block diagram of a standard computer hardware architecture showing relationships between the CPU, RAM, and Platform Controller Hub (PCH).

  • Setup: The CPU contains execution cores and a memory controller linked directly to system RAM, while communicating with peripherals and storage via the DMI link to the PCH.

  • Key Takeaways: High-speed subsystems like RAM connect directly to the CPU, whereas lower-speed input/output buses route through the PCH chipset.


1.6. Purpose of Operating Systems#

Refer to standard Operating System Concepts for background reading.

1.6.1. Core Functions#

+-------------------------------------------------------+
|                    User Applications                  |
|          (Web Browsers, Editors, Python Scripts)      |
+-------------------------------------------------------+
                           | System Calls
+-------------------------------------------------------+
|                    Operating System                   |
|       (Kernel, System Libraries, Device Drivers)      |
+-------------------------------------------------------+
                           | Driver Interfaces
+-------------------------------------------------------+
|                    Computer Hardware                  |
|          (CPU, RAM, Disk Storage, Network Cards)      |
+-------------------------------------------------------+

title

Accessible Image Description:

  • Overview: Layered computing stack diagram highlighting the operational placement of the operating system.

  • Setup: User applications occupy the top layer, interacting with the middle operating system layer via system calls, which manages the physical hardware at the base layer.

  • Key Takeaways: The operating system provides a necessary hardware abstraction layer between user-level software applications and raw physical components.


1.7. Linux Kernel and Applications#

Strictly speaking, “Linux” refers specifically to the OS kernel rather than a full distribution.

  • Linux Distributions: Combine a plain or modified kernel with standard GNU software tools, libraries, system shells, and user applications.

  • Open Source: Source code for the Linux kernel, shells, and standard utilities is freely inspectable and configurable.

  • Core Administration Languages: C, Shell Scripting (bash), and Python.

+-------------------------------------------------------+
|      User Space: Applications, Shells, Compilers      |
+-------------------------------------------------------+
                           | System Calls Interface (POSIX)
+-------------------------------------------------------+
|      Kernel Space: Process & Memory Management,       |
|      File Systems, Networking & Device Drivers       |
+-------------------------------------------------------+
                           | Hardware Interfaces
+-------------------------------------------------------+
|     Hardware: CPU, Memory, Disk Drives, Network       |
+-------------------------------------------------------+

Linux kernel

Accessible Image Description:

  • Overview: Architecture schematic illustrating how the Linux kernel mediates between application software and underlying hardware.

  • Setup: Applications run in user space, passing requests through standardized POSIX system call interfaces to kernel subsystems, which govern hardware execution.

  • Key Takeaways: Linux enforces operational isolation between user-space programs and kernel-space core routines to guarantee system security and fault tolerance.


1.8. Virtual Desktop Access Workflow#

To connect to your virtual environment, execute the standardized workflow:

[Web access to Ravada portal with authentication] ===> [Start VM] ===> [Access VM via SSH with provided port]

Connect to your VD in Ravada cluster

Accessible Image Description:

  • Overview: User interface connection guide showing how to access a Virtual Desktop instance within the Ravada management portal.

  • Setup: Shows web authentication into the Ravada cluster, launching the assigned virtual host, and noting the dynamic port required for an SSH client connection.

  • Key Takeaways: Remote lab access relies on web-based VM orchestration followed by targeted port redirection via SSH.


1.9. Logging into a Linux Terminal#

+---------------+     Prompt User     +---------------------+
| User Terminal | ------------------> | Username / Password |
+---------------+                     +----------+----------+
                                                 |
                                                 v
                                      [Authentication System]
                                     (/etc/passwd & /etc/shadow)
                                                 |
                               +-----------------+-----------------+
                               |                                   |
                           (Success)                           (Failure)
                               |                                   |
                               v                                   v
                   [Interactive Shell Spawning]          [Access Denied Warning]

Login to Linux System

Accessible Image Description:

  • Overview: Authentication flow map displaying terminal initial login steps.

  • Setup: Illustrates credentials validation through user authentication files, culminating in an established user shell context upon success.

  • Key Takeaways: Validating user identity initializes an interactive command shell linked directly to user account privileges.


1.10. User Accounts and Authentication#

Logging in requires authenticating user credentials (username and password).

1.10.1. Authentication Methods#

  • Local Authentication: Uses internal files (/etc/passwd, /etc/shadow, /etc/group).

  • Domain Authentication: Uses centralized services (NIS, Kerberos, LDAP, Active Directory).

1.10.2. Standard Account Files#

Account Configuration File

Example Entry Syntax

Description

/etc/passwd

mike:x:1001:1001:Michael Whites:/home/mike:/bin/bash

User profile, UID, GID, home directory, default shell

/etc/shadow

mike:$1$zXCV7fz8ii84grbZhj:14087:0:99999:7:::

Encrypted user password hash and aging policies

/etc/group

mike:x:1001:mike

Primary user group definition

/etc/group

admin:x:112:hostadm,mike

Secondary group memberships

Note: Only the superuser (root) can create or modify system accounts.

1.10.3. Account Creation Commands#

  • adduser: Interactive high-level script for user creation.

  • useradd: Low-level system utility suitable for non-interactive automation scripts.


1.10.4. Exercise: Account Creation#

  1. Elevate session privilege to root:

    sudo -s
    
  2. Create a new account named mike:

    adduser mike
    
  3. Confirm account creation and review identity identifiers (UID/GID):

    id mike
    
  4. Update the account password:

    passwd mike
    

1.11. Linux Shell Environment#

Upon successful login, an interactive shell processes user input. Default Linux shell: bash. Available shells are enumerated in /etc/shells.

Commands, scripts, and applications executed in the shell run as child processes of that shell.

1.11.1. Shell Variables vs. Environment Variables#

Define a standard shell variable:

svar='file_name.txt'
echo $svar

Shell variables remain local to the active shell process. Exporting converts a local variable into an environment variable, allowing child processes to inherit it:

svar='VAR_1'    # Initialize local variable
export svar     # Promote to environment variable
env | grep svar # Confirm export status

Commands entered in the terminal must be shell built-ins, specified via explicit file path, or located within directories declared in the PATH environment variable:

echo $PATH

1.11.2. Exercise: Variable Scope and Inheritance#

  1. Define a local shell variable:

    svar='VAR_1'
    echo $svar
    
  2. Spawn a child shell process and test variable access (returns empty):

    bash
    echo $svar
    
  3. Terminate child shell, export variable, and verify inheritance in a new child shell:

    exit
    export svar
    bash
    echo $svar
    exit
    

1.12. Data Storage Architecture Hierarchy#

  • Data Objects: Stored within structured files.

  • File Systems: Built on logical storage volumes.

  • Volumes: Spanning single or multiple physical drive devices.

  • Mounting: Attaching a file system to a directory node in the system directory tree.

+-------------------------------------------------------+
|                    Physical Drives                    |
|             [ Disk 1 ]  [ Disk 2 ]  [ Disk 3 ]         |
+-------------------------------------------------------+
                           | Aggregated / Partitioned
                           v
+-------------------------------------------------------+
|                     Logical Volume                    |
+-------------------------------------------------------+
                           | Formatted with
                           v
+-------------------------------------------------------+
|                   File System (ext4)                  |
+-------------------------------------------------------+
                           | Attached via
                           v
+-------------------------------------------------------+
|                 Mount Point Directory                 |
|                     (e.g., /home)                     |
+-------------------------------------------------------+

How data is stored

Accessible Image Description:

  • Overview: Layered block diagram representing storage abstractions from physical drives to mounted directories.

  • Setup: Illustrates physical disks combined into logical storage volumes, formatted with a file system, and linked to a mount directory.

  • Key Takeaways: Physical disk blocks are logically abstracted by file systems to present seamless file paths to operating system users.


1.13. HDD and SSD Hardware Characteristics#

1.13.1. Hard Disk Drives (HDD)#

+-------------------------------------------------------+
|                 Hard Disk Drive Structure             |
|  +-------------------------------------------------+  |
|  | Platter / Cylinders (Partition Boundaries)      |  |
|  |  +-------------------------------------------+  |  |
|  |  | Sectors / Tracks (Individual Data Blocks) |  |  |
|  |  +-------------------------------------------+  |  |
|  +-------------------------------------------------+  |
+-------------------------------------------------------+
Mechanical hard drive structure and partitioning

Accessible Image Description:

  • Overview: Diagram illustrating mechanical hard drive physical geometry including platters, tracks, and partitions.

  • Setup: Displays rotating platters divided into concentric tracks and sectors, grouped into logical partitions.

  • Key Takeaways: Disk partitions follow mechanical cylinder boundaries, defining layout areas for file systems.

  • Geometry: Cylinders establish partition boundaries; sectors define individual data blocks.

  • Operational Lifespan: Typical mechanical HDD endurance is approximately 5 years under continuous operation.


1.13.2. Solid State Drives (SSD) and NAND Technology#

+-------------------------------------------------------+
|                  NAND Flash Cell States               |
|    [ Programmed State ]   <----->   [ Erased State ]  |
|   (Trapped Electrons/0)             (High Voltage/1)  |
+-------------------------------------------------------+
NAND flash memory cell state transitions

Accessible Image Description:

  • Overview: Schematic of NAND cell charging states during read, program, and erase operations.

  • Setup: Shows floating-gate electron trapping mechanisms that delineate binary 1 and 0 logical states.

  • Key Takeaways: Solid-state storage retains data non-volatilely by adjusting electrical charge levels in micro-scale semiconductor cells.

+-------------------------------------------------------+
|                    SSD Architecture                   |
|  +-------------------------------------------------+  |
|  | Memory Controller & Host Interface (SATA/NVMe)  |  |
|  +-------------------------------------------------+  |
|                          |                            |
|  +-------------------------------------------------+  |
|  | NAND Flash Arrays (Banks -> Blocks -> Pages)     |  |
|  +-------------------------------------------------+  |
+-------------------------------------------------------+
Internal functional block diagram of a Solid State Drive

Accessible Image Description:

  • Overview: Architecture block layout showing how NAND flash cells form pages, blocks, planes, and controller channels.

  • Setup: Details how memory components connect to an integrated host controller managing parallel data channels.

  • Key Takeaways: SSD throughput is maximized by organizing individual NAND cells into parallel access arrays.


1.13.3. NAND Cell Endurance Comparison#

Metric / Cell Type

SLC (Single-Level Cell)

MLC (Multi-Level Cell)

TLC (Triple-Level Cell)

QLC (Quad-Level Cell)

Bits per Cell

1 bit

2 bits

3 bits

4 bits

Write Endurance

~100,000 P/E cycles

~10,000 P/E cycles

~3,000 P/E cycles

~1,000 P/E cycles


1.13.4. Hardware Metrics Comparison#

Device Type

Capacity

Average Cost

Read/Write Throughput

Latency

Random IOPS

SATA Mechanical HDD

20 TB

~$800

~120 MB/s

~5.0 ms

~100

SATA SSD

4 TB

~$1,400

~500 MB/s

~0.05 ms

~100,000

NVMe PCIe SSD

4 TB

~$500

~7,000 MB/s

~0.02 ms

~500,000


1.14. Inodes, Files, and Directories#

+-------------------+       +------------------------------------+
| Directory Entry   |       | Inode Table Entry                  |
|  Filename: file1  | ----> |  Inode Number: 104523              |
|  Inode ID: 104523 |       |  Permissions: rw-r--r--            |
+-------------------+       |  Owner/Group: mike/staff           |
                            |  Size: 4096 bytes                  |
                            |  Data Block Pointers: [B1, B2, B3] |
                            +------------------------------------+
Mapping between directory entries and system inodes

Accessible Image Description:

  • Overview: Schematic displaying directory record references linking filenames to internal inode records.

  • Setup: A directory entry contains filename strings and pointer references to an inode entry storing attributes and data block locations.

  • Key Takeaways: Directory records store human-readable names, while file system metadata and physical layout are decoupled inside inodes.

1.14.1. Inode Metadata Attributes#

  • Data block location pointers

  • Hard link count

  • User owner (UID) and group owner (GID)

  • Access permission bits (mode)

  • Byte size

  • Timestamps: Access (atime), Modification (mtime), Metadata Change (ctime)

1.14.2. File Types and Allocation#

  • File Types: Regular files, Directories, Symbolic links, Device node files (block/character).

  • Block Allocation: Storage space is allocated in discrete block sizes (e.g., standard 4 KB blocks on ext4).

# Check block size of file system
stat -f /home

1.15. File Permissions and Ownership#

1.15.1. Permission Bit Modes#

Octal Value

Binary Representation

String Mode

Access Capabilities

0

000

---

No permissions granted

1

001

--x

Execute only

2

010

-w-

Write only

3

011

-wx

Write and Execute

4

100

r--

Read only

5

101

r-x

Read and Execute

6

110

rw-

Read and Write

7

111

rwx

Read, Write, and Execute

1.15.2. Permission Classes#

Permissions apply across three scopes: User Owner (u), Group Owner (g), and Others (o).

Example permission modification:

chmod 660 testf.txt
ls -l testf.txt
# Output: -rw-rw---- 1 mike staff 0 Jan 18 10:26 testf.txt

1.15.3. Unmasking Default File Creation Modes (umask)#

The system umask subtracts permission bits from base defaults (Directories base: 777, Files base: 666).

Context

Base Default Permissions

umask Setting

Effective Access Mode

Mode Notation

Directory

777

022

755

rwxr-xr-x

Regular File

666

022

644

rw-r--r--


1.15.4. Exercise: File Permissions and Ownership Setup#

  1. Create a practice workspace directory:

    mkdir EX1
    cd EX1
    
  2. Inspect umask and test default permission application:

    umask
    touch mf1.txt
    ls -l mf1.txt
    
  3. Modify umask and create a second file:

    umask 022
    touch mf2.txt
    ls -l mf2.txt
    
  4. Create and grant execution rights to an executable file:

    touch mf3.exe
    chmod 755 mf3.exe
    ls -l mf3.exe
    
  5. Test execution behavior:

    ./mf2.txt # Fails: Permission denied
    ./mf3.exe # Executes successfully
    
  6. Alter user and group ownership (requires superuser access):

    sudo chown mike mf1.txt
    sudo chown :mike mf2.txt
    sudo chown mike:mike mf3.exe
    ls -l mf*
    

1.15.5. Exercise: Directory Sticky Bit Flags#

The sticky bit permission flag (t) on shared directories (e.g., /tmp) prevents non-owner users from removing or renaming files created by others.

ls -ld /tmp
# Output format: drwxrwxrwt 4 root root 4096 Jul 25 16:29 /tmp
  1. Terminal 1 (Superuser Context):

    sudo -s
    mkdir /tmp/temp
    chmod 777 /tmp/temp
    cd /tmp/temp
    touch ex3
    
  2. Terminal 2 (Regular User Context):

    cd /tmp/temp
    rm ex3 # File successfully deleted (Sticky bit not yet set)
    
  3. Terminal 1 (Enable Sticky Bit):

    touch /tmp/temp/ex3
    chmod 1777 /tmp/temp
    
  4. Terminal 2 (Re-test Deletion):

    cd /tmp/temp
    rm ex3 # Operation rejected: Permission denied
    

1.16. Operating System Processes#

A running program instance in memory constitutes a process. Linux enforces multi-processing via hierarchical process spawning (forking from parent processes).

1.16.1. Process Categories#

  • User Processes: Initiated by standard accounts operating entirely within user space.

  • Daemon Processes: Background services running continuously to handle system requests.

  • Kernel Threads: Operating system execution tasks executing strictly within kernel space.

1.16.2. Privilege Protection Rings#

+-------------------------------------------------------------+
| Ring 3: User Space (User Processes, Programs, Daemons)      |
+------------------------------+------------------------------+
                               | System Call Interface
                               v
+-------------------------------------------------------------+
| Ring 0: Kernel Space (Kernel Threads, Drivers, System Core) |
+-------------------------------------------------------------+

_images/2560px-Priv_rings.svg.png

Accessible Image Description:

  • Overview: Privilege ring diagram detailing CPU hardware isolation levels between kernel and user execution modes.

  • Setup: Shows Ring 0 at the core (kernel space execution) outward to Ring 3 (unprivileged user space execution).

  • Key Takeaways: Rings provide security control preventing user processes in Ring 3 from overriding kernel memory or hardware instructions in Ring 0.


1.17. Process Life Cycle States#

+----------+      Fork/Create      +----------+      Scheduler      +----------+
|  Created | --------------------> |  Ready   | ------------------> | Running  |
+----------+                       +----------+                     +----+-----+
                                        ^                                |
                                        |          Yield/Preempt         |
                                        +--------------------------------+
                                        |                                |
                                   I/O Event                      Wait for I/O
                                        |                                |
                                   +----+-----+                          |
                                   | Blocked  | <------------------------+
                                   +----------+
                                        |
                                        | Exit / Terminate
                                        v
                                   +----------+
                                   | Zombie / |
                                   | Terminated|
                                   +----------+

_images/1920px-Process_states.svg.png

Accessible Image Description:

  • Overview: Finite-state machine diagram illustrating process state transitions.

  • Setup: Maps process progress through Created, Ready, Running, Blocked (Waiting), and Terminated/Zombie states.

  • Key Takeaways: Process movement between states is managed dynamically by system resource calls and CPU scheduling interrupts.


1.18. Process Monitoring, Signals, and Execution Priority#

  • Primary Attributes: Process ID (PID), Parent Process ID (PPID), User ID (UID), Group ID (GID), Environment block, Current Working Directory (CWD).

  • Root Init Process: PID 1 (traditionally init or systemd).

  • Monitoring Tools: ps -ef, ps aux, top, htop, pstree.

1.18.1. Common Signals (kill)#

kill -HUP 1009   # Hangup (Signal 1): Request configuration reload
kill -INT 1009   # Interrupt (Signal 2): Keyboard interrupt (Ctrl+C)
kill -KILL 1009  # Kill (Signal 9): Immediate uncatchable termination
kill -TERM 1009  # Terminate (Signal 15): Graceful shutdown request
kill -TSTP 1009  # Terminal Stop (Signal 20): Suspend execution (Ctrl+Z)

1.18.2. Scheduling Priority Adjustment (nice and renice)#

Niceness values range from -20 (highest scheduling priority) to +19 (lowest scheduling priority).

  • Launch with Modified Priority:

    nice -n 10 matlab   # Lower priority (+10)
    nice -n -10 matlab  # Higher priority (-10, superuser required)
    
  • Modify Priority of Active PID 1009:

    renice -p 5 -p 1009  # Adjust PID 1009 priority to +5
    

1.18.3. Exercise: Process Control and Signal Termination#

  1. Download and set up a CPU test script:

    wget http://capone.rutgers.edu/coursefiles/inf_loop.py
    chmod 755 inf_loop.py
    
  2. Execute script in the background:

    ./inf_loop.py &
    
  3. Query active PID using pgrep:

    pgrep -l inf_loop.py
    
  4. Terminate process gracefully using Signal 15 (SIGTERM):

    kill -15 <PID>
    
  5. Alternatively, terminate using target pattern matches:

    pkill -15 -f inf_loop.py
    

1.19. Process Standard Data Streams#

Every standard Linux process initializes with three basic I/O descriptors:

  • Standard Input (stdin): File Descriptor 0 (reads keyboard input by default).

  • Standard Output (stdout): File Descriptor 1 (prints output to display monitor by default).

  • Standard Error (stderr): File Descriptor 2 (prints error logs to display monitor by default).

[ Input Source (Keyboard/File) ] ---> stdin (FD 0)
                                           |
                                           v
                                    [ Operating Process ]
                                     /                 \
                                    /                   \
                   stdout (FD 1)   /                     \   stderr (FD 2)
                                  v                       v
                    [ Terminal / Output File ]     [ Log File / Error Screen ]

1.19.1. I/O Stream Redirection Examples#

# Redirect standard output to a file (overwrites existing content)
ps -ef > stdout.out

# Append standard output to a file
ps -ef >> stdout.out

# Redirect both stdout and stderr to a single output destination
ps -ef > combined_output.txt 2>&1

# Discard standard output by streaming into null device
ps -ef 1> /dev/null

# Pipe stdout of process into stdin of reader process
ps -ef | less

1.19.2. Exercise: Managing Background and Foreground Jobs#

  1. Launch execution script interactively:

    ./inf_loop.py
    
  2. Suspend running task and move to background execution:

    Press: Ctrl + Z
    
    jobs
    bg %1
    
  3. Return background job to active foreground session and cancel job:

    fg %1
    
    Press: Ctrl + C
    

1.20. Essential Practical Commands Reference#

1.20.1. Directory Management#

# 1. Display present working directory path
pwd

# 2. Change active directory to /etc
cd /etc

# 3. Return directly to user home directory
cd $HOME   # Or simply: cd ~

# 4. Toggle back to previous directory node
cd -

# 5. Make a single directory node
mkdir Newdir

# 6. Traverse down and back up tree paths
cd Newdir
cd ..

# 7. Remove empty directory
rmdir Newdir

# 8. Recursively create multi-tiered subdirectories
mkdir -p Newdir/one/two/three

# 9. Create files using touch compound commands
cd Newdir/one; touch f1.t f2.t f3.t

# 10. Recursively delete directory trees and contained contents
rm -r Newdir

# 11. Copy directory trees preserving permissions and attributes
cp -a Newdir Newdir-1

1.20.2. Viewing Text File Content#

# Display entire file contents
cat /etc/hosts

# Read file contents in reverse line order
tac /etc/hosts

# Page interactively through content
less /etc/hosts

# Print top or bottom 10 lines of file target
head -n 10 /etc/nsswitch.conf
tail -n 10 /etc/nsswitch.conf

1.20.3. System Information and Utilities#

# Display current date, time, and system clock settings
date

# Display disk space allocation by file system in human-readable units
df -h

# Calculate directory tree storage usage
du -h /home
du -sh /home
du --max-depth=1 /var

# Test evaluation vs. literal shell variable string printing
echo $[10*3+2]       # Prints evaluated result: 32
echo '$[10*3+2]'     # Prints explicit string: $[10*3+2]
echo "$[10*3+2]"     # Prints evaluated result: 32

# Identify target file encoding and file formats
file /bin/ls
file /etc/hosts

# Show user account sessions currently logged in
who

# Display identity of active shell session user
whoami

# Query command documentation and manual pages
whatis whoami
apropos whoami
man whoami

1.20.4. Archiving and File Compression#

# Compress and decompress files via Gzip
cp /etc/hosts ~/hosts.txt
gzip ~/hosts.txt         # Produces hosts.txt.gz
zcat ~/hosts.txt.gz      # Read gzip file stream without decompressing
gunzip ~/hosts.txt.gz    # Decompress back to raw file

# Compress and decompress files via Bzip2
bzip2 ~/hosts.txt        # Produces hosts.txt.bz2
bzip2 -d ~/hosts.txt.bz2 # Decompress back to raw file

# Create a Gzip-compressed Tape Archive (.tar.gz / .tgz)
tar -zcvf Newdir.tgz Newdir

# Inspect and extract tar.gz archives
tar -ztvf Newdir.tgz    # List contents without extraction
tar -zxvf Newdir.tgz    # Extract contents to current directory

1.20.5. File Search Operations#

# Search system file trees by explicit filename match
find / -name fff.txt

# Search within target path for wildcards and execute action upon match
find /tmp -name "*ff*" -exec rm -f '{}' ';'

# Search file paths based on size metrics (>100MB)
find /var -size +100M

# Search paths by owner UID
find /home -user hostadm

# Locate commands and binary locations in system PATH
which dpkg
whereis dpkg

1.20.6. Web Downloads and Command History#

# Download web resources directly via terminal commands
wget https://people.sc.fsu.edu/~jburkardt/c_src/laplace_mpi/laplace_mpi.c
curl -O https://people.sc.fsu.edu/~jburkardt/c_src/laplace_mpi/laplace_mpi.c

# Inspect interactive command-line history
history

# Reverse-i-search command history shortcut:
# Press Ctrl + R, then type string matches to locate past commands

# View dynamic history persistence configuration settings
echo $HISTSIZE
tail ~/.bash_history

1.20.7. Inspecting Hardware Specifications#

# Query CPU architecture and core layout parameters
lscpu

# List PCI bus controllers and attached peripheral devices
lspci

# Install lshw utility for comprehensive hardware reporting
sudo apt install lshw

# Probe detailed subsystem hardware profiles
lshw -class memory     # Memory topology
lshw -class storage    # Storage controllers
lshw -class disk       # Physical disk drives
lshw -class network    # Network interface cards
lshw -class video      # Graphics controllers and displays