字符界面

/etc/rc.d/

[root@mylinuxdbserver1 ~]# cd /etc/rc.d/

[root@mylinuxdbserver1 rc.d]# ll

total 112

drwxr-xr-x 2 root root  4096 Feb 15 03:32 init.d

-rwxr-xr-x 1 root root  2255 Mar  3  2008 rc

drwxr-xr-x 2 root root  4096 Apr 30  2010 rc0.d

drwxr-xr-x 2 root root  4096 Apr 30  2010 rc1.d

drwxr-xr-x 2 root root  4096 Feb 15 22:44 rc2.d

drwxr-xr-x 2 root root  4096 Feb 15 22:44 rc3.d

drwxr-xr-x 2 root root  4096 Feb 15 22:44 rc4.d

drwxr-xr-x 2 root root  4096 Feb 15 22:44 rc5.d

drwxr-xr-x 2 root root  4096 Apr 30  2010 rc6.d

-rwxr-xr-x 1 root root   276 Apr 30  2010 rc.local

-rwxr-xr-x 1 root root 26918 Mar  3  2008 rc.sysinit

[root@mylinuxdbserver1 rc.d]#

[root@mylinuxdbserver1 rc.d]# clear screen

 

/etc/inittab

[root@mylinuxdbserver1 rc.d]# vi /etc/inittab

#

# inittab       This file describes how the INIT process should set up

#               the system in a certain run-level.

#

# Author:       Miquel van Smoorenburg,

#               Modified for RHS Linux by Marc Ewing and Donnie Barnes

#

 

# Default runlevel. The runlevels used by RHS are:

#   0 - halt (Do NOT set initdefault to this)

#   1 - Single user mode

#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)

#   3 - Full multiuser mode

#   4 - unused

#   5 - X11

#   6 - reboot (Do NOT set initdefault to this)

#

id:5:initdefault:

 

# System initialization.

si::sysinit:/etc/rc.d/rc.sysinit

 

l0:0:wait:/etc/rc.d/rc 0

l1:1:wait:/etc/rc.d/rc 1

l2:2:wait:/etc/rc.d/rc 2

l3:3:wait:/etc/rc.d/rc 3

l4:4:wait:/etc/rc.d/rc 4

l5:5:wait:/etc/rc.d/rc 5

l6:6:wait:/etc/rc.d/rc 6

 

# Trap CTRL-ALT-DELETE

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

 

# When our UPS tells us power has failed, assume we have a few minutes

# of power left.  Schedule a shutdown for 2 minutes from now.

# This does, of course, assume you have powerd installed and your

# UPS connected and working correctly.

pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"

 

# If power was restored before the shutdown kicked in, cancel it.

pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"

 

runlevel

[root@mylinuxdbserver1 rc.d]# runlevel

N 5

[root@mylinuxdbserver1 rc.d]#

[root@mylinuxdbserver1 rc.d]# init 2

[root@mylinuxdbserver1 rc.d]# runlevel

5 2

[root@mylinuxdbserver1 rc.d]#

init重新启动

[root@mylinuxdbserver1 rc.d]# init 6

[root@mylinuxdbserver1 rc.d]#

init关闭系统

[root@mylinuxdbserver1 rc.d]# init 0

[root@mylinuxdbserver1 rc.d]#

shutdown

[root@mylinuxdbserver1 ~]# shutdown -r 90 "will shut down after 90 m"

 

Broadcast message from root (pts/4) (Sun Feb 15 23:02:10 2015):

 

will shut down after 90 m

The system is going DOWN for reboot in 90 minutes!

 

Halt关机

Reboot重启

man

[root@mylinuxdbserver1 ~]# ls /usr/share/man/

bg  de  es  fr.ISO8859-1  hu  it.ISO8859-1  ko     man1p  man2x  man3x  man5   man6x  man8   man9x  pl            pt     ru         sk  tr

