Linux Command skills
[Oracle @ rh64 ~] $ Cat lgrw.txt cat: lgrw.txt: No such file or directory [oracle @ rh64 ~] $ ^ Rw ^ wr cat lgwr.txt 18:03:19. 703928 times ({tms_utime = 27, tms_stime = 18, tms_cutime = 0, tms_cstime = 0}) = 433678186 18:03:19. 704111 semtimedop (1900546, {15,-1, 0 }}, 1, {1, 660000000}) =-1 EAGAIN (Resource temporarily unavailable) 18:03:21. 364682 getrusage (RUSAGE_SELF, {ru_utime = {0, 278957}, ru_stime = {0, 184971 },...}) = 0 18:03:21. 364760 getrusage (RUSAGE_SELF, {ru_utime = {0, 278957}, ru_stime = {0, 184971 },...}) = 0
[Oracle @ rh64 ~] $ History -- 10-bash: history: --: invalid option history: usage: history [-c] [-d offset] [n] or history-anrw [filename] or history-ps arg [arg...] [oracle @ rh64 ~] $ ^ -- History 10 1002 ls-lte [oracle @ rh64 ~] $ Echo mount/dev/mapper/vg0-lv1/data1 mount/dev/mapper/vg0-lv1/data1 [oracle @ rh64 ~] $! : Gs/1/2 echo mount/dev/mapper/vg0-lv2/data2 mount/dev/mapper/vg0-lv2/data2 [oracle @ rh64 ~] $
Reference command line! [! | [?] String | [-] number]
: [N | x-y | ^ | $ | * | n * | %]: [h | t | r | e | p | s | g] ------- select word ---- modifier -----
!! --- Previous command! Cat commands starting with cat [oracle @ rh64 ~] $! Cat/etc/passwd root: x: 0: 0: root:/bin/bash bin: x: 1: 1: bin:/bin: /sbin/nologin daemon: x: 2: 2: daemon:/sbin/nologin adm: x: 3: 4: adm:/var/adm:/sbin/nologin
!? Cat commands containing cat [oracle @ rh64 ~] $ !? Cat/etc/passwd root: x: 0: 0: root:/bin/bash bin: x: 1: 1: bin:/bin: /sbin/nologin daemon: x: 2: 2: daemon:/sbin/nolog
! N nth command! -N penultimate n commands
! $ The last digit of the previous command
! ^ First place of the previous command
! : N the nth bit of the previous command
! : X-y
! : N * last n to last
! * All parameters above
: H: select the beginning of the path
: T select the end of the path
: R select the file name [oracle @ rh64 ~] $ Echo a.txt [oracle @ rh64 ~] $! $: T a.txt-bash: a.txt: command not found [oracle @ rh64 ~] $ Echo! $: R echo a: e: select the extension [oracle @ rh64 ~] $ Echo abc.jpg [oracle @ rh64 ~] $ Echo! $: E echo. jpg. jpg
: P print command line [oracle @ rh64 ~] $! E: p echo. jpg [oracle @ rh64 ~]
: S replace % echo this that %! : S/is/e echo the that usage: ^ is ^ e [oracle @ rh64 ~] $ Echo this that [oracle @ rh64 ~] $! : S/is/e echo the that the [oracle @ rh64 ~] $ ^ Is ^ e-bash: s ^ is ^ e: substitution failed [oracle @ rh64 ~] $ Echo this that [oracle @ rh64 ~] $ ^ Is ^ e echo the that [oracle @ rh64 ~] $
: G for global replacement [oracle @ rh64 ~] $ Echo abcd abef [oracle @ rh64 ~] $! : Gs/AB/cd echo cdcd cdef [oracle @ rh64 ~] $