aboutsummaryrefslogtreecommitdiff
path: root/man/man1/9p.1
blob: 3a77e244f3a13e8427d6d09de7dd2d51ba609faa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
.TH 9P 1
.SH NAME
9p \- read and write files on a 9P server
.SH SYNOPSIS
.B 9p
[
.I options
]
.B read
.I path
.br
.B 9p
[
.I options
]
.B readfd
.I path
.PP
.B 9p
[
.I options
]
.B write
[
.B -l
]
.I path
.br
.B 9p
[
.I options
]
.B writefd
.I path
.PP
.B 9p
[
.I options
]
.B stat
.I path
.PP
.B 9p
[
.I options
]
.B rdwr
.I path
.PP
.B 9p
[
.I options
]
.B ls
[
.B -dl
]
.I path...
.SH DESCRIPTION
.I 9p
is a trivial 9P client that can access a single file on a 9P server.
It can be useful for manual interaction with a 9P server or for
accessing simple 9P services from within shell scripts.
The common options are:
.TP
.B -a\fI addr
dial
the server at
.I addr
.TP
.B -A\fI aname
attach to the file system named
.I aname
.TP
.B -n
mount without authentication
.PP
The first argument is a command, one of:
.TP
.B read
print the contents of
.I path 
to standard output
.TP
.B write
write data on standard input to
.IR path ;
the 
.B -l
option causes
.I write
to write one line at a time
.TP
.BR readfd ", " writefd
like
.B read
and 
.B write
but use
.IR openfd (9p)
instead of
.IR open ;
this masks errors and is mainly useful for debugging
the implementation of
.I openfd
.TP
.B stat
execute
.I stat (9p)
on 
.I path
and print the result
.TP
.B rdwr
Open
.I path
for reading and writing.
Then repeat until end-of-file on standard input:
copy a line from the file to standard output,
copy a line from standard input to the file.
Print errors, but don't give up.
.B Rdwr
is useful for interacting with servers like
.IM factotum (4) .
.TP
.B ls
Print a directory listing in the format of
.IM ls (1) .
The
.B -d
and
.B -l
flags have the same meaning as in
.IR ls .
.PD
.PP
.I 9p
dials
.I address
to connect to the 9P server.
If the
.B -a
option is not given,
.I 9p
requires the
.I path
to be of the form
.IB service / subpath \fR;
it connects to the Unix domain socket
.I service
in the name space directory
(see
.IM intro (4) )
and then accesses
.IR subpath .
.SH EXAMPLE
To update
.IM plumber (4) 's
copy of your plumbing rules after editing
.BR $HOME/lib/plumbing :
.IP
.EX
cat $HOME/lib/plumbing | 9p write plumb/rules
.EE
.PP
To display the contents of the current
.IM acme (4)
window:
.IP
.EX
9p read acme/$winid/body
.EE
.SH SOURCE
.B \*9/src/cmd/9p.c
.SH SEE ALSO
.IM intro (4) ,
.IR intro (9p),
.IM 9pclient (3)