cs  el  fi  fr.UTF-8      id  it.UTF-8      man0p  man1x  man3   man4   man5x  man7   man8x  mann   pl.ISO8859-2  pt_BR  ru.KOI8-R  sl  zh_CN

da  en  fr  hr            it  ja            man1   man2   man3p  man4x  man6   man7x  man9   nl     pl.UTF-8      ro     ru.UTF-8   sv  zh_TW

[root@mylinuxdbserver1 ~]#

[root@mylinuxdbserver1 ~]# man -f man

man                  (1)  - format and display the on-line manual pages

man                  (1p)  - display system documentation

man                  (7)  - macros to format man pages

man                 (rpm) - A set of documentation tools: man, apropos and whatis.

man-pages           (rpm) - Man (manual) pages from the Linux Documentation Project.

man.config [man]     (5)  - configuration data for man

 

 

[oracle@mylinuxdbserver1 ~]$ man rm

RM(1)                            User Commands                           RM(1)

 

NAME

       rm - remove files or directories

 

SYNOPSIS

       rm [OPTION]... FILE...

[oracle@mylinuxdbserver1 ~]$ man -f rm

rm                   (1)  - remove files or directories

rm                   (1p)  - remove directory entries

[oracle@mylinuxdbserver1 ~]$

 

--help

[root@mylinuxdbserver1 ~]# man --help

man, version 1.6d

 

usage: man [-adfhktwW] [section] [-M path] [-P pager] [-S list]

        [-m system] [-p string] name ...

 

  a : find all matching entries

  c : do not use cat file

  d : print gobs of debugging information

  D : as for -d, but also display the pages

  f : same as whatis(1)

  h : print this help message

  k : same as apropos(1)

  K : search for a string in all pages

  t : use troff to format pages for printing

  w : print location of man page(s) that would be displayed

      (if no name given: print directories that would be searched)

  W : as for -w, but display filenames only

 

  C file   : use `file' as configuration file

  M path   : set search path for manual pages to `path'

  P pager  : use program `pager' to display pages

  S list   : colon separated section list

  m system : search for alternate system's man pages

  p string : string tells which preprocessors to run

               e - [n]eqn(1)   p - pic(1)    t - tbl(1)

               g - grap(1)     r - refer(1)  v - vgrind(1)

[root@mylinuxdbserver1 ~]#

whereis

[root@mylinuxdbserver1 ~]# whereis ls

ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz

[root@mylinuxdbserver1 ~]#

which

[root@mylinuxdbserver1 ~]# which echo

/bin/echo

[root@mylinuxdbserver1 ~]# which ls

alias ls='ls --color=tty'

        /bin/ls

[root@mylinuxdbserver1 ~]#

 

命令记录

[db2inst1@mylinuxdbserver1 ~]$ whereis 光标db2cc

ctrl+k

[db2inst1@mylinuxdbserver1 ~]$ whereis 

ctrl+u

[db2inst1@mylinuxdbserver1 ~]$ db2cc

!$

[root@mylinuxdbserver1 ~]# mkdir /root/aaa

[root@mylinuxdbserver1 ~]# cd !$

cd /root/aaa

[root@mylinuxdbserver1 aaa]# pwd

/root/aaa

[root@mylinuxdbserver1 aaa]# rmdir /root/aaa/

[root@mylinuxdbserver1 aaa]#

快捷方式

[root@mylinuxdbserver1 aaa]# echo $HOME

/root

[root@mylinuxdbserver1 aaa]# cp /aa.txt ~/cc.txt

[root@mylinuxdbserver1 aaa]# ls /root/cc.txt

/root/cc.txt

[root@mylinuxdbserver1 aaa]#

;   &&

[root@mylinuxdbserver1 aaa]# ls -l /root; du -hs

total 68

-rw------- 1 root root  1355 Apr 29  2010 anaconda-ks.cfg

-rw-r--r-- 1 root root     4 Feb 16 04:55 bb.txt

-rw-r--r-- 1 root root     4 Feb 16 04:55 cc.txt

-rw-r--r-- 1 root root  2776 Apr 30  2010 db2expc.rsp

drwxr-xr-x 2 root root  4096 Apr 29  2010 Desktop

-rw-r--r-- 1 root root 31249 Apr 29  2010 install.log

-rw-r--r-- 1 root root  3502 Apr 29  2010 install.log.syslog

4.0K    .

[root@mylinuxdbserver1 aaa]#

[root@mylinuxdbserver1 aaa]# ls -l /root1 && du -hs

ls: /root1: No such file or directory

[root@mylinuxdbserver1 aaa]# ls -l /root1 ; du -hs

ls: /root1: No such file or directory

4.0K    .

[root@mylinuxdbserver1 aaa]#

$()  ``

[root@mylinuxdbserver1 aaa]# locate db2diag.log

/home/db2inst1/sqllib/db2dump/db2diag.log

[root@mylinuxdbserver1 aaa]# ll $(locate db2diag.log)

-rw-rw-rw- 1 db2inst1 db2iadm1 50540132 Feb 16 00:00 /home/db2inst1/sqllib/db2dump/db2diag.log

[root@mylinuxdbserver1 aaa]#

窗口一

[root@mylinuxdbserver1 aaa]# pidof sqlplus

 

[root@mylinuxdbserver1 aaa]# pidof sqlplus

22099

[root@mylinuxdbserver1 aaa]# kill 22099

[root@mylinuxdbserver1 aaa]#

窗口二

[oracle@mylinuxdbserver1 ~]$ sqlplus /nolog

 

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Feb 16 05:09:14 2015

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> Terminated

[oracle@mylinuxdbserver1 ~]$

窗口一

[root@mylinuxdbserver1 aaa]# kill `pidof sqlplus`

[root@mylinuxdbserver1 aaa]#

 

通配符*?

[root@mylinuxdbserver1 ~]# mkdir aaa

[root@mylinuxdbserver1 ~]# cd aaa

[root@mylinuxdbserver1 aaa]# touch a.bak

[root@mylinuxdbserver1 aaa]# touch c.bak

[root@mylinuxdbserver1 aaa]# ll

total 0

-rw-r--r-- 1 root root 0 Feb 16 05:16 a.bak

-rw-r--r-- 1 root root 0 Feb 16 05:16 c.bak

[root@mylinuxdbserver1 aaa]# rm *.bak

rm: remove regular empty file `a.bak'? y

