These are some basic Linux commands and techniques for new to Linux users. More complete information can be found on the web or by using the man pages.

1. Automatic Login

1.1. Debian

Debian Stretch uses the Xfce desktop environment by default, with the lightDM display manager lightDM. To get automatic login with Stretch:

  • In a terminal, use the command:

$ /usr/sbin/lightdm --show-config
  • Make a note of the absolute path to the configuration file lightdm.conf.

  • Edit that file with a pure text editor (gedit, nano, etc), as root.

  • Find and uncomment the lines:

#autologin-user=
#autologin-user-timeout=0
  • Set autologin-user=your_user_name

  • Save and reboot.

1.2. Ubuntu

When you install LinuxCNC with the Ubuntu LiveCD the default is to have to log in each time you turn the computer on. To enable automatic login go to System > Administration > Login Window. If it is a fresh install the Login Window might take a second or three to pop up. You will have to have your password that you used for the install to gain access to the Login Window Preferences window. In the Security tab check off Enable Automatic Login and pick a user name from the list (that would be you).

2. Automatic Startup

To have LinuxCNC start automatically with your config after turning on the computer go to System > Preferences > Sessions > Startup Applications, click Add. Browse to your config and select the .ini file. When the file picker dialog closes, add linuxcnc and a space in front of the path to your .ini file.

Example:

linuxcnc /home/mill/linuxcnc/config/mill/mill.ini

В документации соответствующий файл .ini называется INI-файлом.

3. Терминал

Многое требуется сделать из терминала, например, проверить буфер сообщений ядра с помощью dmesg. В Ubuntu и Linux Mint есть сочетание клавиш Ctrl
Alt + t. В Debian Stretch не определены сочетания клавиш. Его можно легко создать с помощью «Диспетчера конфигураций». Большинство современных файловых менеджеров поддерживают правую клавишу для открытия терминала, просто убедитесь, что вы щелкаете правой кнопкой мыши по пустой области или каталогу, а не по имени файла. Большинство ОС имеют терминал в качестве пункта меню, обычно в разделе Аксессуары.

4. Man Pages

Справочная страница "man page" (сокращение от manual page) — это форма документации по программному обеспечению, обычно встречающаяся в Unix или Unix-подобных операционных системах, таких как Linux.

Чтобы просмотреть справочную страницу, откройте терминал, чтобы узнать что-нибудь о команде find в окне терминала напечатайте:

man find

Используйте клавиши Page Up и Page Down для просмотра справочной страницы и клавишу Q для выхода из просмотра.

Note
Viewing the man page from the terminal may not get the expected man page. For example if you type in man abs you will get the C abs not the LinuxCNC abs. It is best to view the LinuxCNC man pages in the HTML documents.

5. List Modules

Sometimes when troubleshooting you need to get a list of modules that are loaded. In a terminal window type:

lsmod

If you want to send the output from lsmod to a text file in a terminal window type:

lsmod > mymod.txt

The resulting text file will be located in the home directory if you did not change directories when you opened up the terminal window and it will be named mymod.txt or what ever you named it.

6. Editing a Root File

When you open the file browser and you see the owner of the file is root you must do extra steps to edit that file. Editing some root files can have bad results. Be careful when editing root files. Generally, you can open and view most root files, but they will open in read only mode.

6.1. The Command Line Way

Open a terminal and type

sudo gedit

Open the file with File > Open > Edit

6.2. The GUI Way

  1. Right click on the desktop and select Create Launcher

  2. Type a name in like sudo edit

  3. Type gksudo "gnome-open %u" as the command and save the launcher to your desktop

  4. Drag a file onto your launcher to open and edit

6.3. Root Access

In Ubuntu you can become root by typing in "sudo -i" in a terminal window then typing in your password. Be careful, because you can really foul things up as root if you don’t know what you’re doing.

7. Terminal Commands

7.1. Working Directory

To find out the path to the present working directory in the terminal window type:

pwd

7.2. Changing Directories

To change the working directory to the one one level up, i.e., the parent directory, in the terminal window type:

cd ..

To move up two levels in the terminal window type:

cd ../..

To move directly to your home directory, in the terrminal window use the cd command with no arguments:

cd

To move down to the linuxcnc/configs subdirectory in the terminal window type:

cd linuxcnc/configs

7.3. Listing files in a directory

To view a list of all the files and subdirectories in the terminal window type:

dir

or

ls

7.4. Finding a File

The find command can be a bit confusing to a new Linux user. The basic syntax is:

find starting-directory parameters actions

For example to find all the .ini files in your linuxcnc directory you first need to use the pwd command to find out the directory.

Open a new terminal window and type:

pwd

And pwd might return the following result:

/home/joe

With this information put the command together like this:

find /home/joe/linuxcnc -name \*.ini -print

The -name is the name of the file your looking for and the -print tells it to print out the result to the terminal window. The \*.ini tells find to return all files that have the .ini extension. The backslash is needed to escape the shell meta-characters. See the find man page for more information on find.

7.5. Searching for Text

grep -irl 'text to search for' *

This will find all the files that contain the text to search for in the current directory and all the subdirectories below it, while ignoring the case. The -i is for ignore case and the -r is for recursive (include all subdirectories in the search). The -l option will return a list of the file names, if you leave the -l off you will also get the text where each occurrence of the "text to search for" is found. The * is a wild card for search all files. See the grep man page for more information.

7.6. Diagnostic Messages

To view the diagnostic messages use "dmesg" from the command window. To save the diagnostic messages to a file use the redirection operator >, like this:

dmesg > bootmsg.txt

The contents of this file can be copied and pasted on line to share with people trying to help you diagnose your problem.

To clear the message buffer type this:

sudo dmesg -c

Это может быть полезно сделать непосредственно перед запуском LinuxCNC, чтобы была только запись информации, связанной с текущим запуском LinuxCNC.

Чтобы найти адрес встроенного параллельного порта, используйте grep для фильтрации информации из dmesg.

After boot up open a terminal and type:

dmesg|grep parport

8. Convenience Items

8.1. Terminal Launcher

If you want to add a terminal launcher to the panel bar on top of the screen you typically can right click on the panel at the top of the screen and select "Add to Panel". Select Custom Application Launcher and Add. Give it a name and put gnome-terminal in the command box.

9. Hardware Problems

9.1. Hardware Info

To find out what hardware is connected to your motherboard in a terminal window type:

lspci -v

9.2. Разрешение монитора

Во время установки Ubuntu пытается определить настройки монитора. Если это не сработает, у вас останется обычный монитор с максимальным разрешением 800x600.

Инструкции по устранению этого находятся здесь:

10. Пути

Относительные пути

Относительные пути базируются на каталоге запуска, который является каталогом, содержащим INI-файл. Использование относительных путей может облегчить перемещение конфигураций, но требует хорошего понимания спецификаторов пути Linux.

./f0 совпадает с f0, например, файл с именем f0 в каталоге запуска
../f1 ссылается на файл f1 в родительском каталоге
../../f2 ссылается на файл f2 в родительском каталоге
../../../f3 и т.д.