GGshow reloaded GGshow reloaded

December 1, 2012

Linux command – 1.3 – Viewing file

more – file perusal filter for crt viewing

View a file in terminal with ability to scroll down.

Usage:

more [-dlfpcsu] [-num] [+/pattern] [+linenum] [file ...]

Options:

-num
This option specifies an integer number which is the screen size (in lines).

-d
more will prompt the user with the message "[Press space to continue, 'q' to quit.]" and will display "[Press 'h' for instructions.]" instead of ringing the bell when an illegal key is pressed.

-l
more usually treats ^L (form feed) as a special character, and will pause after any line that contains a form feed. The -l option will prevent this behavior.

-f
Causes more to count logical, rather than screen lines (i.e., long lines are not folded).

-p
Do not scroll. Instead, clear the whole screen and then display the text. Notice that this option is switched on automatically if the executable is named page.

-c
Do not scroll. Instead, paint each screen from the top, clearing the remainder of each line as it is displayed.

-s
Squeeze multiple blank lines into one.

-u
Suppress underlining.

+/
The +/ option specifies a string that will be searched for before each file is displayed.

+num
Start at line number.

less – opposite of more

View a file in terminal with ability to scroll up and down.

Usage:

less -?
less --help
less -V
less --version
less [-[+]aABcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~] [-b space] [-h lines] [-j line] [-k keyfile] [-{oO} logfile] [-p pattern] [-P prompt] [-t tag] [-T tagsfile] [-x tab,...] [-y lines] [-[z] lines] [-# shift] [+[+]cmd] [--] [filename]...

Options:

-?, --help
This option displays a summary of the commands accepted by  less (the  same  as  the  h  command). (Depending on how your shell interprets the question mark, it may be necessary to  quote  the question mark, thus: "-?".)

-a, --search-skip-screen
Forward search skips current screen.

-A, --SEARCH-SKIP-SCREEN
Forward search always skips target line.

-b[N], --buffers=[N]
Number of buffers.

-B, --auto-buffers
Don't automatically allocate buffers for pipes.

-c, --clear-screen
Repaint by clearing rather than scrolling.

-d, --dumb
Dumb terminal.

-D[xn.n], --color=xn.n
Set screen colors. (MS-DOS only)

-e, -E, --quit-at-eof, --QUIT-AT-EOF
Quit at end of file.

-f, --force
Force open non-regular files.

-F, --quit-if-one-screen
Quit if entire file fits on first screen.

-g, --hilite-search
Highlight only last match for searches.

-G, --HILITE-SEARCH
Don't highlight any matches for searches.

-h [N], --max-back-scroll=[N]
Backward scroll limit.

-i, --ignore-case
Ignore case in searches that do not contain uppercase.

-I, --IGNORE-CASE
Ignore case in all searches.

-j [N], --jump-target=[N]
Screen position of target lines.

-J, --status-column
Display a status column at left edge of screen.

-k [file], --lesskey-file=[file]
Use a lesskey file.

-K, --quit-on-intr
Exit less in response to ctrl-C.

-L, --no-lessopen
Ignore the LESSOPEN environment variable.

-m, -M, --long-prompt, --LONG-PROMPT
Set prompt style.

-n, -N, --line-numbers, --LINE-NUMBERS
Don't use line numbers.

-o [file], --log-file=[file]
Copy to log file (standard input only).

-O [file], --LOG-FILE=[file]
Copy to log file (unconditionally overwrite).

-p [pattern], --pattern=[pattern]
Start at pattern (from command line).

-P [prompt], --prompt=[prompt]
Define new prompt.

-q, -Q, --quiet, --QUIET, --silent, --SILENT
Quiet the terminal bell.

-r, -R, --raw-control-chars, --RAW-CONTROL-CHARS
Output "raw" control characters.

-s, --squeeze-blank-lines
Squeeze multiple blank lines.

-S, --chop-long-lines
Chop long lines.

-t [tag], --tag=[tag]
Find a tag.

-T [tagsfile], --tag-file=[tagsfile]
Use an alternate tags file.

-u, -U, --underline-special, --UNDERLINE-SPECIAL
Change handling of backspaces.

-V, --version
Display the version number of "less".

-w, --hilite-unread
Highlight first new line after forward-screen.

-W, --HILITE-UNREAD
Highlight first new line after any forward movement.

-x [N[,...]], --tabs=[N[,...]]
Set tab stops.

-X, --no-init
Don't use termcap init/deinit strings.
 --no-keypad
 Don't use termcap keypad init/deinit strings.

-y[N], --max-forw-scroll=[N]
Forward scroll limit.

-z[N], --window=[N]
Set size of window.

-" [c[c]], --quotes=[c[c]]
Set shell quote characters.

-~, --tilde
Don't display tildes after end of file.

-# [N], --shift=[N]
Horizontal scroll amount (0 = one half screen width)

--no-keypad
Don't send keypad init/deinit sequence.

--follow-name
The F command changes files if the input file is renamed.

head – output the first part of files

Usage:

head [OPTION]… [FILE]…Options:

-c, --bytes=[-]K
print the first K bytes of each file; with the leading `-', print all but the last K bytes of each file

-n, --lines=[-]K
print the first K lines instead of the first 10; with the leading `-', print all but the last K lines of each file

-q, --quiet, --silent
never print headers giving file names

-v, --verbose
always print headers giving file names

--help
display this help and exit

--version
output version information and exit

K may have a multiplier suffix: b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024, GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.

tail – output the last part of files

Usage:

tail [OPTION]... [FILE]...

Options:

-c, --bytes=K
output the last K bytes; alternatively, use -c +K to output bytes starting with the Kth of each file

-f, --follow[={name|descriptor}]
output appended data as the file grows; -f, --follow, and --follow=descriptor are equivalent

-F
same as --follow=name --retry

-n, --lines=K
output the last K lines, instead of the last 10; or use -n +K to output lines starting with the Kth

--max-unchanged-stats=N
with --follow=name, reopen a FILE which has not changed size after N (default 5) iterations to see if it has been unlinked or renamed (this is the usual case of rotated log files). With inotify, this option is rarely useful.

--pid=PID
with -f, terminate after process ID, PID dies

-q, --quiet, --silent
never output headers giving file names

--retry
keep trying to open a file even when it is or becomes inaccessible; useful when following by name, i.e., with --follow=name

-s, --sleep-interval=N
with -f, sleep for approximately N seconds (default 1.0) between iterations. With inotify and --pid=P, check process P at least once every N seconds.

-v, --verbose
always output headers giving file names

pg – browse pagewise through text files

Usage:

pg [-number] [-p string] [-cefnrs] [+line] [+/pattern/] [file...]

Options:

-number
The number of lines per page. Usually, this is the number of CRT lines minus one.

-c
Clear the screen before a page is displayed, if the terminfo entry for the terminal provides this capability.

-e
Do not pause and display (EOF) at the end of a file.

-f
Do not split long lines.

-n
Without this option, commands must be terminated by a newline character. With this option, pg advances once a command letter is entered.

-p string
Instead of the normal prompt :, string is displayed. If string contains %d, its first occurrence is replaced by the number of the current page.

-r
Disallow the shell escape.

-s
Print messages in standout mode, if the terminfo entry for the terminal provides this capability.

+number
Start at the given line.

+/pattern/
Start at the line containing the Basic Regular Expression patâ tern given.
Filed under: Linux — Tags: , , , , , , — GG @ 3:55 pm

© 2024 GGSHOW | Powered by WordPress