rm: remove regular empty file `c.bak'? y

[root@mylinuxdbserver1 aaa]# ll

total 0

[root@mylinuxdbserver1 aaa]# touch a.bak

[root@mylinuxdbserver1 aaa]# touch a4b.bak

[root@mylinuxdbserver1 aaa]# rm --force *4*.bak

[root@mylinuxdbserver1 aaa]# ll

total 0

-rw-r--r-- 1 root root 0 Feb 16 05:17 a.bak

[root@mylinuxdbserver1 aaa]# touch ab.bak

[root@mylinuxdbserver1 aaa]# rm -f a?.bak

[root@mylinuxdbserver1 aaa]# ll

total 0

-rw-r--r-- 1 root root 0 Feb 16 05:17 a.bak

[root@mylinuxdbserver1 aaa]#

rm删除文件和目录

[root@mylinuxdbserver1 aaa]# rm -r adir

rm: remove directory `adir'? y

[root@mylinuxdbserver1 aaa]# mkdir adir

[root@mylinuxdbserver1 aaa]# mkdir adir/1

[root@mylinuxdbserver1 aaa]# touch adir/1/aa.txt

[root@mylinuxdbserver1 aaa]# rm -rf adir

[root@mylinuxdbserver1 aaa]#

find

[root@mylinuxdbserver1 aaa]# ll

total 0

-rw-r--r-- 1 root root 0 Feb 16 05:47 1a.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 1.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 22.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 2.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 a1.bak

-rw-r--r-- 1 root root 0 Feb 16 05:17 a.bak

[root@mylinuxdbserver1 aaa]# find . -name '[1-9]*' -print

./1.bak

./22.bak

./2.bak

./1a.bak

[root@mylinuxdbserver1 aaa]#

 

[root@mylinuxdbserver1 aaa]# find / -name aa.txt

/aa.txt

[root@mylinuxdbserver1 aaa]# ls `find / -name aa.txt`

/aa.txt

[root@mylinuxdbserver1 aaa]# ll `find / -name aa.txt`

-rw-r--r-- 1 root root 4 Feb 16 04:54 /aa.txt

[root@mylinuxdbserver1 aaa]# chmod 777 !$

chmod 777 `find / -name aa.txt`

[root@mylinuxdbserver1 aaa]# chmod 777 `find / -name aa.txt`

[root@mylinuxdbserver1 aaa]# ll `find / -name aa.txt`

-rwxrwxrwx 1 root root 4 Feb 16 04:54 /aa.txt

[root@mylinuxdbserver1 aaa]#

 

[root@mylinuxdbserver1 aaa]# find / -user root

[root@mylinuxdbserver1 aaa]# ll `find / -user mysql`

管道|

[root@mylinuxdbserver1 aaa]# ll `find / -user mysql`|grep mysql|more

find: /proc/25224/task/25224/fd/4: No such file or directory

find: /proc/25224/fd/4: No such file or directory

-rw-------  1 mysql mysql       451 May 13  2010 /var/lib/mysql/.bash_history

-rw-rw----  1 mysql mysql 111149056 Feb 15 22:57 /var/lib/mysql/ibdata1

-rw-rw----  1 mysql mysql   5242880 Feb 15 22:57 /var/lib/mysql/ib_logfile0

-rw-rw----  1 mysql mysql   5242880 Feb 15 22:57 /var/lib/mysql/ib_logfile1

-rw-------  1 mysql mysql        35 Apr 30  2010 /var/lib/mysql/.lesshst

-rw-rw----  1 mysql root       2226 Feb 15 22:57 /var/lib/mysql/mylinuxdbserver1.err

-rw-rw----  1 mysql mysql         5 Feb 15 22:57 /var/lib/mysql/mylinuxdbserver1.pid

-rw-rw----  1 mysql mysql      4330 Feb 15 22:24 /var/lib/mysql/mylinuxdbserver.err

-rw-rw----  1 mysql mysql    114015 May 23  2010 /var/lib/mysql/mylinuxdbserver.err-old

-rw-rw-rw-  1 mysql mysql     76107 May 23  2010 /var/lib/mysql/mysql1.log

-rw-------  1 mysql mysql      8820 Apr 30  2010 /var/lib/mysql/mysql/columns_priv.frm

-rw-------  1 mysql mysql         0 Apr 30  2010 /var/lib/mysql/mysql/columns_priv.MYD

-rw-------  1 mysql mysql      4096 Apr 30  2010 /var/lib/mysql/mysql/columns_priv.MYI

-rw-------  1 mysql mysql      9582 Apr 30  2010 /var/lib/mysql/mysql/db.frm

-rw-------  1 mysql mysql      1320 May 14  2010 /var/lib/mysql/mysql/db.MYD

-rw-------  1 mysql mysql      5120 May 14  2010 /var/lib/mysql/mysql/db.MYI

-rw-------  1 mysql mysql     10223 Apr 30  2010 /var/lib/mysql/mysql/event.frm

-rw-------  1 mysql mysql         0 Apr 30  2010 /var/lib/mysql/mysql/ndb_binlog_index.MYD

--More--

输出重定向>

[root@mylinuxdbserver1 aaa]# ll > ll.txt

[root@mylinuxdbserver1 aaa]# cat ll.txt

total 0

