From e9e3a1ab1fb5cad58704a28dc528be8c075d32d8 Mon Sep 17 00:00:00 2001 From: Joel Dahl Date: Fri, 15 Mar 2013 20:12:54 +0000 Subject: [PATCH] Add a few examples. Obtained from: OpenBSD --- bin/cp/cp.1 | 23 ++++++++++++++++++++++- bin/ls/ls.1 | 20 +++++++++++++++++++- bin/mkdir/mkdir.1 | 19 ++++++++++++++++++- bin/mv/mv.1 | 12 +++++++++++- bin/ps/ps.1 | 6 +++++- bin/rm/rm.1 | 15 ++++++++++++++- bin/rmdir/rmdir.1 | 14 +++++++++++++- 7 files changed, 102 insertions(+), 7 deletions(-) diff --git a/bin/cp/cp.1 b/bin/cp/cp.1 index 8c014b437e51..169f350cc0bc 100644 --- a/bin/cp/cp.1 +++ b/bin/cp/cp.1 @@ -32,7 +32,7 @@ .\" @(#)cp.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd September 4, 2012 +.Dd March 15, 2013 .Dt CP 1 .Os .Sh NAME @@ -251,6 +251,27 @@ signal, the current input and output file and the percentage complete will be written to the standard output. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Make a copy of file +.Pa foo +named +.Pa bar : +.Pp +.Dl $ cp foo bar +.Pp +Copy a group of files to the +.Pa /tmp +directory: +.Pp +.Dl $ cp *.txt /tmp +.Pp +Copy the directory +.Pa junk +and all of its contents (including any subdirectories) to the +.Pa /tmp +directory: +.Pp +.Dl $ cp -R junk /tmp .Sh COMPATIBILITY Historic versions of the .Nm diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index aa4fc1860d1d..7c7265225e01 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -32,7 +32,7 @@ .\" @(#)ls.1 8.7 (Berkeley) 7/29/94 .\" $FreeBSD$ .\" -.Dd November 8, 2012 +.Dd March 15, 2013 .Dt LS 1 .Os .Sh NAME @@ -718,6 +718,24 @@ for more information. .El .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +List the contents of the current working directory in long format: +.Pp +.Dl $ ls -l +.Pp +In addition to listing the contents of the current working directory in +long format, show inode numbers, file flags (see +.Xr chflags 1 ) , +and suffix each filename with a symbol representing its file type: +.Pp +.Dl $ ls -lioF +.Pp +List the files in +.Pa /var/log , +sorting the output such that the mostly recently modified entries are +printed first: +.Pp +.Dl $ ls -lt /var/log .Sh COMPATIBILITY The group field is now automatically included in the long listing for files in order to be compatible with the diff --git a/bin/mkdir/mkdir.1 b/bin/mkdir/mkdir.1 index 0f8d812f1da9..d702348beb7b 100644 --- a/bin/mkdir/mkdir.1 +++ b/bin/mkdir/mkdir.1 @@ -32,7 +32,7 @@ .\" @(#)mkdir.1 8.2 (Berkeley) 1/25/94 .\" $FreeBSD$ .\" -.Dd January 25, 1994 +.Dd March 15, 2013 .Dt MKDIR 1 .Os .Sh NAME @@ -87,6 +87,23 @@ Be verbose when creating directories, listing them as they are created. The user must have write permission in the parent directory. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Create a directory named +.Pa foobar : +.Pp +.Dl $ mkdir foobar +.Pp +Create a directory named +.Pa foobar +and set its file mode to 700: +.Pp +.Dl $ mkdir -m 700 foobar +.Pp +Create a directory named +.Pa cow/horse/monkey , +creating any non-existent intermediate directories as necessary: +.Pp +.Dl $ mkdir -p cow/horse/monkey .Sh COMPATIBILITY The .Fl v diff --git a/bin/mv/mv.1 b/bin/mv/mv.1 index 5199f27bc068..298dbf93e850 100644 --- a/bin/mv/mv.1 +++ b/bin/mv/mv.1 @@ -32,7 +32,7 @@ .\" @(#)mv.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd August 28, 2012 +.Dd March 15, 2013 .Dt MV 1 .Os .Sh NAME @@ -155,6 +155,16 @@ rm -rf source_file .Ed .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Rename file +.Pa foo +to +.Pa bar , +overwriting +.Pa bar +if it already exists: +.Pp +.Dl $ mv -f foo bar .Sh COMPATIBILITY The .Fl h , diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index 7f6913780842..1a364f5f752c 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd February 7, 2013 +.Dd March 15, 2013 .Dt PS 1 .Os .Sh NAME @@ -689,6 +689,10 @@ attempts to automatically determine the terminal width. .It Pa /boot/kernel/kernel default system namelist .El +.Sh EXAMPLES +Display information on all system processes: +.Pp +.Dl $ ps -auxw .Sh SEE ALSO .Xr kill 1 , .Xr pgrep 1 , diff --git a/bin/rm/rm.1 b/bin/rm/rm.1 index ad8106617aca..3588f388da71 100644 --- a/bin/rm/rm.1 +++ b/bin/rm/rm.1 @@ -32,7 +32,7 @@ .\" @(#)rm.1 8.5 (Berkeley) 12/5/94 .\" $FreeBSD$ .\" -.Dd October 31, 2010 +.Dd March 15, 2013 .Dt RM 1 .Os .Sh NAME @@ -193,6 +193,19 @@ When is specified with .Fl f the file will be overwritten and removed even if it has hard links. +.Sh EXAMPLES +Recursively remove all files contained within the +.Pa foobar +directory hierarchy: +.Pp +.Dl $ rm -rf foobar +.Pp +Either of these commands will remove the file +.Pa -f : +.Bd -literal -offset indent +$ rm -- -f +$ rm ./-f +.Ed .Sh COMPATIBILITY The .Nm diff --git a/bin/rmdir/rmdir.1 b/bin/rmdir/rmdir.1 index 688d1445e8ef..ededd43e9bde 100644 --- a/bin/rmdir/rmdir.1 +++ b/bin/rmdir/rmdir.1 @@ -32,7 +32,7 @@ .\" @(#)rmdir.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd March 21, 2004 +.Dd March 15, 2013 .Dt RMDIR 1 .Os .Sh NAME @@ -86,6 +86,18 @@ successfully. .It Li >0 An error occurred. .El +.Sh EXAMPLES +Remove the directory +.Pa foobar , +if it is empty: +.Pp +.Dl $ rmdir foobar +.Pp +Remove all directories up to and including +.Pa cow , +stopping at the first non-empty directory (if any): +.Pp +.Dl $ rmdir -p cow/horse/monkey .Sh SEE ALSO .Xr rm 1 .Sh STANDARDS