OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / 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 login,
64 that is, give your username and password.
65 See also
66 .BR login (1).
67 The program
68 .I login
69 now starts a
70 .I shell
71 (command interpreter) for you.
72 In case of a graphical login, you get a screen with menus or icons
73 and a mouse click will start a shell in a window.
74 See also
75 .BR xterm (1).
76 .SS The shell
77 One types commands to the
78 .IR shell ,
79 the command interpreter.
80 It is not built-in, but is just a program
81 and you can change your shell.
82 Everybody has her own favorite one.
83 The standard one is called
84 .IR sh .
85 See also
86 .BR ash (1),
87 .BR bash (1),
88 .BR csh (1),
89 .BR zsh (1),
90 .BR chsh (1).
91 .LP
92 A session might go like
93
94 .RS
95 .nf
96 .BI "knuth login: " aeb
97 .BI "Password: " ********
98 .BI "% " date
99 Tue Aug  6 23:50:44 CEST 2002
100 .BI "% " 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 .BI "% " ls
110 bin  tel
111 .BI "% " "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 .BI "% " "cat tel"
116 maja    0501\-1136285
117 peter   0136\-7399214
118 .BI "% " "cp tel tel2"
119 .BI "% " "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 .BI "% " "mv tel tel1"
125 .BI "% " "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 .BI "% " "diff tel1 tel2"
131 .BI "% " "rm tel1"
132 .BI "% " "grep maja tel2"
133 maja    0501\-1136285
134 .B "% "
135 .fi
136 .RE
137 and here typing Control-D ended the session.
138 The
139 .B "% "
140 here was the command prompt\(emit is the shell's way of indicating
141 that it is ready for the next command.
142 The prompt can be customized
143 in lots of ways, and one might include stuff like username,
144 machine name, current directory, time, and so on.
145 An assignment PS1="What next, master? "
146 would change the prompt as indicated.
147 .LP
148 We see that there are commands
149 .I date
150 (that gives date and time), and
151 .I cal
152 (that gives a calendar).
153 .LP
154 The command
155 .I ls
156 lists the contents of the current directory\(emit tells you what
157 files you have.
158 With a
159 .I \-l
160 option it gives a long listing,
161 that includes the owner and size and date of the file, and the
162 permissions people have for reading and/or changing the file.
163 For example, the file "tel" here is 37 bytes long, owned by aeb
164 and the owner can read and write it, others can only read it.
165 Owner and permissions can be changed by the commands
166 .I chown
167 and
168 .IR chmod .
169 .LP
170 The command
171 .I cat
172 will show the contents of a file.
173 (The name is from "concatenate and print": all files given as
174 parameters are concatenated and sent to "standard output", here
175 the terminal screen.)
176 .LP
177 The command
178 .I cp
179 (from "copy") will copy a file.
180 On the other hand, the command
181 .I mv
182 (from "move") only renames it.
183 .LP
184 The command
185 .I diff
186 lists the differences between two files.
187 Here there was no output because there were no differences.
188 .LP
189 The command
190 .I rm
191 (from "remove") deletes the file, and be careful! it is gone.
192 No wastepaper basket or anything.
193 Deleted means lost.
194 .LP
195 The command
196 .I grep
197 (from "g/re/p") finds occurrences of a string in one or more files.
198 Here it finds Maja's telephone number.
199 .SS Pathnames and the current directory
200 Files live in a large tree, the file hierarchy.
201 Each has a
202 .I "pathname"
203 describing the path from the root of the tree (which is called /)
204 to the file.
205 For example, such a full pathname might be /home/aeb/tel.
206 Always using full pathnames would be inconvenient, and the name
207 of a file in the current directory may be abbreviated by giving
208 only the last component.
209 That is why "/home/aeb/tel" can be abbreviated
210 to "tel" when the current directory is "/home/aeb".
211 .LP
212 The command
213 .I pwd
214 prints the current directory.
215 .LP
216 The command
217 .I cd
218 changes the current directory.
219 Try "cd /" and "pwd" and "cd" and "pwd".
220 .SS Directories
221 The command
222 .I mkdir
223 makes a new directory.
224 .LP
225 The command
226 .I rmdir
227 removes a directory if it is empty, and complains otherwise.
228 .LP
229 The command
230 .I find
231 (with a rather baroque syntax) will find files with given name
232 or other properties.
233 For example, "find . \-name tel" would find
234 the file "tel" starting in the present directory (which is called ".").
235 And "find / \-name tel" would do the same, but starting at the root
236 of the tree.
237 Large searches on a multi-GB disk will be time-consuming,
238 and it may be better to use
239 .BR locate (1).
240 .SS Disks and filesystems
241 The command
242 .I mount
243 will attach the filesystem found on some disk (or floppy, or CDROM or so)
244 to the big filesystem hierarchy.
245 And
246 .I umount
247 detaches it again.
248 The command
249 .I df
250 will tell you how much of your disk is still free.
251 .SS Processes
252 On a UNIX system many user and system processes run simultaneously.
253 The one you are talking to runs in the
254 .IR foreground ,
255 the others in the
256 .IR background .
257 The command
258 .I ps
259 will show you which processes are active and what numbers these
260 processes have.
261 The command
262 .I kill
263 allows you to get rid of them.
264 Without option this is a friendly
265 request: please go away.
266 And "kill \-9" followed by the number
267 of the process is an immediate kill.
268 Foreground processes can often be killed by typing Control-C.
269 .SS Getting information
270 There are thousands of commands, each with many options.
271 Traditionally commands are documented on
272 .IR "man pages" ,
273 (like this one), so that the command "man kill" will document
274 the use of the command "kill" (and "man man" document the command "man").
275 The program
276 .I man
277 sends the text through some
278 .IR pager ,
279 usually
280 .IR less .
281 Hit the space bar to get the next page, hit q to quit.
282 .LP
283 In documentation it is customary to refer to man pages
284 by giving the name and section number, as in
285 .BR man (1).
286 Man pages are terse, and allow you to find quickly some forgotten
287 detail.
288 For newcomers an introductory text with more examples
289 and explanations is useful.
290 .LP
291 A lot of GNU/FSF software is provided with info files.
292 Type "info info"
293 for an introduction on the use of the program "info".
294 .LP
295 Special topics are often treated in HOWTOs.
296 Look in
297 .I /usr/share/doc/howto/en
298 and use a browser if you find HTML files there.
299 .\"
300 .\" Actual examples? Separate section for each of cat, cp, ...?
301 .\" gzip, bzip2, tar, rpm
302 .SH SEE ALSO
303 .BR standards (7)
304 .SH COLOPHON
305 This page is part of release 3.79 of the Linux
306 .I man-pages
307 project.
308 A description of the project,
309 information about reporting bugs,
310 and the latest version of this page,
311 can be found at
312 \%http://www.kernel.org/doc/man\-pages/.