-rw-r--r-- 1 root root 0 Feb 16 05:47 1a.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 1.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 22.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 2.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 a1.bak

-rw-r--r-- 1 root root 0 Feb 16 05:17 a.bak

-rw-r--r-- 1 root root 0 Feb 16 06:34 ll.txt

[root@mylinuxdbserver1 aaa]#

输入重定向<

[root@mylinuxdbserver1 aaa]# cat < ll.txt

total 0

-rw-r--r-- 1 root root 0 Feb 16 05:47 1a.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 1.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 22.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 2.bak

-rw-r--r-- 1 root root 0 Feb 16 05:46 a1.bak

-rw-r--r-- 1 root root 0 Feb 16 05:17 a.bak

-rw-r--r-- 1 root root 0 Feb 16 06:34 ll.txt

 

错误重定向2>

[root@mylinuxdbserver1 aaa]# cat /root/kk > /root/bb

cat: /root/kk: No such file or directory

[root@mylinuxdbserver1 aaa]# cat /root/bb

[root@mylinuxdbserver1 aaa]# cat /root/kk 2> /root/bb

[root@mylinuxdbserver1 aaa]# cat /root/bb

cat: /root/kk: No such file or directory

[root@mylinuxdbserver1 aaa]#

追加重定向>>

[root@mylinuxdbserver1 aaa]# echo aaa >> /root/bb

[root@mylinuxdbserver1 aaa]# cat /root/bb

cat: /root/kk: No such file or directory

aaa

[root@mylinuxdbserver1 aaa]#

同时使用输出重定向和错误重定向&>

[root@mylinuxdbserver1 aaa]# ls /root &> /root/bb

[root@mylinuxdbserver1 aaa]# cat /root/bb

aaa

anaconda-ks.cfg

bb

bb.txt

cc.txt

db2expc.rsp

Desktop

install.log

install.log.syslog

[root@mylinuxdbserver1 aaa]# ls /nn &> /root/bb

[root@mylinuxdbserver1 aaa]# cat /root/bb

ls: /nn: No such file or directory

[root@mylinuxdbserver1 aaa]#

 

bash配置文件

[root@mylinuxdbserver1 ~]# ll .bash*

-rw------- 1 root root 13584 Feb 15 22:55 .bash_history

-rw-r--r-- 1 root root    24 Jul 13  2006 .bash_logout

-rw-r--r-- 1 root root   191 Jul 13  2006 .bash_profile

-rw-r--r-- 1 root root   176 Jul 13  2006 .bashrc

[root@mylinuxdbserver1 ~]#

 

.bashrc

[db2inst1@mylinuxdbserver1 ~]$ cat .bashrc

# .bashrc

 

# Source global definitions

if [ -f /etc/bashrc ]; then

        . /etc/bashrc

fi

 

# User specific aliases and functions

 

# The following three lines have been added by UDB DB2.

if [ -f /home/db2inst1/sqllib/db2profile ]; then

    . /home/db2inst1/sqllib/db2profile

fi

alias lldb2log='ll $(locate db2diag.log)'

 

[db2inst1@mylinuxdbserver1 ~]$

 

[db2inst1@mylinuxdbserver1 ~]$ lldb2log

-rw-rw-rw- 1 db2inst1 db2iadm1 50540132 Feb 16 00:00 /home/db2inst1/sqllib/db2dump/db2diag.log

[db2inst1@mylinuxdbserver1 ~]$ lldb2log

-rw-rw-rw- 1 db2inst1 db2iadm1 50540132 Feb 16 00:00 /home/db2inst1/sqllib/db2dump/db2diag.log

 

 

BASH PS1-PS4 提示符设置

Bash使用PS1~PS4来显示提示符号,其格式如下
\t :
现在时间。  
\d :
现在日期。  
\n :
新行。  
\s : shell
的名称。  
\w :
目前工作目录完整路径。  
\W :
目前工作目录。  
\u :
使用者名称。  
\h : Hostname
  
