Implementing and Using a Microsoft Windows Like ‘start’ Command in Linux – CloudSavvy IT


    Bash Shell

    If you’re used to the convenient ‘start’ command at the command prompt in Microsoft Windows, you’re likely to be a little disappointed not having the same functionality in Linux. But it need not be!

    What Is start?

    If you have used Microsoft Windows for a long time, you likely have found some shortcuts which simplify your work. One such super-handy shortcut is to use the start command at the Command Prompt in Windows.

    A Microsoft Windows command prompt employing the use of the start command

    Start is extremely versatile. You can type start . to open a directory browser window right at the location where you are in the command prompt (the current directory). You can also just type start notepad, and it will open the notepad application for you, and so on. You can even do things like start mypdf.pdf, and it will open your default-type-assigned application for opening PDF files! Handy.

    Then you move to Linux and expect the same great functionality to be there. But not so:

    The start command by default is not available in Linux

    Start is not a default command in Linux. Still, Linux, much more so than Microsoft Windows, allows us to tweak our systems just the way we like them, even to near-infinity. Linux offers control where Microsoft does not. So, let’s implement our own start.

    Re-implementing start on Linux!

    Re-implementing start on Linux is easier then you think. Here are two methods. The first one is likely to work more universally on various Linux distributions, whereas the second is more Linux Mint and Ubuntu focused.

    The first one uses the xdg-open. Two commands are needed to re-implement start:

    sudo apt install xdg-utils
    echo "alias start='xdg-open'" >> ~/.bashrc 
    

    Note: if you use Fedora, RedHat, or Centos instead of a Debian-based distribution, you may use sudo yum install xdg-utils instead of the first line.

    The first command will install the xdg-utils package, enabling us to use the command xdg-open. It is likely that xdg-utils is already installed on your system, and trying to do so again will not damage the operating system in any way.

    The second command adds an alias to our personal Bash startup script (the hidden file ~/.bashrc) in which xdg-open is called whenever start is executed at the command line. Note one could also type xdg-open, but I much prefer the shorter and more familiar start.

    After making these changes, exit your shell and re-open it. You should now be able to use start in – for all intents and purposes – the same manner as you would in Microsoft Windows:

    The start command re-implemented in Linux

    There may be some minor differences in operation; for example, if you execute a command like start text.txt where such a file exists, a file manager with that file highlighted (requiring an additional double click) may open instead of opening the assigned application.

    There are minor differences between xdg-utils and exo-utils (described below) in this way, and it depends on your underlying desktop window manager and it’s file type association settings also.

    Test what works best for you, and set correct file type associations in your operating system to maximize the minor differences. You can do so by right-clicking a file and selecting options alike to Open With > Other Application > selecting an application and making it default. There may also be a file type configuration screen available in your Linux Distribution.

    Note that the first time you run commands this way you may be presented with a dialog similar to the following:

    Selecting a preferred file manager application dialog

    In it, simply select your favorite file manager. For more information on how to do this and what sort of options are available here, you may like to review our article Swapping File Managers in Mint 20

    If somehow you ran into issues, or you are using Linux Mint or Ubuntu and would like to try another possible solution, you can try this alternative solution which uses exo-utils, a package originally attached to the xcfe desktop window manager, but also usable on, or in conjunction with, other windows managers!

    For our second solution, two commands are needed to re-implement start:

    sudo apt-get install exo-utils
    echo "alias start='exo-open --launch FileManager'" >> ~/.bashrc 
    

    The first command installs the exo-utils, in a similar fashion to our install of xdg-utils. The second command will add the line alias start='exo-open --launch FileManager' to ~/.bashrc again in a similar fashion as our first solution. The command required here is slightly more complex, but things work in exactly the same way.

    Wrapping up

    Having start available in Linux, especially when you tend to use the terminal command line a lot, makes the blend between the text-based terminal and the desktop windows manager definitively better.

    Once you use the solution for a while, different ways of using it will become more apparent, and your computer use efficiency and operator skills will significantly improve.

    Enjoy!



    Source link

    Previous articleArtStation acquired by Epic Games; commission rates cut
    Next articleIntel doling out $3.5 billion for New Mexico fab upgrade, among other big spends