قالب وردپرس درنا توس
Home / Tips and Tricks / Implementing and using a Microsoft Windows-like ‘start’ command in Linux – CloudSavvy IT

Implementing and using a Microsoft Windows-like ‘start’ command in Linux – CloudSavvy IT



Bash Shell

If you’re used to the handy ‘start’ command at the command prompt in Microsoft Windows, you’re probably a little disappointed that you don’t have the same functionality in Linux. But it doesn’t have to be!

What̵
7;s get started?

If you have been using Microsoft Windows for a long time, you have probably found some shortcuts that simplify your work. One of those super handy shortcuts is to download the get started command at the command prompt in Windows.

A Microsoft Windows command prompt that uses the start command

Start is extremely versatile. You can type start . to open a directory browser window in 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! Useful.

Then you go to Linux and expect the same great functionality to be there. But not like this:

The start command is not available in Linux by default

Start is not a standard command in Linux. Still, much more than Microsoft Windows, Linux allows us to customize our systems the way we want them, even almost infinitely. Linux provides control where Microsoft does not. So let’s implement our own start.

Deploy again get started on Linux!

Deploy again get started on Linux is easier than you think. Here are two methods. The first will likely work more universally on different Linux distributions, while the second is more focused on Linux Mint and Ubuntu.

The first uses the xdg-open. Two commands are required to redeploy start:

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

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

The first command installs it xdg-utils package, which allows us to use the command xdg-open. It is quite possible that xdg-utils is already installed on your system and trying this again will not damage the operating system in any way.

The second command adds an alias to our personal Bash boot script (the hidden file ~/.bashrc) in which xdg-open always receives a call start is executed on the command line. Note that one can also type xdg-open, but I prefer the shorter and more famous start.

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

Redeployed the start command in Linux

There may be some minor differences in operation; for example, if you run a command such as start text.txt where such a file exists, a file manager with that file marked (requiring an additional double click) can 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 also the file type association settings.

Test what works best for you and set the correct file type associations in your operating system to maximize the minor differences. You can do this by right-clicking a file and selecting options similar to Open with> Other application> select an application and make it the default. A file type control panel may also be available in your Linux distribution.

Note that the first time you run commands this way, you may see a dialog similar to the following:

Select a preference dialog for file management

Simply select your favorite file manager in it. For more information on how to do this and what options are available here, read our article Switching File Managers in Mint 20.

If you have run into issues somehow, or if you are using Linux Mint or Ubuntu and want to try some other possible solution, you can try this alternative solution which uses exo-utils, a package originally attached to it xcfe desktop window manager, but also usable on or in combination with other windows managers!

Our second solution requires two commands to redeploy start:

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

The first command installs it exo-utils, in the same way as our installation of xdg-utils. The second command will add the line alias start="exo-open --launch FileManager" to ~/.bashrc again in the same way as our first solution. The command required here is a bit more complicated, but things work exactly the same way.

Shut down

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

If you use the solution for a while, different ways of use will become more apparent and your computing efficiency and operating skills will improve significantly.

To enjoy!


Source link