Linux Command skills, linux commands
[Oracle @ rh64 ~] $ Cat lgrw.txt cat: lgrw.txt: No such file or directory [oracle @ rh64 ~] $ ^ Rw ^ wrcat lgwr.txt 18:03:19. 703928 times ({tms_utime = 27, tms_stime = 18, tms_cutime = 0, tms_cstime = 0}) = 43367818618: 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 },...}) =. 364760 getrusage (RUSAGE_SELF, {ru_utime = {0, 278957}, ru_stime = {0, 184971 },...}) = 0
[Oracle @ rh64 ~] $ History -- 10-bash: history: --: invalid optionhistory: 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/data1mount/dev/mapper/vg0-lv1/data1 [oracle @ rh64 ~] $! : Gs/1/2 echo mount/dev/mapper/vg0-lv2/data2mount/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 ~] $! Catcat/etc/passwdroot: x: 0: 0: root:/bin/bashbin: x: 1: 1: bin:/sbin/nologindaemon: x: 2: 2: daemon:/sbin/nologinadm: x: 3: 4: adm:/var/adm:/sbin/nologin
!? Cat commands containing cat [oracle @ rh64 ~] $ !? Catcat/etc/passwdroot: x: 0: 0: root:/bin/bashbin: x: 1: 1: bin:/sbin/nologindaemon: 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.txta.txt [oracle @ rh64 ~] $! $: Ta.txt-bash: a.txt: command not found [oracle @ rh64 ~] $ Echo! $: Recho aa: e: select the extension [oracle @ rh64 ~] $ Echo abc.jpgabc.jpg [oracle @ rh64 ~] $ Echo! $: Eecho .jpg.jpg
: P print command line [oracle @ rh64 ~] $! E: pecho. jpg [oracle @ rh64 ~]
: S replace % echo this that %! : S/is/eecho the that usage: ^ is ^ e [oracle @ rh64 ~] $ Echo this thatthis that [oracle @ rh64 ~] $! : S/is/eecho the thatthe that [oracle @ rh64 ~] $ ^ Is ^ e-bash: s ^ is ^ e: substitution failed [oracle @ rh64 ~] $ Echo this thatthis that [oracle @ rh64 ~] $ ^ Is ^ eecho the thatthe that [oracle @ rh64 ~] $
: G for global replacement [oracle @ rh64 ~] $ Echo abcd abefabcd abef [oracle @ rh64 ~] $! : Gs/AB/cdecho cdcd cdefcdcd cdef [oracle @ rh64 ~] $
Deep dive-bash: man history
-Bash Reference Manual: https://www.gnu.org/software/bash/manual/html_node/index.html
-Book: Unix Power Tools
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.