Do DBA must learn, will not die 11 Linux basic commands

  
        

Most of the database runs on Linux and UNIX platforms. As the computing power of the X86 platform gradually approaches or exceeds that of minicomputers, and in the tide of going to IOE, the database environment running on the Linux platform is increasing.

The Linux system is large and complex. After summarizing it, as a DBA, some basic management, network management, advanced applications, performance diagnosis, pipeline complex applications, and hardware-related sensing commands need to be mastered. The article, specifically as a DBA, must learn 11 basic application commands.


1, ls command

Ls command is the most commonly used command in Linux, is the abbreviation of list, the default ls command is to list the current directory, If ls specifies a different directory, a list of files and folders in the specified directory is displayed.

Common usage (common parameters):

(1) ls –l

List files in long format (only one file or directory information is displayed per line) The details of the directory, the output is as follows:

[oracle@ol6-single single]$ ls -l

total 14091544

-rw-r----- 1 oracle oinstall 5368717312 Apr 10 10:50 sysaux02.dbf

-rw-r-----. 1 oracle oinstall 9061015552 Apr 10 08:05 users01.dbf

(2) Ls –a

List all the files and directories under the directory, the output is as follows:

[oracle@ol6-single single]$ ls -a

. Sysaux02.dbf users01.dbf

(3) ls –s

Lists the total size of the directory footprint, as well as the name of each file and its size (in KB). The output is as follows :

[oracle@ol6-single single]$ ls -s

total 14091544

5242892 sysaux02.dbf 8848652 users01.dbf

(4) Ls –lh< Br>

In long format (only one file or directory information is displayed per line), and display the total size of the file and directory in an intuitive form, the output is as follows:

[oracle@ol6-single single]$ Ls -lh

total 14G

-rw-r-----. 1 oracle oinstall 5.1G Apr 10 10:50 sysaux02.dbf

-rw-r -----. 1 oracle oinstall 8.5G Apr 10 08:05 users01.dbf

(5) ls –lrt

in long format (only one file or directory is displayed per line) Information), and sort the files and directories according to the most time, the output is as follows:

[oracle@ol6-single single]$ ls -lrt

total 14091544

-rw-r-----. 1 oracle oinstall 9061015552 Apr 10 08:05 users01.dbf

-rw-r-----. 1 oracle oinstall 5368717312 Apr 10 10:50 sysaux02.dbf

(6) ls –lrth

Compared with “ls –lrt”, the file size is displayed in a more intuitive way, the output is as follows:

[oracle@ol6-single single]$ ls -lrth

total 14G

-rw-r-----. 1 oracle oinstall 8.5G Apr 10 08:05 users01 .dbf

-rw-r-----. 1 oracle oinstall 5.1G Apr 10 10:50 sysaux02.dbf


2, pwd command

The pwd command is an abbreviation of Print Working Directory. The basic function is to print the current working directory.

Common usage (common parameters):

(1) pwd

Display the absolute path of the current directory, the output is as follows:

[oracle@ Ol6-single oradata]$pwd

/u01/oradata

(2) pwd -p

Displays the physical path of the directory currently in which it is located. Because some directories are the result of the link, the source path of the link can be displayed with -P, and the output is as follows:

oracle@ol6-single oradata]$ cd /etc/init.d

[oracle@ol6-single init.d]$ pwd

/etc/init.d

[oracle@ol6-single init.d]$ pwd -P

/etc/rc.d/init.d

3, cd command

The cd command is one of the most commonly used commands in Linux, used to switch directory paths

Usage (common parameters):

(1) cd

Go back to your HOME directory and output the following results:

[oracle@ol6-single init.d]$ Pwd

/etc/init.d

[oracle@ol6-single init.d]$ cd

[oracle@ol6-single ~]$ pwd

/home/oracle

(2) cd –

Return to the directory where you entered this directory. The output is as follows:

[oracle@ol6-single ~]$ pwd

/home/oracle

[oracle@ol6-single ~]$ cd /u01/oradata/single

[oracle@ol6-single single]$ pwd

/u01/oradata/single

[oracle@ol6-single single]$ cd -

/home/Oracle

[oracle@ol6-single ~]$ pwd

/home/oracle

(3) cd ..

Return to the previous level Directory, the output is as follows:

[oracle@ol6-single ~]$ pwd

/home/oracle

[oracle@ol6-single ~]$ cd ..

[oracle@ol6-single home]$ pwd

/home

(4) cd ../..

Return to the previous two levels The output is as follows:

[oracle@ol6-single single]$ pwd

/u01/oradata/single

[oracle@ol6-single single]$ cd . ./..

[oracle@ol6-single u01]$ pwd

/u01

Copyright © Windows knowledge All Rights Reserved