summaryrefslogtreecommitdiff
path: root/docs/src/common/Linux_FAQ.txt
blob: 3bddc3f56356109164dda4933e7d1b3fc28312a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
= Linux FAQ 

[[cha:linux-faq]] (((Linux FAQ)))

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.

== Automatic Login (((Automatic Login)))

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).

== Automatic Startup (((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 emc and a space in front of the path to your
.ini file.

Example:

----
emc /home/mill/emc2/config/mill/mill.ini
----

== Man Pages[[sec:Man-Pages]]

(((Man Pages)))

Man pages are automatically generated manual pages in most cases. Man
pages are usually available for most programs and commands in Linux.

To view a man page open up a terminal window by going to 'Applications >
Accessories > Terminal'. For example if you wanted to find out something
about the find command in the terminal window type:

----
man find
----

Use the Page Up and Page Down keys to view the man page and the Q key
to quit viewing.

== 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.

== Editing a Root File[[sec:Editing-a-Root-File]]

(((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.

=== The Command Line Way

(((sudo gedit)))

Open up 'Applications > Accessories > Terminal'.

In the terminal window type

----
sudo gedit
----

Open the file with File > Open > Edit

=== The GUI Way

(((gksudo)))

 . Right click on the desktop and select Create Launcher
 . Type a name in like sudo edit
 . Type 'gksudo "gnome-open %u"' as the command and save the launcher to
   your desktop
 . Drag a file onto your launcher to open and edit

=== 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. 

== Terminal Commands[[sec:Terminal-Commands]]

(((Terminal Commands)))

=== Working Directory (((Working Directory)))(((pwd)))

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

----
pwd
----

=== Changing Directories

(((Changing Directories)))(((cd)))

To move up one level in the terminal window type:

----
cd ..
----

To move up two levels in the terminal window type:

----
cd ../..
----

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

----
cd emc2/configs
----

=== Listing files in a directory

(((Listing files in a directory)))(((dir)))(((ls)))

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

----
dir
----

or

----
ls
----

=== Finding a File

(((Finding a File)))(((find)))

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 emc2 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.

=== Searching for Text

(((Searching for Text)))(((grep)))

----
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 occourance 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.

=== Bootup Messages

To view the bootup messages use "dmesg" from the command window. To
save the bootup 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
----

This can be helpful to do just before launching LinuxCNC, so that there will
only be a record of information related to the current launch of LinuxCNC.

To find the built in parallel port address use grep to filter the information
out of dmesg.

After boot up open a terminal and type:

----
dmesg|grep parport
----

== Convenience Items

=== 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.

== Hardware Problems

=== Hardware Info

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

----
lspci -v
----

=== Monitor Resolution

During installation Ubuntu attempts to detect the monitor settings. If
this fails you are left with a generic monitor with a maximum
resolution of 800x600.

Instructions for fixing this are located here:

https://help.ubuntu.com/community/FixVideoResolutionHowto[https://help.ubuntu.com/community/FixVideoResolutionHowto]

== Paths

.Relative Paths
Relative paths are based on the startup directory which is the directory
containing the ini file.  Using relative paths can facilitate relocation of
configurations but requires a good understanding of linux path specifiers.

....
   ./f0        is the same as f0, e.g., a file named f0 in the startup directory
   ../f1       refers to a file f1 in the parent directory
   ../../f2    refers to a file f2 in the parent of the parent directory
   ../../../f3 etc.
....


// vim: set syntax=asciidoc: