Which Command Is Used To Display The Operating System?

Learn via video courses
Topics Covered

The command used to display the name of operating system:

  1. Linux based OS:

    • uname -a
    • uname -r
    • cat /etc/os-release
    • lsb_release -a
    • hostnamectl
  2. Windows:

    • systeminfo
  3. macOS/UNIX:

    • uname -a
    • sw_vers

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

Linux based operating systems

To know the name of the operating system, open the terminal using Ctrl+Alt+T or by selecting it from the application menu.

Now, in the terminal window, use any of the following commands to know the name of your operating system:

Command 1: Just the name of the operating system

Output:

Here you can see the name of the operating system ("Ubuntu") along with the processor architecture present on which the OS is running, that is x86_64. The output also shows the timestamp as to when the command was executed.

There are a few variations of this command:

Command 2: Getting just the kernel version

Output:

More flags for this uname command can be found using the following command:

Some other commands that can be used to display the name of the operating system in Linux are:

Command 3:

Output:

The cat command is used to display the contents of any file that is given as arguement. Here, the file /etc/os-release contains all this information, which is presented in the terminal window.

Command 4:

Output:

Please note that it is possible that lsb_release might not be installed on your Linux system by default. Hence, to use this command, install lsb_release prior to using it.

Command 5:

Output:

Please note that Machine ID and Boot ID are hidden for security purposes in the above output, but they will be displayed on your command line.

Windows operating system

To display the name of the operating system, open the command prompt and enter the following command:

This command will give multiple lines of output in the command prompt. Only two of those lines (2nd and 3rd line) are important for us right now:

Output:

Free Courses by top Scaler instructors
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course

UNIX / macOS

Since macOS is built upon UNIX, the same command will work on both the systems.

Use the following commands in the terminal:

Command 1:

Output:

Darwin here refers to the base kernel used by macOS.

Command 2:

Output:

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Learn More About Operating Systems

Read article to learn more about operating systems. What is Operating System?

Conclusion

We learned which command is used to display The Operating System Name:

  1. Linux based OS:

    • uname -a
    • uname -r
    • cat /etc/os-release
    • lsb_release -a
    • hostnamectl
  2. Windows:

    • systeminfo
  3. macOS/UNIX:

    • uname -a
    • sw_vers