Using Linux After Windows Is Easier If You Know These 6 Key Differences


Key Takeaways

  • The differences between the Linux and Windows command lines can make the transition to Linux difficult for new users.
  • For example, Linux is case-insensitive, it more or less ignores file extensions, and it uses a different character than Windows uses as its directory path separator.
  • The best way to become comfortable with the Linux command line is by learning the commands.



Starting out with any new operating system can be frustrating, because the simplest operations don’t work in the way you’re used to. Learning these differences between Windows and Linux can cure headaches.

That fish out of water feeling is awful, when the most basic operations throw you for a loop. It’s natural to worry that everything else is going to be a struggle too. Getting nowhere fast leads to people giving up entirely. When dabbling in the shallows is so discouraging, the idea of taking the plunge becomes unappealing.

As is often the case, it’s the little things that matter most. So here’s our list of little things that have a big impact on your first few days as a Windows user exploring the Linux command line.


1 Case Sensitivity

On Linux, file and directory names are case-sensitive. On Windows they’re not.


Linux lets you have files in the same directory that are called the same thing, as long as they’re written differently.

Let’s create a few files to illustrate this. If you read these filenames out loud they all sound the same. But, because they use a different mix of characters, on Linux they’re actually different names.

touch unique-file.txt
touch Unique-file.txt
touch Unique-File.txt
touch UNIQUE-file.txt

ls

Files on Linux with names that differ by case only

The touch command creates the files and ls confirms they happily reside in the same directory. On Windows, file.txt and FILE.TXT refer to the same file.

The case sensitivity of Linux applies to directory names, too.

mkdir sub1
mkdir Sub1
mkdir SUB1

ls -l

Directories on Linux with names that differ by case only


All of these subdirectories exist within the same parent directory.

2 Paths and Directories Separators

Windows uses a backslash \ as the directory path separator, but Linux uses /, the forward slash. You’re going to need to concentrate to overcome the muscle memory of typing \.

pwd 
A directory path displayed in a Linux terminal window.

\ dates back to the release of MS-DOS in 1981, but / was born in 1971 with the first version of Unix. If MS-DOS had used / as well, this issue wouldn’t exist.

3 File Extensions

On Windows, file extensions tell the operating system which application to launch when you double-click a file. On Linux, the operating system determines the file type by examining its header bytes.

You can do this yourself using the file command.


file mystery-file 
Using the Linux file command to identify a file type.

File extensions on Linux tell you, the user, what type of file something is. Linux already knows.

Nor do you need to use a specific extension on binary executable files. There’s no Linux equivalent to the COM and EXE extensions of the Windows world. A Linux executable can have any extension, or no extension.

do-some-work
and-you.too
Running commands with and without extensions in a Linux terminal window.


4 Hidden Files and Directories

On Linux, if a file or directory has a period ‘.’ as the first character of its name, it’ll be hidden. To hide a file on Windows, you right-click the file, click Properties, click the Hidden checkbox so that it is selected, then click OK.

Adding the -a (all) option to the ls command lists includes hidden files and directories in the listing.

touch new-file.txt 
touch .new-hidden-file.txt
ls
ls -a
Using the Linux touch command to create a regular and a hidden file in a terminasl window.

Most file browsers, such as GNOME’s Files, support toggling back and forth between showing and hiding your hidden files, by hitting Ctrl+H. In the Windows 11 file explorer, from the toolbar select View > Show > Hidden Items to do the same thing.

In GNOME Files, without showing hidden files, we see a single file.


One file visible in GNOME Files, with a hidden file present but not displayed.

Hitting Ctrl+H reveals the hidden file.

A regular and a hidden file displayed in GNOME Files, because the user has pressed Ctrl+H.

5 Command Differences

Terminal commands are very different on Linux from their Windows counterparts, and often come with short names. The ultimate has to be a single period. On Linux, ‘.’ tells the shell to source or read a file.

Some Linux command names are at least suggestive of their use, like cp for copy and mv for move. Others are more opaque. Windows users are familiar with using dir at the command prompt to list files and directories, while Linux users type ls, which is short for list.


Windows PowerShell users might use cat to list files, but cat on Linux concatenates files or dumps their contents to the terminal window, in an action similar to the Windows type command. The Linux type command describes commands and parameters, but not in the way a user guide might. For that, you use the man command, short for manual.

To change directories, you use cd on both platforms, but on Linux you don’t have drive identifiers. Everything, including mounted drives, is just a directory branch off the root / directory.

To distinguish command options from parameters, Linux uses – or — but Windows uses /.

Another difference is that typically, Linux commands are silent on success. Adopting the “no news is good news” stance, you’ll only see output if something goes wrong. If you’re not alerted to an issue, assume what you just did worked.


rm unwanted-file.txt 
Using the Linux rm command to remove a file in a terminal window

The file is removed, silently. Also, there’s no Recycle Bin with rm. Your file’s gone. Period.

We shouldn’t be surprised at these differences. Different platforms are bound to have different command sets. Our only answer is to embrace the change, and learn the commands.

6 Use sudo Instead of Run as Administrator

Window users might be familiar with the Run as Administrator option found in an executable’s right-click context menu. This runs the program with elevated permissions.

The equivalent on Linux is the sudo command. Preceding a command with sudo runs that command with elevated permissions. Only users who are specifically granted permission are able to invoke superuser mode.


If we try to add a user with sudo, we’re refused. But if we’re in the sudoers list and we precede the command with sudo, Linux allows us to add the user.

Linux refusing to add a user until the sudo command is used.


There’s a learning curve associated with moving to any new operating system, and whichever way you slice it, you’ve got to climb that curve. But if you don’t get the basics sorted out, you’ll never make it up that slope.



Source link

Previous articleWhy these libertarian economists oppose Trump’s Bitcoin ‘stockpile’ idea – DL News