Linux vs.Windows 101, including Commands in Terminal vs. CMD

Linux vs.Windows 101, including Commands in Terminal vs. CMD

There are many Operating Systems (OSes) that are available in the market, including UNIX-based OSes, Linux-based OSes, macOS and Windows OS. Two popular OSes, Linux-based (or GNU/Linux – as it should be – or Linux – as is popularly known) and Windows OS (or Microsoft Windows or Windows) are chosen and taken head-on to get the pros and cons, as well as to compare how easy/hard it is to perform administration Actions/Operations using commands in Terminal and Command Prompt for Linux and Windows respectively.

Note that Linux-based OSes are many, but are referred to as Linux as they are based on the same kernel, the Linux kernel and therefore follow a somewhat similar format of commands.

 

[LINUX]

Linux has become the most popular OS in Servers and Virtualization for system administrators, [with services offered by even Microsoft, the developer and maintainer of Windows OS, like Azure offering virtual Linux OSes]. Linux was developed by Linus Torvalds based on the UNIX kernel as an open source kernel (one of the reasons for its popularity), relying on open source software from non-contracted individuals to develop Linux-based OSes (otherwise called Linux Distributions/Distros). The other reason for its popularity is the fact that it takes up significantly less resources to run even resource-intensive tasks (processor, RAM (primary storage) and secondary storage).

[WINDOWS]

sudo usermod

Windows on the other hand has been in existence for a long time with the focus of its developers (Microsoft) being user friendliness. Microsoft capitalized on this and gained popularity for it, making it a user’s choice, especially for novice users. Windows OS is also available for Servers, and is preferred by some for its ease of use and also the availability of support by its users as well as its developers, Microsoft, who have a team dedicated to fix bugs, contrary to Linux that depends majorly on support by non-contracted individuals, with the exception of Linux-based OSes that are patented like Red Hat Enterprise Linux. These are among the reasons for Windows OS popularity.

 

COMMANDS IN TERMINAL && CMD

With the clarification on the popularity and competence existing between Linux and Windows, especially among system administrators, I intend to demonstrate how these OSes are different, but with the same goals – to effectively and efficiently manage systems – by narrowing down my scope to operations common with system administrators, managing user accounts.

On a frequent basis, system administrators are required to set-up, configure and manage user accounts for security reasons and tests. The following example shows basic operations on both Windows OS and Linux OS on user accounts. The operations, considering they are performed by experts (system administrators), are done on Command-Line Interfaces (CLI), similar to an extent but different, set to achieve the same goals.

 

The operations selected for demonstration include;

- creating/adding users
- setting passwords for the users
- changing password lifetime or expiry date
- changing user group (for permissions)
- deleting users 

For the operations, in Linux we will be using ‘Terminal‘ the Linux CLI while on Windows OS we will use ‘Command Prompt (CMD)‘, Windows CLI. For both OSes, you will need administrator or elevated privileges to perform the tasks successfully. For Linux, add the prefix ‘sudo‘ or use the ROOT user account while on Windows, search and click ‘Command Prompt‘ while holding down ‘Shift’ or use the ADMINISTRATOR account.

 

1. Creating/Adding Users

[Linux]

For Linux, to add a new user with the name “NewUser“, open Terminal and enter the following command;

sudo useradd NewUser

[Windows]

For Windows, to add a new user with the name “NewUser” open Command Prompt, and enter the following command;

net user NewUser /ADD

 

2. Creating User Password

By default for both OSes, if you create a user without specifying the password, the User still has a Password but its blank.

[Linux]

For Linux, to create a new password for the user “NewUser“, on Terminal, enter the command;

sudo passwd NewUser

This will prompt you to enter the new password. The password will not be displayed as you enter it.

[Windows]

For Windows, to create a new password for the user “NewUser“, on CMD, enter the command;

net user NewUser *

The asterisk (*) forces hiding the password as you enter it. However, by default, Windows displays the new password you are entering, like;

net user NewUser password

 

3. Changing the Expiry of the Password

[Linux]

For Linux, to change the expiry of a user’s password, on Terminal, enter the command;

sudo chage -M 30 NewUser

30” in the command  above is the “number days before the password expires“, after which a new must be set.

[Windows]

For Windows, to change the expiry of a user’s password, on CMD, enter the command;

net accounts /maxpwage:30

30” in the command  above is the “number days before the password expires“, after which a new must be set.

 

4. Adding a User to a Group

You might need to change a user’s Group to allow or deny them certain permissions or privilleges that are predefined within the User’s destination Group.

[Linux]

For Linux, to add a user to a group, on Terminal, enter the following command;

sudo usermod -G sudo NewUser

[Windows]

For Windows, to add a user to a group, on CMD, enter the following command;

net localgroup administrators NewUser /ADD

 

5. Deleting Users

To do away with a user, instead of disabling it you could permanently delete the user.

[Linux]

For Linux, to delete a user with the name “NewUser“, on Terminal enter the following command;

sudo userdel NewUser

[Windows]

For Windows, to delete a user with the name “NewUser“, on Command Prompt enter the following command;

net user NewUser /DELETE

 

Linux vs.Windows 101, including Commands in Terminal vs. CMD
Wiki | thetqweb