Jump to content
  • Using Linux After Windows Is Easier If You Know These 6 Key Differences

    aum

    • 350 views
    • 7 minutes
     Share


    • 350 views
    • 7 minutes

    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.

     

    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.

     

    touchunique-file.txt

     

    touchUnique-file.txt

     

    touchUnique-File.txt

     

    touchUNIQUE-file.txt

     

    ls

     

    AA1oe5h0.img?w=534&h=216&m=6

    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

     

    AA1odRCX.img?w=534&h=269&m=6

    Directories on Linux with names that differ by case only

     

    All of these subdirectories exist within the same parent directory.


    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

     

    AA1oe5h3.img?w=534&h=127&m=6

    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.


    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

     

    AA1oe5h8.img?w=534&h=127&m=6

    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

     

    AA1oe31V.img?w=534&h=152&m=6

    Running commands with and without extensions in a Linux terminal window.

     

    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

     

    AA1odYwJ.img?w=534&h=178&m=6

    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.

     

    AA1oe0LO.img?w=534&h=159&m=6

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

     

    Hitting Ctrl+H reveals the hidden file.

     

    AA1oe0LP.img?w=534&h=159&m=6

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

     

    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.


    rmunwanted-file.txt

     

    AA1odRD2.img?w=534&h=102&m=6

    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.


    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.

     

    AA1odW2l.img?w=534&h=375&m=6

    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


    User Feedback

    Recommended Comments

    There are no comments to display.



    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...