Some Wine commands for beginners (run Windows applications on Linux, BSD and Mac)

in #linux7 years ago

Originally posted on my Blog:
manerosss.wordpress.com

Hi!

I wrote a more detailed post on how to use Wine a few months ago.
Here is a stripped down version to help you using the software in a more “learn by doing” way.



Here I’m assuming that

  • you know how to open a terminal
  • you know how to scroll previous commands (by pressing the up and down keys inside the terminal)
  • you’re using a 64-bit system
  • you’re in your home folder
  • you know that by pressing the TAB key you autocomplete your paths (you don’t type Downloads but type Dow and then press TAB)


Wineprefix varable:

WINEPREFIX=~/newprefix

This is how you create and then use a dedicated prefix, without this variable the default prefix .wine will be created/used (you’ll find it in your home folder).

To install/run an application with the default prefix:

wine Downloads/SteamSetup.exe

To run an application in a non-default prefix:

WINEPREFIX=~/steam-windoze wine Downloads/SteamSetup.exe

You can also put your prefixes wherever you wish, I usually create a dedicated sub-directory in my home directory (~/):

mkdir ~/.wineprefix
WINEPREFIX=~/.wineprefix/steam-windoze wine Downloads/SteamSetup.exe

If you used PlayOnLinux you’ll find all its prefixes in (the . indicates an hidden file/folder):

~/.PlayOnLinux/wineprefix/

The variable to create a 32-bit prefix:

WINEARCH=win32

To create the default 32-bit .wine prefix and install/run an application inside it (this won’t work if you previously created it as 64-bit):

WINEARCH=win32 wine Downloads/SteamSetup.exe

The variables needed to create a non-default 32-bit prefix:

WINEARCH=win32 WINEPREFIX=~/new32prefix

To create and install an application in a specific 32-bit prefix:

WINEARCH=win32 WINEPREFIX=~/new32prefix wine Downloads/SteamSetup.exe

The application is going to be installed somewhere in:

.wine/drive_c/
or
newprefix/drive_c/

there you can see if the prefix is 32-bit or 64-bit:

32-bit prefix has

.wine/drive_c/Program Files/

64-bit prefix has:

.wine/drive_c/Program Files (x86)/
and
.wine/drive_c/Program Files/

Almost every applications will prompt you to be installed somewhere in:

.wine/drive_c/Program Files (x86)/Application
or
.wine/drive_c/Program Files/Application

I prefer to install the straight in the C directory to then have less stuff to type in the command line:

.wine/drive_c/Application
or
.wine/drive_c/Application

Once the 32-bit prefix is created you don’t need the WINEARCH variable anymore;

create a 32-bit prefix and install/run and application:

WINEARCH=win32 WINEPREFIX=~/.games wine Downloads/game1installer.exe

Then to run the application:

WINEPREFIX=~/.games wine .games/drive_c/game1/game1.exe

Same story if you need to run/install other applications in that prefix:

WINEPREFIX=~/.games wine Downloads/game2installer.exe
or
WINEPREFIX=~/.games wine .games/drive_c/game2/game2.exe

You can’t switch from 32 to 64-bit, to do so you’ll need to create a new prefix;

for example if you installed a 64-bit game in a 32-bit prefix and it gives you an error:

WINEPREFIX=~/.game32bit wine .game32bit/drive_c/game/game.exe

you can create a 64-bit and run the game using that prefix:

WINEPREFIX=~/.game64bit wine .game32bit/drive_c/game/game.exe

at this point you can also move the game folder to the newly created 64-bit prefix:

mv .game32bit/drive_c/game .game64bit/drive_c/

and then remove the unneeded 32-bit prefix:

rm -rf .game32bit

you can also use you graphical File Manager to remove the prefix (it acts like a normal folder).



To change settings in a prefix winecfg is used:

winecfg

in a non-default prefix:

WINEPREFIX=~/newprefix winecfg

you can also launch it like this to avoid re-type a command:

WINEPREFIX=~/.games winecfg .games/drive_c/game1/game1.exe

