$cat food
Sweet Tooth
Bangkok Wok
Mandalay
Afghani Cuisine
Isle of Java
Big Apple Deli
Sushi and Sashimi
Tio Pepe's Peppers
........
接着让我们利用 pr 命令将输出变成两列,同时头部显示 Restaruants:
代码如下:
$pr -2 -h "Restaurants" food
Nov 7 9:58 1997 Restaurants Page 1
Sweet Tooth Isle of Java
Bangkok Wok Big Apple Deli
Mandalay Sushi and Sashimi
Afghani Cuisine Tio Pepe's Peppers
........
$lpstat -o
laserp-573 john 128865 Nov 7 11:27 on laserp
laserp-574 grace 82744 Nov 7 11:28
laserp-575 john 23347 Nov 7 11:35
lpg 显示的信息与 lpstat -o 显示的稍微有些不同:
代码如下:
$lpq
laserp is ready and printing
Rank Owner Job Files Total Size
active john 573 report.ps 128865 bytes
1st grace 574 ch03.ps ch04.ps 82744 bytes
2nd john 575 standard input 23347 bytes
指令 描述 put filename 从本地往远程服务器上传文件 get filename 从远程服务器往本地下载文件 mput file list 从本地往远程服务器批量上传文件 mget file list 从远程服务器往本地批量下载文件 prompt off 关闭文件提醒,在 mput 与 mget 时不会每操作一个文件就询问一次。 prompt on 开启文件提醒 dir 列出远程服务器上当前目录下的所有文件 cd dirname 切换本地主机上的目录到指定目录下 lcd dirname 切换远程服务器上的目录到指定目录下 quit 注销当前登陆
需要注意的是,上传和下载文件时的本地主机目录都是当前目录。如果用户希望上传或下载文件的目录为特定的目录,那么用户需要先将当前目录切换到指定目录后再进行上传或下载操作。
例子
下面是一些关于 ftp 操作的例子:
代码如下:
$ftp amrood.com
Connected to amrood.com.
220 amrood.com FTP server (Ver 4.9 Thu Sep 2 20:35:07 CDT 2009)
Name (amrood.com:amrood): amrood
331 Password required for amrood.
Password:
230 User amrood logged in.
ftp> dir
200 PORT command successful.
150 Opening data connection for /bin/ls.
total 1464
drwxr-sr-x 3 amrood group 1024 Mar 11 20:04 Mail
drwxr-sr-x 2 amrood group 1536 Mar 3 18:07 Misc
drwxr-sr-x 5 amrood group512 Dec 7 10:59 OldStuff
drwxr-sr-x 2 amrood group 1024 Mar 11 15:24 bin
drwxr-sr-x 5 amrood group 3072 Mar 13 16:10 mpl
-rw-r--r-- 1 amrood group 209671 Mar 15 10:57 myfile.out
drwxr-sr-x 3 amrood group512 Jan 5 13:32 public
drwxr-sr-x 3 amrood group512 Feb 10 10:17 pvm3
226 Transfer complete.
ftp> cd mpl
250 CWD command successful.
ftp> dir
200 PORT command successful.
150 Opening data connection for /bin/ls.
total 7320
-rw-r--r-- 1 amrood group 1630 Aug 8 1994 dboard.f
-rw-r----- 1 amrood group 4340 Jul 17 1994 vttest.c
-rwxr-xr-x 1 amrood group 525574 Feb 15 11:52 wave_shift
-rw-r--r-- 1 amrood group 1648 Aug 5 1994 wide.list
-rwxr-xr-x 1 amrood group 4019 Feb 14 16:26 fix.c
226 Transfer complete.
ftp> get wave_shift
200 PORT command successful.
150 Opening data connection for wave_shift (525574 bytes).
226 Transfer complete.
528454 bytes received in 1.296 seconds (398.1 Kbytes/s)
ftp> quit
221 Goodbye.
C:>telnet amrood.com
Trying...
Connected to amrood.com.
Escape character is '^]'.</p>
<p> login: amrood
amrood's Password:
*****************************************************
* *
* *
*WELCOME TO AMROOD.COM *
* *
* *
*****************************************************</p>
<p> Last unsuccessful login: Fri Mar 3 12:01:09 IST 2009
Last login: Wed Mar 8 18:33:27 IST 2009 on pts/10</p>
<p> { do your work }</p>
<p> $ logout
Connection closed.
$ finger
Login Name Tty Idle Login Time Office amrood pts/0 Jun 25 08:03 (62.61.164.115)
获取本地主机上指定有效用户的信息的例子如下:
代码如下:
$ finger amrood
Login: amrood Name: (null)
Directory: /home/amrood Shell: /bin/bash
On since Thu Jun 25 08:03 (MST) on pts/0 from 62.61.164.115
No mail.
No Plan.
检测远程服务器中所有登陆用户的信息的例子如下:
代码如下:
$ finger @avtar.com
Login Name Tty Idle Login Time Office
amrood pts/0 Jun 25 08:03 (62.61.164.115)
获取远程服务器上的指定有效用户信息的例子如下:
代码如下:
$ finger amrood@avtar.com
Login: amrood Name: (null)
Directory: /home/amrood Shell: /bin/bash
On since Thu Jun 25 08:03 (MST) on pts/0 from 62.61.164.115
No mail.
No Plan.