]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man1/intro.1
intro.1: Fix errors introduced by the commit 6732bb8b
[thirdparty/man-pages.git] / man1 / intro.1
1 .\" Copyright (c) 2002 Andries Brouwer <aeb@cwi.nl>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" 2007-10-23 mtk Added intro paragraph about section, plus a paragraph
26 .\" about exit status values.
27 .\"
28 .TH INTRO 1 2007-11-15 "Linux" "Linux User's Manual"
29 .SH NAME
30 intro \- introduction to user commands
31 .SH DESCRIPTION
32 Section 1 of the manual describes user commands and tools,
33 for example, file manipulation tools, shells, compilers,
34 web browsers, file and image viewers and editors, and so on.
35
36 All commands yield a status value on termination.
37 This value can be tested (e.g., in most shells the variable
38 .I $?
39 contains the status of the last executed command)
40 to see whether the command completed successfully.
41 A zero exit status is conventionally used to indicate success,
42 and a nonzero status means that the command was unsuccessful.
43 (Details of the exit status can be found in
44 .BR wait (2).)
45 A nonzero exit status can be in the range 1 to 255, and some commands
46 use different nonzero status values to indicate the reason why the
47 command failed.
48 .SH NOTES
49 Linux is a flavor of UNIX, and as a first approximation
50 all user commands under UNIX work precisely the same under
51 Linux (and FreeBSD and lots of other UNIX-like systems).
52 .LP
53 Under Linux, there are GUIs (graphical user interfaces), where you
54 can point and click and drag, and hopefully get work done without
55 first reading lots of documentation.
56 The traditional UNIX environment
57 is a CLI (command line interface), where you type commands to
58 tell the computer what to do.
59 That is faster and more powerful,
60 but requires finding out what the commands are.
61 Below a bare minimum, to get started.
62 .SS Login
63 In order to start working, you probably first have to open a session by
64 giving, your username and password.
65 The program
66 .BR login (1)
67 now starts a
68 .I shell
69 (command interpreter) for you.
70 In case of a graphical login, you get a screen with menus or icons
71 and a mouse click will start a shell in a window.
72 See also
73 .BR xterm (1).
74 .SS The shell
75 One types commands to the
76 .IR shell ,
77 the command interpreter.
78 It is not built-in, but is just a program
79 and you can change your shell.
80 Everybody has her own favorite one.
81 The standard one is called
82 .IR sh .
83 See also
84 .BR ash (1),
85 .BR bash (1),
86 .BR chsh (1),
87 .BR csh (1),
88 .BR dash (1),
89 .BR ksh (1),
90 .BR zsh (1).
91 .LP
92 A session might go like:
93 .LP
94 .RS
95 .nf
96 .RB "knuth login: " aeb
97 .RB "Password: " ********
98 .RB "$ " date
99 Tue Aug 6 23:50:44 CEST 2002
100 .RB "$ " cal
101 August 2002
102 Su Mo Tu We Th Fr Sa
103 1 2 3
104 4 5 6 7 8 9 10
105 11 12 13 14 15 16 17
106 18 19 20 21 22 23 24
107 25 26 27 28 29 30 31
108
109 .RB "$ " ls
110 bin tel
111 .RB "$ " "ls \-l"
112 total 2
113 drwxrwxr\-x 2 aeb 1024 Aug 6 23:51 bin
114 \-rw\-rw\-r\-\- 1 aeb 37 Aug 6 23:52 tel
115 .RB "$ " "cat tel"
116 maja 0501\-1136285
117 peter 0136\-7399214
118 .RB "$ " "cp tel tel2"
119 .RB "$ " "ls \-l"
120 total 3
121 drwxr\-xr\-x 2 aeb 1024 Aug 6 23:51 bin
122 \-rw\-r\-\-r\-\- 1 aeb 37 Aug 6 23:52 tel
123 \-rw\-r\-\-r\-\- 1 aeb 37 Aug 6 23:53 tel2
124 .RB "$ " "mv tel tel1"
125 .RB "$ " "ls \-l"
126 total 3
127 drwxr\-xr\-x 2 aeb 1024 Aug 6 23:51 bin
128 \-rw\-r\-\-r\-\- 1 aeb 37 Aug 6 23:52 tel1
129 \-rw\-r\-\-r\-\- 1 aeb 37 Aug 6 23:53 tel2
130 .RB "$ " "diff tel1 tel2"
131 .RB "$ " "rm tel1"
132 .RB "$ " "grep maja tel2"
133 maja 0501\-1136285
134 $
135 .fi
136 .RE
137 .LP
138 Here typing Control-D ended the session.
139 .LP
140 The
141 .B $
142 here was the command prompt\(emit is the shell's way of indicating
143 that it is ready for the next command.
144 The prompt can be customized
145 in lots of ways, and one might include stuff like username,
146 machine name, current directory, time, and so on.
147 An assignment PS1="What next, master? "
148 would change the prompt as indicated.
149 .LP
150 We see that there are commands
151 .I date
152 (that gives date and time), and
153 .I cal
154 (that gives a calendar).
155 .LP
156 The command
157 .I ls
158 lists the contents of the current directory\(emit tells you what
159 files you have.
160 With a
161 .I \-l
162 option it gives a long listing,
163 that includes the owner and size and date of the file, and the
164 permissions people have for reading and/or changing the file.
165 For example, the file "tel" here is 37 bytes long, owned by aeb
166 and the owner can read and write it, others can only read it.
167 Owner and permissions can be changed by the commands
168 .I chown
169 and
170 .IR chmod .
171 .LP
172 The command
173 .I cat
174 will show the contents of a file.
175 (The name is from "concatenate and print": all files given as
176 parameters are concatenated and sent to "standard output"
177 (see
178 .BR stdout (3)),
179 here
180 the terminal screen.)
181 .LP
182 The command
183 .I cp
184 (from "copy") will copy a file.
185 .LP
186 The command
187 .I mv
188 (from "move"), on the other hand, only renames it.
189 .LP
190 The command
191 .I diff
192 lists the differences between two files.
193 Here there was no output because there were no differences.
194 .LP
195 The command
196 .I rm
197 (from "remove") deletes the file, and be careful! it is gone.
198 No wastepaper basket or anything.
199 Deleted means lost.
200 .LP
201 The command
202 .I grep
203 (from "g/re/p") finds occurrences of a string in one or more files.
204 Here it finds Maja's telephone number.
205 .SS Pathnames and the current directory
206 Files live in a large tree, the file hierarchy.
207 Each has a
208 .I "pathname"
209 describing the path from the root of the tree (which is called
210 .IR / )
211 to the file.
212 For example, such a full pathname might be
213 .IR /home/aeb/tel .
214 Always using full pathnames would be inconvenient, and the name
215 of a file in the current directory may be abbreviated by giving
216 only the last component.
217 That is why
218 .I /home/aeb/tel
219 can be abbreviated
220 to
221 .I tel
222 when the current directory is
223 .IR /home/aeb .
224 .LP
225 The command
226 .I pwd
227 prints the current directory.
228 .LP
229 The command
230 .I cd
231 changes the current directory.
232 .LP
233 Try alternatively
234 .I cd
235 and
236 .I pwd
237 commands and explore
238 .I cd
239 usage: "cd", "cd .", "cd ..", "cd /" and "cd ~".
240 .SS Directories
241 The command
242 .I mkdir
243 makes a new directory.
244 .LP
245 The command
246 .I rmdir
247 removes a directory if it is empty, and complains otherwise.
248 .LP
249 The command
250 .I find
251 (with a rather baroque syntax) will find files with given name
252 or other properties.
253 For example, "find . \-name tel" would find
254 the file
255 .I tel
256 starting in the present directory (which is called
257 .IR . ).
258 And "find / \-name tel" would do the same, but starting at the root
259 of the tree.
260 Large searches on a multi-GB disk will be time-consuming,
261 and it may be better to use
262 .BR locate (1).
263 .SS Disks and filesystems
264 The command
265 .I mount
266 will attach the filesystem found on some disk (or floppy, or CDROM or so)
267 to the big filesystem hierarchy.
268 And
269 .I umount
270 detaches it again.
271 The command
272 .I df
273 will tell you how much of your disk is still free.
274 .SS Processes
275 On a UNIX system many user and system processes run simultaneously.
276 The one you are talking to runs in the
277 .IR foreground ,
278 the others in the
279 .IR background .
280 The command
281 .I ps
282 will show you which processes are active and what numbers these
283 processes have.
284 The command
285 .I kill
286 allows you to get rid of them.
287 Without option this is a friendly
288 request: please go away.
289 And "kill \-9" followed by the number
290 of the process is an immediate kill.
291 Foreground processes can often be killed by typing Control-C.
292 .SS Getting information
293 There are thousands of commands, each with many options.
294 Traditionally commands are documented on
295 .IR "man pages" ,
296 (like this one), so that the command "man kill" will document
297 the use of the command "kill" (and "man man" document the command "man").
298 The program
299 .I man
300 sends the text through some
301 .IR pager ,
302 usually
303 .IR less .
304 Hit the space bar to get the next page, hit q to quit.
305 .LP
306 In documentation it is customary to refer to man pages
307 by giving the name and section number, as in
308 .BR man (1).
309 Man pages are terse, and allow you to find quickly some forgotten
310 detail.
311 For newcomers an introductory text with more examples
312 and explanations is useful.
313 .LP
314 A lot of GNU/FSF software is provided with info files.
315 Type "info info"
316 for an introduction on the use of the program
317 .IR info .
318 .LP
319 Special topics are often treated in HOWTOs.
320 Look in
321 .I /usr/share/doc/howto/en
322 and use a browser if you find HTML files there.
323 .\"
324 .\" Actual examples? Separate section for each of cat, cp, ...?
325 .\" gzip, bzip2, tar, rpm
326 .SH SEE ALSO
327 .BR ash (1),
328 .BR bash (1),
329 .BR chsh (1),
330 .BR csh (1),
331 .BR dash (1),
332 .BR ksh (1),
333 .BR locate (1),
334 .BR login (1),
335 .BR man (1),
336 .BR xterm (1),
337 .BR zsh (1),
338 .BR wait (2),
339 .BR stdout (3),
340 .BR man-pages (7),
341 .BR standards (7)