There you’ll find some helpful options such as

  • emulate a virtual desktop with a specific resolution to avoid your native resolution to be messed up
  • enable or disable CSMT (Wine Staging main feature) or Gallium Nine
  • change Windows Version (you then need to relaunch the application), also for just a specific application inside the prefix
  • override libraries
  • manage audio devices
  • manage drives (floppy, cd, etc.)
  • manage specific applications
  • and more…



Some applications may need an external library to be installed, to simplify this process there is a software called winetricks

you launch winetricks like this:

winetricks

or in a non-default prefix:

WINEPREFIX=~/newprefix winetricks

Then use the interface to do what you need to do, in most cases you’ll need to:

  • select Select the default wineprefix
  • select Install a Windows DLL or component
  • and select one or more libraries to be installed (i.e. d3dx9, cmd, dotnet40, etc.).

you can also use it straight from the command line without launching any GUI:

winetricks dlls list

then install what you need

winetricks d3dx9 cmd dotnet40
or
winetricks -q d3dx9 cmd dotnet40

I always use the -q (unattended) to automatically install libraries without having to deal with GUIs, questions to accept, etc.

Winetricks has also a few benchmarks, software and games ready to be installed, you can select them from the GUI or through the command line:

winetricks --help
winetricks list
winetricks benchmark list
winetricks games list
winetricks apps list

It could happen that an application won’t close properly (wassup Steam?), if so you can kill all the processes with a software like htop or better by using the wineserver to kill them all with a command:

wineserver -k

But don’t forget to direct it to the prefix where your applications are running:

WINEPREFIX=~/newprefix wineserver -k



Now I’m going to show how to install Steam and some easy tricks to install a game:

Download the windoze installer here:

  • https://steamcdn-a.akamaihd.net/client/installer/SteamSetup.exe

or run:

wget https://steamcdn-a.akamaihd.net/client/installer/SteamSetup.exe

Then launch the installer, I’m using a new 32-bit prefix here:

WINEARCH=win32 WINEPREFIX=~/.steam-win wine SteamSetup.exe

Follow the installer instructions and then you’ll be able to launch the client this way:

WINEPREFIX=~/.steam-win wine .steam-win/drive_c/Steam/Steam.exe

Now you’re able to browse your library and install a game
Alternatively you can use this option to launch a game installer if you know the game’s APPID (for example 35450 for Red Orchestra 2):

WINEPREFIX=~/.red_orchestra_2 wine .steam-win/drive_c/Steam/Steam.exe -appid 35450

Notice that I changed the prefix, if you do so be sure to install the game under a new Steamlibrary in that prefix (C/…) and not in the one where steam is installed (Z/…)

In Wine C is the prefix main drive while Z is something external from it.

That command is also used to run a game once installed:

WINEPREFIX=~/.red_orchestra_2 wine .steam-win/drive_c/Steam/Steam.exe -appid 35450

So at the end using wine is not difficult at all, once you understand how it works you will be able to save yourself a lot of time and concentrate all that you need to do in few commands and even create your own shortcuts and scripts ;)



TA SALÜDE

Sort:  

that tutorial helped me a lot I searched on it but the videos were so complicated that I gave up but this post is clear and useful I like it ;)

Glad to hear that :)

I don't want to sound like a smartass, but you can run Steam natively on Linux. No need for Wine. ;)

Although only a fraction of the Steam games run on Linux natively, so your guide is very useful.

Oh you don't say! ;)

Wine doesn't work all too well most of the time, and it can be alot of work to configure it. I just use Lutris, Steam, And playonlinux... chances are if the game doesn't run on any of them (since Lutris and playonlinux use wine) then its probably not going to work at all.

I've got almost 250 videos showing games running fine on Linux using Wine.
Plus hundreds other showings various tests ,bugs, DX10/11, etc. and many blog and video guides on how to use Wine.
Apparently Wine works fine for me... I can also tell you that it's easier to use than PlayOnLinux as I was first using it as the terminal frightened me at that time.
I never ever blamed Wine for not working and always pointed the finger at myself for not knowing enough.
Blame yourself if you can't get Wine to work, NOT Wine!
Lutris and PoL are graphical interfaces for Wine, there's nothing that you can't achieve from the command line (as said it's even easier once you know how to use it).

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 65306.74
ETH 3488.89
USDT 1.00
SBD 2.51