🔹 Hands-on Task 1: Check OS Details
✅ Windows:
Open Command Prompt (Win + R → cmd) and run:
✅ Linux/macOS:
Open a terminal and run:
📝 Observe the OS name, version, and kernel details.
____________________________________________________________________________
✅ Windows:
Open Command Prompt (Win + R → cmd) and run:
The command:
Explanation:
systeminfo
- This command displays detailed system information, including OS details, architecture, installed updates, BIOS version, and more.
|
(Pipe Operator)
- The pipe (
|
) takes the output ofsysteminfo
and passes it as input to the next command (findstr
).
findstr /B /C:"OS Name" /C:"OS Version"
findstr
is used to filter specific lines from the output./B
→ Matches only lines that start at the beginning (B
stands for "beginning")./C:"OS Name"
→ Searches for lines that contain exactly "OS Name"./C:"OS Version"
→ Searches for lines that contain exactly "OS Version".
The /C:
option is used to specify that findstr
should search for exactly the string that follows the /C:
option, including spaces and special characters.
What it does:
/C:"OS Version"
: This tellsfindstr
to look for the exact phrase "OS Version" (including the space between "OS" and "Version").- Without the
/C
option,findstr
would look for the individual characters "O", "S", "V", "e", "r", "s", "i", "o", "n" in any order, which could lead to incorrect results. However, with/C
, it ensures that only the full string "OS Version" is matched.
Purpose:
This command extracts and displays only the Operating System Name and Operating System Version from the systeminfo
output.
Example Output:
____________________________________________________________________________
✅ Linux/macOS:
Open a terminal and run:
1. uname -a
:
uname
is a command used to print system information. The-a
option tellsuname
to display all available system information.
The output of uname -a
typically includes the following details:
- Kernel name: The name of the operating system kernel (e.g.,
Linux
). - Node name: The hostname of the machine.
- Kernel release: The version of the kernel.
- Kernel version: The complete version of the kernel, including build details.
- Machine architecture: The architecture of the system (e.g.,
x86_64
for 64-bit). - Processor type: The type of processor (e.g.,
x86_64
). - Hardware platform: The platform the system is running on (e.g.,
x86_64
orarm
). - Operating System: The name of the operating system (e.g.,
Ubuntu
,Debian
, etc.).
Example output:
In this example:
- Kernel name:
Linux
- Node name (hostname):
myhostname
- Kernel release:
5.4.0-42-generic
- Kernel version:
#46-Ubuntu SMP Thu Jul 9 16:05:30 UTC 2020
- Machine architecture:
x86_64
- Operating system:
GNU/Linux
2. cat /etc/os-release
:
cat
is a command used to display the contents of a file./etc/os-release
is a system file that contains information about the Linux distribution and its version.
The output from cat /etc/os-release
provides detailed information about the distribution, such as:
- NAME: The name of the distribution (e.g.,
Ubuntu
,Debian
,CentOS
). - VERSION: The version number of the distribution.
- ID: A lowercase identifier for the distribution (e.g.,
ubuntu
,centos
). - VERSION_ID: The version identifier for the distribution (e.g.,
20.04
for Ubuntu 20.04). - PRETTY_NAME: A human-readable description of the OS, which might include the name and version (e.g.,
Ubuntu 20.04 LTS
). - HOME_URL: A URL for the distribution’s homepage.
- SUPPORT_URL: A URL for the distribution’s support page.
- BUG_REPORT_URL: A URL to report bugs for the distribution.
Example output:
In this example:
- NAME:
Ubuntu
- VERSION:
20.04 LTS (Focal Fossa)
- ID:
ubuntu
- VERSION_ID:
20.04
- PRETTY_NAME:
Ubuntu 20.04 LTS
0 Comments