\# :
这个命令的号码。  
\! :
历史号码。  
\$ :
如果EUID0,则#,否则为$  
\\ : "\"
符号。
知道自己身在何处:
PS1="\n\e[1;37m[\e[m\e[1;32m
\u\e[m\e[1;33m@\e[m\e[1;35m\h\e[m \e[4m\`pwd\`\e[m\e[1;37m]\e[m\e[1;36m\n\e[m\\$ "
[root@localhost /root]
#  

 

Set命令

[db2inst1@mylinuxdbserver1 /opt/ibm]

$ set | grep PATH

CLASSPATH=/home/db2inst1/sqllib/java/db2java.zip:/home/db2inst1/sqllib/java/db2jcc.jar:/home/db2inst1/sqllib/java/sqlj.zip:/home/db2inst1/sqllib/function:/home/db2inst1/sqllib/java/db2jcc_license_cu.jar:.

LD_LIBRARY_PATH=/home/db2inst1/sqllib/lib32

PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc:/home/db2inst1/sqllib/db2tss/bin:/home/db2inst1/bin

 

[db2inst1@mylinuxdbserver1 /opt/ibm]

$

$PATH

[oracle@mylinuxdbserver1 ~]$ echo $PATH

/opt/ora10g/product/10.2.0/db_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin

[oracle@mylinuxdbserver1 ~]$ PATH=$PATH:/test/study/bin

[oracle@mylinuxdbserver1 ~]$ echo $PATH

/opt/ora10g/product/10.2.0/db_1/bin:/usr/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/test/study/bin

[oracle@mylinuxdbserver1 ~]$

.bash_profile

[oracle@mylinuxdbserver1 ~]$ vi .bash_profile

export PATH=$ORACLE_HOME/bin:$PATH:/testpath/bin

 

 

 

TTY

 

  在Linux中,TTY也许是跟终端有关系的最为混乱的术语。TTYTeleTYpe的一个老缩写。Teletypes,或者teletypewriters,原来指的是电传打字机,是通过串行线用打印机键盘通过阅读和发送信息的东西,和古老的电报机区别并不是很大。之后,当计算机只能以批处理方式运行时(当时穿孔卡片阅读器是唯一一种使程序载入运行的方式),电传打字机成为唯一能够被使用的“实时”输入/输出设备。最终,电传打字机被键盘和显示器终端所取代,但在终端或TTY接插的地方,操作系统仍然需要一个程序来监视串行端口。一个gettyGet TTY”的处理过程是:一个程序监视物理的TTY/终端接口。对一个虚拟网络服务器(VNC)来说,一个伪装的TTY(Pseudo-TTY,即假冒的TTY,也叫做“PTY)是等价的终端。当你运行一个xterm(终端仿真程序)GNOME终端程序时,PTY对虚拟的用户或者如xterm一样的伪终端来说,就像是一个TTY在运行。“Pseudo”的意思是“duplicating in a fake way(用伪造的方法复制),它相比“virtual”或“emulated”更能真实的说明问题。而在现在的计算中,它却处于被放弃的阶段。

  tty也是一个Unix命令,用来给出当前终端设备的名称。

 

 

alias

[root@mylinuxdbserver1 aaa]# alias lldb2log = 'll $(locate db2diag.log)'

-bash: alias: lldb2log: not found

-bash: alias: =: not found

-bash: alias: ll $(locate db2diag.log): not found

[root@mylinuxdbserver1 aaa]# alias lldb2log='ll $(locate db2diag.log)'

[root@mylinuxdbserver1 aaa]# lldb2log

-rw-rw-rw- 1 db2inst1 db2iadm1 50540132 Feb 16 00:00 /home/db2inst1/sqllib/db2dump/db2diag.log

[root@mylinuxdbserver1 aaa]#

 

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/95429/viewspace-668904/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/95429/viewspace-668904/

你可能感兴趣的:(字符界面)