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