Search This Blog

Saturday, September 2, 2023

Linux for Oracle DBA

 786


Logging On Remotely via the Command Line

$ ssh -l oracle rmoug1

$ ssh -p 71 -l oracle rmoug1

$ telnet -l oracle dbsrver


Logging Off the Server

Pressing Ctrl+D
Typing exit
Typing logout

/etc/bashrc change the parameter TMOUT


Running a Command

df (disk free)

options, flags and switches

ls -a

also arguments

df -h /dev/sda2

The man pages are usually divided into ten sections. The man command will display the first
man page match it finds for a specified command. The following list shows the section number
and type of commands documented in each section:

1. User commands
2. System calls
3. Subroutines (library functions)
4. Devices
5. File formats
6. Games
7. Miscellaneous
8. System administration
9. Local
10. New

Sometimes a Linux utility will be documented in more than one man section. To view all man
documentation available for a tool, use the -f option (this is equivalent to running the whatis
command).

$ man -f cd

Sometimes DBAs are confused when they type man cd and are presented with the Bash
shell’s built-in documentation.  To view the man documentation specific to the cd utility, then
specify the 1p page:

$ man 1p cd

To scroll through all man sections associated with a command, use the -a option. When in
this mode, press the Q key to advance to the next man section of information.


CAPTURING MAN PAGES IN A TEXT FILE

$ man find >find.txt

$ man find | col -b >find.txt  (to avoid unreadable characters)

whatis pwd

The number (enclosed by parentheses) specifies the section of the man page where you can
find the command. When you see multiple lines listed by whatis, this indicates the command
is documented in more than one location in the man pages.

Another interesting use of the whatis command is to view a one-line description of
commands in the /bin directory. This example uses whatis with ls, xargs, and less to view,
one page at a time, the descriptions of all commands in the /bin directory:

$ cd /bin

$ ls | xargs whatis | less


Locating a Command

Use which or whereis to locate the executable binary file of a command.

$ which man
/usr/bin/man

while using man command options:

Keystroke                                                     Action

J, E, or down arrow                                      Move down one line.

K, Y, or up arrow                                         Move up one line.

Up arrow                                                     Move up one line.

Down arrow                                                 Move down one line.

/<string>                                                     Search for <string>.

N                                                                 Repeat the previous search forward.

Shift+N                                                         Repeat the previous search backward.

H                                                                 Display help page.

F, spacebar, or Page Down                         Move down one page.

B or Page Up                                             Move up one page.

Q                                                                 Exit man page.


$ man -f cd

$ man 1p cd

$ man -a cd

$ whatis pwd

whatis command is to view a one-line description of commands in the /bin directory:

$ cd /bin

$ ls | xargs whatis | less

The previous line of code will first list the files in the /bin directory; then, the output of that
is piped to the xargs command. The xargs command will take the output of ls and send it to
the whatis utility. The less command will display the output one page at a time. To exit from
the documentation (displayed by less), press the Q key (to quit).

The whatis command is identical to the man -f command

Locating a Command

Use which or whereis to locate the executable binary file of a command

[oracle@prod ~]$ which man
/usr/bin/man

following command displays the location of the echo command and its corresponding man documentation files:

[oracle@prod ~]$ whereis echo
echo: /bin/echo /usr/share/man/man1p/echo.1p.gz /usr/share/man/man3/echo.3x.gz /usr/share/man/man1/echo.1.gz

Getting the Version

[oracle@prod ~]$ who --version
who (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Joseph Arceneaux, David MacKenzie, and Michael Stone.

Showing Help
$ df --help

Finding Manual Page Documentation
if u remember the partial name of the utility you seek:
$ apropos find

The apropos command is equivalent to man -k.


Listing Extensive Documentation
$ info 
N to go to the next section
P to go to the previous section
Q to exit
where there is * go there and press enter key.
? list all commands
D return to introduction page
H go to the tutorial

$ info cpio

to view a tutorial on info :

$ info info 

Showing Available Commands

$ ls<Tab><Tab>
[oracle@prod ~]$ ls
ls           lsb_release  lslk         lsnrctl      lsof         lss16toppm
lsattr       lshal        lsnodes      lsnrctl0     lspgpot      lsscsi

You should hear a bell sound (sometimes called a beep) after you press the first Tab. After
pressing the second Tab, the Bash shell will attempt to find all commands that start with ls that
are located in any directories contained in the PATH variable.

Correcting Command-Line Mistakes


No comments:

Post a Comment