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