Working with the command line

Working with the command line

Working with the command line

The command line is a powerful way to interact with the operating system and programs. It’s also a great way to automate the launching of commands. In this article, we’ll look at the basic principles of working with the command line when working with the Valentina pattern making program.

This article is intended for beginners, but will not cover all possible details. Some aspects of the command line are already perfectly described elsewhere, so our goal is to introduce this way of interacting with the program and show examples of practical use.


The command line was the first human-developed interface for interacting with a computer. It allows by entering commands through a terminal to pass commands to the operating system and various programs. This type of interaction is widespread today, and requires a certain level of skill, and therefore not deservedly bypassed by inexperienced users, who prefer to work with a mouse and a graphical interface.

In modern systems the command line is accessed through special programs terminals. They look like a window with a black or white background and a line inviting you to enter a command.

Depending on the operating system, the calling of the command line window will be different.

Methods for Windows:

  • Through the Start menu - All Programs - Standard - Command Prompt.
  • From the Start menu - Run - type cmd.exe.
  • Shortcut keys Win + R - enter cmd.

For operating systems of the Linux family this is usually:

  • Shortcut keys Ctrl + Alt + T.
  • Shortcut keys Alt + F2 and start a terminal program. For example gnome-terminal if you use Gnome. Or konsole if you use KDE.
  • Launch from the system menu. You need to find a program called Terminal.

For Mac OS X operating system:

  • Find the Terminal program through the program list. It is located in the Utilities folder.
  • Through Launchpad. To do this, just open Launchpad from the Dock or the key combination Fn + F4 . In the Others folder, find the Terminal program.

The list is not complete, you can find more ways to run the terminal in the documentation of your operating system.

Let’s start with some command line basics. There are differences in the way different operating systems work, but they are not so great.

Since the terminal is a universal way to interact with your computer, it is subject to the same laws as your normal mode of interaction. We are talking in this case about user rights. During normal startup terminal will work with rights of user who called it. This must be considered if you need access to commands and directories available only to administrators.

After starting the terminal you will see a line of commands. Depending on the type of operating system, you will be given information about the current directory, as well as the computer name and type of user rights.

The first thing to look at is the location of the current directory. When you start the terminal, the system will set the default values by itself. You can check the current path with the command pwd for Unix systems, or cd for Windows. Knowing the current directory is very important, as it affects the command to start the program.

You need to understand how the file path works in order to work correctly with commands. There is a difference in approaches to using the directory separator in names. In Windows it is ‘', in Unix it is ‘/’.

Unix: /home/user/docs/Letter.txt.

There are two types of paths: absolute and relative. An absolute or full file path contains the full address where the file is located. It includes the names of the disks and directories where the file is located, as well as the name of the file with an extension. The above examples are exactly that.

A relative path contains only part of the path. The other part is calculated relative to the current directory. For example, if we are in the documents directory, then to go to the images directory we first need to go to the level above and then go to the images directory.

Unix: ../picture/image.jpg.

You need to use two dots to go up a level, to point to the current directory one dot.

To run commands you need to know the name of the program’s executable file. On Unix systems the name valentina is enough, while on Windows you should additionally specify the extension .exe, i.e. valentina.exe. Operating systems know how to search for a program by its name. However, to do so, you will need to have the PATH system variable properly configured. Setting up this variable is beyond the scope of this post, and you will have to consult your operating system’s documentation. We will focus on the option of passing the full path to the Valentina file. In our case it is C:\ Program Files\Valentina\valentina.exe. Note that the path contains a space, so it should be passed in quotes "C:\Program Files\Valentina\valentina.exe".

Now we have to put what we have learned into practice and see how we can interact with Valentina using the command line.

Simple Startup

To get started, we need to start with something simple and to do this, we will just try running Valentina to make sure that everything runs properly. In the terminal, we type the command

"C:\Program Files\Valentina\valentina.exe"

If there are no errors, Valentina should start.

Next, we’ll make it more complicated and try to open the pattern file stored on the desktop.

"C:\Program Files\Valentina\valentina.exe" C:\Users\dismine\Desktop\pattern.val

This command launches Valentina with the pattern file already open.

Next, let’s try to enter a help command, which will help us know the list of possible keys and their meaning

"C:\Program Files\Valentina\valentina.exe" --help

If you don’t speak English then you are advised to consult our user guide. There you can find a translation of the help.

Practical application

Because it’s not the goal of this article to go through all the keys and their explanations in detail, we will restrict ourselves to practical examples only.

In order to export a tile layout in PDF format, you need to run the command:

