]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man1/intro.1
Update date in TH line
[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 non-zero status means that the command was unsuccessful.
41 (Details of the exit status can be found in
42 .BR wait (2).)
43 A non-zero exit status can be in the range 1 to 255, and some commands
44 use different non-zero 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 \(em it 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 user name,
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 \(em it tells you what
155 files you have.
156 With a \-l option it gives a long listing,
157 that includes the owner and size and date of the file, and the
158 permissions people have for reading and/or changing the file.
159 For example, the file "tel" here is 37 bytes long, owned by aeb
160 and the owner can read and write it, others can only read it.
161 Owner and permissions can be changed by the commands
162 .I chown
163 and
164 .IR chmod .
165 .LP
166 The command
167 .I cat
168 will show the contents of a file.
169 (The name is from "concatenate and print": all files given as
170 parameters are concatenated and sent to "standard output", here
171 the terminal screen.)
172 .LP
173 The command
174 .I cp
175 (from "copy") will copy a file.
176 On the other hand, the command
177 .I mv
178 (from "move") only renames it.
179 .LP
180 The command
181 .I diff
182 lists the differences between two files.
183 Here there was no output because there were no differences.
184 .LP
185 The command
186 .I rm
187 (from "remove") deletes the file, and be careful! it is gone.
188 No wastepaper basket or anything.
189 Deleted means lost.
190 .LP
191 The command
192 .I grep
193 (from "g/re/p") finds occurrences of a string in one or more files.
194 Here it finds Maja's telephone number.
195 .SS "Pathnames and the current directory"
196 Files live in a large tree, the file hierarchy.
197 Each has a
198 .I "pathname"
199 describing the path from the root of the tree (which is called /)
200 to the file.
201 For example, such a full pathname might be /home/aeb/tel.
202 Always using full pathnames would be inconvenient, and the name
203 of a file in the current directory may be abbreviated by only giving
204 the last component.
205 That is why "/home/aeb/tel" can be abbreviated
206 to "tel" when the current directory is "/home/aeb".
207 .LP
208 The command
209 .I pwd
210 prints the current directory.
211 .LP
212 The command
213 .I cd
214 changes the current directory.
215 Try "cd /" and "pwd" and "cd" and "pwd".
216 .SS "Directories"
217 The command
218 .I mkdir
219 makes a new directory.
220 .LP
221 The command
222 .I rmdir
223 removes a directory if it is empty, and complains otherwise.
224 .LP
225 The command
226 .I find
227 (with a rather baroque syntax) will find files with given name
228 or other properties. For example, "find . \-name tel" would find
229 the file "tel" starting in the present directory (which is called ".").
230 And "find / \-name tel" would do the same, but starting at the root
231 of the tree. Large searches on a multi-GB disk will be time-consuming,
232 and it may be better to use
233 .BR locate (1).
234 .SS "Disks and Filesystems"
235 The command
236 .I mount
237 will attach the filesystem found on some disk (or floppy, or CDROM or so)
238 to the big filesystem hierarchy. And
239 .I umount
240 detaches it again.
241 The command
242 .I df
243 will tell you how much of your disk is still free.
244 .SS "Processes"
245 On a Unix system many user and system processes run simultaneously.
246 The one you are talking to runs in the
247 .IR foreground ,
248 the others in the
249 .IR background .
250 The command
251 .I ps
252 will show you which processes are active and what numbers these
253 processes have.
254 The command
255 .I kill
256 allows you to get rid of them. Without option this is a friendly
257 request: please go away. And "kill \-9" followed by the number
258 of the process is an immediate kill.
259 Foreground processes can often be killed by typing Control-C.
260 .SS "Getting information"
261 There are thousands of commands, each with many options.
262 Traditionally commands are documented on
263 .IR "man pages" ,
264 (like this one), so that the command "man kill" will document
265 the use of the command "kill" (and "man man" document the command "man").
266 The program
267 .I man
268 sends the text through some
269 .IR pager ,
270 usually
271 .IR less .
272 Hit the space bar to get the next page, hit q to quit.
273 .LP
274 In documentation it is customary to refer to man pages
275 by giving the name and section number, as in
276 .BR man (1).
277 Man pages are terse, and allow you to find quickly some forgotten
278 detail. For newcomers an introductory text with more examples
279 and explanations is useful.
280 .LP
281 A lot of GNU/FSF software is provided with info files. Type "info info"
282 for an introduction on the use of the program "info".
283 .LP
284 Special topics are often treated in HOWTOs. Look in
285 .I /usr/share/doc/howto/en
286 and use a browser if you find HTML files there.
287 .\"
288 .\" Actual examples? Separate section for each of cat, cp, ...?
289 .\" gzip, bzip2, tar, rpm
290 .SH "SEE ALSO"
291 .BR standards (7)