]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 2002 Andries Brouwer <aeb@cwi.nl> |
2 | .\" | |
5fbde956 | 3 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da | 4 | .\" |
4c1c5274 | 5 | .TH intro 1 (date) "Linux man-pages (unreleased)" |
fea681da | 6 | .SH NAME |
f68512e9 | 7 | intro \- introduction to user commands |
fea681da | 8 | .SH DESCRIPTION |
f45a07b6 MK |
9 | Section 1 of the manual describes user commands and tools, |
10 | for example, file manipulation tools, shells, compilers, | |
11 | web browsers, file and image viewers and editors, and so on. | |
f45a07b6 | 12 | .SH NOTES |
008f1ecc MK |
13 | Linux is a flavor of UNIX, and as a first approximation |
14 | all user commands under UNIX work precisely the same under | |
15 | Linux (and FreeBSD and lots of other UNIX-like systems). | |
dd3568a1 | 16 | .PP |
eb9a0b2f | 17 | Under Linux, there are GUIs (graphical user interfaces), where you |
fea681da | 18 | can point and click and drag, and hopefully get work done without |
ca7b3c18 | 19 | first reading lots of documentation. |
008f1ecc | 20 | The traditional UNIX environment |
fea681da | 21 | is a CLI (command line interface), where you type commands to |
ca7b3c18 MK |
22 | tell the computer what to do. |
23 | That is faster and more powerful, | |
fea681da MK |
24 | but requires finding out what the commands are. |
25 | Below a bare minimum, to get started. | |
73d8cece | 26 | .SS Login |
6732bb8b | 27 | In order to start working, you probably first have to open a session by |
33ce7fd6 | 28 | giving your username and password. |
fea681da | 29 | The program |
6732bb8b | 30 | .BR login (1) |
fea681da MK |
31 | now starts a |
32 | .I shell | |
33 | (command interpreter) for you. | |
34 | In case of a graphical login, you get a screen with menus or icons | |
ca7b3c18 MK |
35 | and a mouse click will start a shell in a window. |
36 | See also | |
fea681da | 37 | .BR xterm (1). |
73d8cece | 38 | .SS The shell |
fea681da MK |
39 | One types commands to the |
40 | .IR shell , | |
ca7b3c18 MK |
41 | the command interpreter. |
42 | It is not built-in, but is just a program | |
43 | and you can change your shell. | |
60ae21db | 44 | Everybody has their own favorite one. |
fea681da MK |
45 | The standard one is called |
46 | .IR sh . | |
47 | See also | |
48 | .BR ash (1), | |
49 | .BR bash (1), | |
6732bb8b | 50 | .BR chsh (1), |
fea681da | 51 | .BR csh (1), |
6732bb8b SA |
52 | .BR dash (1), |
53 | .BR ksh (1), | |
54 | .BR zsh (1). | |
dd3568a1 | 55 | .PP |
6732bb8b | 56 | A session might go like: |
dd3568a1 | 57 | .PP |
408731d4 MK |
58 | .in +4n |
59 | .EX | |
d1f129d4 SA |
60 | .RB "knuth login: " aeb |
61 | .RB "Password: " ******** | |
144685a7 | 62 | .RB "$ " date |
fea681da | 63 | Tue Aug 6 23:50:44 CEST 2002 |
144685a7 | 64 | .RB "$ " cal |
fea681da | 65 | August 2002 |
988db661 | 66 | Su Mo Tu We Th Fr Sa |
fea681da MK |
67 | 1 2 3 |
68 | 4 5 6 7 8 9 10 | |
69 | 11 12 13 14 15 16 17 | |
70 | 18 19 20 21 22 23 24 | |
71 | 25 26 27 28 29 30 31 | |
72 | ||
144685a7 | 73 | .RB "$ " ls |
fea681da | 74 | bin tel |
144685a7 | 75 | .RB "$ " "ls \-l" |
fea681da | 76 | total 2 |
94e9d9fe MK |
77 | drwxrwxr\-x 2 aeb 1024 Aug 6 23:51 bin |
78 | \-rw\-rw\-r\-\- 1 aeb 37 Aug 6 23:52 tel | |
144685a7 | 79 | .RB "$ " "cat tel" |
94e9d9fe MK |
80 | maja 0501\-1136285 |
81 | peter 0136\-7399214 | |
144685a7 SA |
82 | .RB "$ " "cp tel tel2" |
83 | .RB "$ " "ls \-l" | |
fea681da | 84 | total 3 |
94e9d9fe MK |
85 | drwxr\-xr\-x 2 aeb 1024 Aug 6 23:51 bin |
86 | \-rw\-r\-\-r\-\- 1 aeb 37 Aug 6 23:52 tel | |
87 | \-rw\-r\-\-r\-\- 1 aeb 37 Aug 6 23:53 tel2 | |
144685a7 SA |
88 | .RB "$ " "mv tel tel1" |
89 | .RB "$ " "ls \-l" | |
fea681da | 90 | total 3 |
94e9d9fe MK |
91 | drwxr\-xr\-x 2 aeb 1024 Aug 6 23:51 bin |
92 | \-rw\-r\-\-r\-\- 1 aeb 37 Aug 6 23:52 tel1 | |
93 | \-rw\-r\-\-r\-\- 1 aeb 37 Aug 6 23:53 tel2 | |
144685a7 SA |
94 | .RB "$ " "diff tel1 tel2" |
95 | .RB "$ " "rm tel1" | |
96 | .RB "$ " "grep maja tel2" | |
94e9d9fe | 97 | maja 0501\-1136285 |
144685a7 | 98 | $ |
408731d4 MK |
99 | .EE |
100 | .in | |
dd3568a1 | 101 | .PP |
1eae1168 | 102 | Here typing Control-D ended the session. |
dd3568a1 | 103 | .PP |
fea681da | 104 | The |
144685a7 | 105 | .B $ |
5503c85e | 106 | here was the command prompt\(emit is the shell's way of indicating |
ca7b3c18 MK |
107 | that it is ready for the next command. |
108 | The prompt can be customized | |
18701562 | 109 | in lots of ways, and one might include stuff like username, |
410f3d22 | 110 | machine name, current directory, time, and so on. |
fea681da MK |
111 | An assignment PS1="What next, master? " |
112 | would change the prompt as indicated. | |
dd3568a1 | 113 | .PP |
fea681da MK |
114 | We see that there are commands |
115 | .I date | |
116 | (that gives date and time), and | |
117 | .I cal | |
118 | (that gives a calendar). | |
dd3568a1 | 119 | .PP |
fea681da MK |
120 | The command |
121 | .I ls | |
5503c85e | 122 | lists the contents of the current directory\(emit tells you what |
ca7b3c18 | 123 | files you have. |
80d26cef MK |
124 | With a |
125 | .I \-l | |
126 | option it gives a long listing, | |
fea681da MK |
127 | that includes the owner and size and date of the file, and the |
128 | permissions people have for reading and/or changing the file. | |
129 | For example, the file "tel" here is 37 bytes long, owned by aeb | |
130 | and the owner can read and write it, others can only read it. | |
131 | Owner and permissions can be changed by the commands | |
132 | .I chown | |
133 | and | |
134 | .IR chmod . | |
dd3568a1 | 135 | .PP |
fea681da MK |
136 | The command |
137 | .I cat | |
138 | will show the contents of a file. | |
139 | (The name is from "concatenate and print": all files given as | |
6732bb8b SA |
140 | parameters are concatenated and sent to "standard output" |
141 | (see | |
142 | .BR stdout (3)), | |
143 | here | |
fea681da | 144 | the terminal screen.) |
dd3568a1 | 145 | .PP |
fea681da MK |
146 | The command |
147 | .I cp | |
148 | (from "copy") will copy a file. | |
dd3568a1 | 149 | .PP |
6732bb8b | 150 | The command |
fea681da | 151 | .I mv |
6732bb8b | 152 | (from "move"), on the other hand, only renames it. |
dd3568a1 | 153 | .PP |
fea681da MK |
154 | The command |
155 | .I diff | |
156 | lists the differences between two files. | |
157 | Here there was no output because there were no differences. | |
dd3568a1 | 158 | .PP |
fea681da MK |
159 | The command |
160 | .I rm | |
161 | (from "remove") deletes the file, and be careful! it is gone. | |
ca7b3c18 MK |
162 | No wastepaper basket or anything. |
163 | Deleted means lost. | |
dd3568a1 | 164 | .PP |
fea681da MK |
165 | The command |
166 | .I grep | |
167 | (from "g/re/p") finds occurrences of a string in one or more files. | |
168 | Here it finds Maja's telephone number. | |
73d8cece | 169 | .SS Pathnames and the current directory |
fea681da MK |
170 | Files live in a large tree, the file hierarchy. |
171 | Each has a | |
2d7195b8 | 172 | .I "pathname" |
af2908c3 SA |
173 | describing the path from the root of the tree (which is called |
174 | .IR / ) | |
ca7b3c18 | 175 | to the file. |
af2908c3 SA |
176 | For example, such a full pathname might be |
177 | .IR /home/aeb/tel . | |
2d7195b8 | 178 | Always using full pathnames would be inconvenient, and the name |
33a0ccb2 MK |
179 | of a file in the current directory may be abbreviated by giving |
180 | only the last component. | |
af2908c3 SA |
181 | That is why |
182 | .I /home/aeb/tel | |
183 | can be abbreviated | |
458abbe6 | 184 | to |
af2908c3 SA |
185 | .I tel |
186 | when the current directory is | |
187 | .IR /home/aeb . | |
dd3568a1 | 188 | .PP |
fea681da MK |
189 | The command |
190 | .I pwd | |
191 | prints the current directory. | |
dd3568a1 | 192 | .PP |
fea681da MK |
193 | The command |
194 | .I cd | |
195 | changes the current directory. | |
dd3568a1 | 196 | .PP |
6732bb8b SA |
197 | Try alternatively |
198 | .I cd | |
199 | and | |
200 | .I pwd | |
201 | commands and explore | |
202 | .I cd | |
3ded684c | 203 | usage: "cd", "cd .", "cd ..", "cd /", and "cd \(ti". |
73d8cece | 204 | .SS Directories |
fea681da MK |
205 | The command |
206 | .I mkdir | |
207 | makes a new directory. | |
dd3568a1 | 208 | .PP |
fea681da MK |
209 | The command |
210 | .I rmdir | |
211 | removes a directory if it is empty, and complains otherwise. | |
dd3568a1 | 212 | .PP |
fea681da MK |
213 | The command |
214 | .I find | |
215 | (with a rather baroque syntax) will find files with given name | |
20523df7 MK |
216 | or other properties. |
217 | For example, "find . \-name tel" would find | |
af2908c3 SA |
218 | the file |
219 | .I tel | |
220 | starting in the present directory (which is called | |
221 | .IR . ). | |
4d9b6984 | 222 | And "find / \-name tel" would do the same, but starting at the root |
20523df7 MK |
223 | of the tree. |
224 | Large searches on a multi-GB disk will be time-consuming, | |
fea681da MK |
225 | and it may be better to use |
226 | .BR locate (1). | |
73d8cece | 227 | .SS Disks and filesystems |
fea681da MK |
228 | The command |
229 | .I mount | |
9ee4a2b6 MK |
230 | will attach the filesystem found on some disk (or floppy, or CDROM or so) |
231 | to the big filesystem hierarchy. | |
20523df7 | 232 | And |
fea681da MK |
233 | .I umount |
234 | detaches it again. | |
235 | The command | |
236 | .I df | |
237 | will tell you how much of your disk is still free. | |
73d8cece | 238 | .SS Processes |
008f1ecc | 239 | On a UNIX system many user and system processes run simultaneously. |
fea681da MK |
240 | The one you are talking to runs in the |
241 | .IR foreground , | |
242 | the others in the | |
243 | .IR background . | |
244 | The command | |
245 | .I ps | |
246 | will show you which processes are active and what numbers these | |
247 | processes have. | |
248 | The command | |
249 | .I kill | |
20523df7 MK |
250 | allows you to get rid of them. |
251 | Without option this is a friendly | |
252 | request: please go away. | |
253 | And "kill \-9" followed by the number | |
fea681da MK |
254 | of the process is an immediate kill. |
255 | Foreground processes can often be killed by typing Control-C. | |
73d8cece | 256 | .SS Getting information |
fea681da MK |
257 | There are thousands of commands, each with many options. |
258 | Traditionally commands are documented on | |
259 | .IR "man pages" , | |
260 | (like this one), so that the command "man kill" will document | |
261 | the use of the command "kill" (and "man man" document the command "man"). | |
262 | The program | |
263 | .I man | |
264 | sends the text through some | |
265 | .IR pager , | |
266 | usually | |
267 | .IR less . | |
268 | Hit the space bar to get the next page, hit q to quit. | |
dd3568a1 | 269 | .PP |
9fdfa163 | 270 | In documentation it is customary to refer to man pages |
fea681da MK |
271 | by giving the name and section number, as in |
272 | .BR man (1). | |
273 | Man pages are terse, and allow you to find quickly some forgotten | |
20523df7 MK |
274 | detail. |
275 | For newcomers an introductory text with more examples | |
fea681da | 276 | and explanations is useful. |
dd3568a1 | 277 | .PP |
20523df7 MK |
278 | A lot of GNU/FSF software is provided with info files. |
279 | Type "info info" | |
4ca1679e SA |
280 | for an introduction on the use of the program |
281 | .IR info . | |
dd3568a1 | 282 | .PP |
20523df7 MK |
283 | Special topics are often treated in HOWTOs. |
284 | Look in | |
fea681da MK |
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 | |
47297adb | 290 | .SH SEE ALSO |
ab946020 | 291 | .BR ash (1), |
b35813db SA |
292 | .BR bash (1), |
293 | .BR chsh (1), | |
ab946020 | 294 | .BR csh (1), |
6732bb8b SA |
295 | .BR dash (1), |
296 | .BR ksh (1), | |
ab946020 | 297 | .BR locate (1), |
b35813db SA |
298 | .BR login (1), |
299 | .BR man (1), | |
300 | .BR xterm (1), | |
1eae1168 | 301 | .BR zsh (1), |
b35813db | 302 | .BR wait (2), |
6732bb8b | 303 | .BR stdout (3), |
28a4c58c | 304 | .BR man\-pages (7), |
1eae1168 | 305 | .BR standards (7) |