"C:\Program Files\Valentina\valentina.exe" --basename test --destination C:\Users\dismine\Desktop\export --format 33 --mfile C:\Users\dismine\Desktop\pattern.vit

To be able to work with the command line successfully, you need to be able to read and understand the meaning of the commands that are run. So we will take a closer look at this example.

  • --basename - sets the base of the export file name. Since there can be several sheets, a suffix with the page number and format extension will be added to the name base. In our case it is test_1.pdf.
  • --destination - specifies the path to the directory where the exported layout should be saved.
  • ---format - using a numeric value sets the export format. Numerical values for other formats can be found in the help.
  • --mfile - sets a different path to the measure file than the one set in the pattern file. This key is very useful if you have several measurements files that you want to apply to the pattern and get a layout for them.

When exporting, we recommend not to ignore the warnings, because in most cases they signal problems in the calculation. We therefore advise to run the export operation together with the --pedantic key.

"C:\Program Files\Valentina\valentina.exe" --basename test --destination C:\Users\dismine\Desktop\export --format 33 --mfile C:\Users\dismine\Desktop\pattern.vit --pedantic

  • --pedantic tells the program not to ignore warnings, but to stop working with an error message.

For exporting patterns without generating a layout, the command will look slightly different:

"C:\Program Files\Valentina\valentina.exe" --basename test --destination C:\Users\dismine\Desktop\export --format 18 --mfile C:\Users\dismine\Desktop\pattern.vit -exportOnlyDetails --pedantic --exportSuchDetails .

  • --exportOnlyDetails - indicates that you want to export the details without creating a layout
  • --exportSuchDetails - sets the regular expression by which the parts will be selected by name.

In addition to exporting the layout, it is also possible to export the final measurements.

"C:\Program Files\Valentina\valentina.exe" --basename test --destination C:\Users\dismine\Desktop\export --format 33 --mfile C:\Users\dismine\Desktop\pattern.vit --pedantic --csvExportFM C:\Users\dismine\ Desktop\export\test.csv

We’ve looked at some basic examples of command line applications. What other uses would you like to see? Leave your feedback in the comments.

Areas of usage.


We’ve already been introduced to practical use cases, but it’s quite possible that this is the first time you’ve encountered this way of interacting with a program. And you still don’t know what it’s for. The practical examples already give you a clue. In Valentina’s case, the main goal is automation. Yes, you may notice that you have to remember a bunch of stuff to make a pattern export, and that it’s not much easier to work with the GUI, but first we need to understand what we mean by automation.


Automation is a process that performs a sequence of operations without the need for human interaction. That is, the process is set up once and requires no more human intervention. That’s the ideal. Valentina itself and its parametric patterns are a perfect example of such automation. By describing a pattern using one size as an example, we can get another size simply by changing the data. Since we now have such a great base, we can also automate the process of starting and transferring the input data.


When should you start thinking about automation? Practice shows that automation is not free and only pays off when applied to high amounts. The chart above shows the time-to-cost relationship between manual and automated workflows. As you can see, in the beginning the costs are about equal. Very often in practice this means that there is no automation, but both processes are performed manually. But when the amount increases, the understanding of the need to organize the technological process comes. The costs at this stage may increase, and the amount of work done may even decrease - it takes time to create the operating process. However, it pays off later on. The same level of processing with manual labor is achieved at a much higher cost.

A real example would be websites, where you can set up automatic generation of layout through a command line run, as we have shown above. And since this is not some unique Valentina feature, you can think of many other operations before and after it. For example, you could pass the pieces to another program and use it to create the nesting, and then send the result to the factory or the customer.

Let’s return for a moment to the example with the website and try to imagine what can be a manual version of the processing of orders. You need to find a pattern, a file of measurements, and open the program. Run the creation of nesting with the right parameters, wait for completion, and then export with the correct parameters. And then send the result to the customer. At this, you can not make a mistake. Already this is enough to make the process long. This will work somehow in small quantities, but if the amount increases, it will quickly stop working. Unlike a human being, a machine doesn’t make mistakes and doesn’t require sleep.

So in the case of Valentina, this interface is not designed for constant human use. Moreover, it is not designed to create patterns in this way. There is no need to learn the meanings of all the commands, it is enough to use the instruction manual that we created. However, this is a very important aspect of professional use. Automation is the logical stage of development for anyone who is into parametric patterns. Therefore, it is worth knowing how to read and compose such commands, because you may need this knowledge in the future. We hope then this article will be useful to you.


No comments yet.

Post your comment