=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                             UNIX GURU UNIVERSE
                                UNIX HOT TIP

                       Unix Tip 2330 - May 19, 2006

                   
http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

vi에서 파일간 복사하기

다음은 vi 편집기에서 필요한 수의 라인을 한 파일에서 다른 파일로 복사하는 방법이다.
먼저 원본 파일에서 다음의 키 조합을 사용하여라.

ESC키를 누른다.
Shift "(Shift 쌍따옴표)
a키를 누른다.
복사할 라인의 수를 누른다.
yy를 누른다.

이제 :(콜론)을 눌러 vi 프롬프트를 호출한다. 이 상태에서 e 대상파일명을 입력한다.
일단 대상파일이 열리면 복사한 라인들이 삽입될 라인으로 이동한다.

ESC키를 누른다.
Shift "(Shift 쌍따옴표)
a키를 누른다.
p키를 누른다.

라인이 복사되었다.

@@@@@@@@@@@@@@@@@@@@[ 원문 ]@@@@@@@@@@@@@@@@@@@@

VI COPY FILE TO FILE

Here is how to copy the required number
of lines from one file to another in
VI editor.  First use the following
key combinations in the source file.

Press ESCAPE
Press Shift "(Shift double quotes)
Press a
Press the number of lines you want to copy
press y followed by another y

Now press " : " (COLON) to get the vi prompt.
Hit e "Destination file name"
Once you enter the Destination file
go to the line where you want the lines
copied to be inserted.

Press ESCAPE.
Press SHIFT "(Double quotes).
Press a.
Press p.

The lines get copied.
반응형
Posted by She쥐포s

2007. 11. 3. 21:08 Unix

strings 명령어

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                             UNIX GURU UNIVERSE
                                UNIX HOT TIP

                       Unix Tip 2340 - May 29, 2006

                   
http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

strings

오브젝트 파일(바이너리 파일)의 내용을 확인하기 위해서 vi 또는 cat 명령을 사용할
수 없다, 그렇게 하기 위해 strings 명령을 사용하라.

%  strings [바이너리 파일명]

명령은 오브젝트 파일에 있는 모든 인쇄 가능한 문자를 화면에 출력할 것이다.
기본적으로 strings 명령은 실행파일의 ASCII 문자를 찾아 화면에 출력한다.
 
core 파일과 다른 바이너리 에러 파일에 유용하다.

@@@@@@@@@@@@@@@@@@@@[ 원문 ]@@@@@@@@@@@@@@@@@@@@

STRINGS - OLD BUT A GOODIE

To check content of an object
file(binary file ) we can't use vi
or cat command, for that use strings
command.

%  strings [name of binary file]

It will print all the printable strings
present in object file.  Basically
strings command looks for ASCII strings
in executable file and print it.

Great for core files and other binary
error files
 
This tip generously supported by: aggarami@pcsbom.patni.com
반응형
Posted by She쥐포s

2007. 11. 3. 21:06 Unix

at으로 매일 실행하기

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                             UNIX GURU UNIVERSE
                                UNIX HOT TIP

                       Unix Tip 2339 - May 28, 2006

                   
http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

at으로 매일 실행하기

유닉스는 지정된 시간에 따라 작업을 실행할 수 있는 "at"이라는 명령어를 제공한다.

특정한 작업을 매시간, 매일 실행하기 위해서는 매일 재귀적으로 실행될 수 있는
"at.sh"라는 파일에 다음의 명령어들을 사용하라.

########### CUT HERE ##################

#! /usr/bin/sh

# dt는 현재 날짜를 저장하는데 사용하는 변수

dt=`date | cut -c5-10`

# tm은 현재 시간을 저장하는데 사용하는 변수

tm=`date | cut -c12-13`

while [ $tm -le 23 ]
do

#
"at"은 명령어이고 -f는 특정파일을 실행하는데 사용하는 옵션이다.
# "file Name"은 실행가능한 파일이어야 한다.

    at -f  ./"file Name" $tm $dt
    tm=`expr $tm + 1`
done

#
인위적인 개입없이, 자동으로 다음날의 작업 스케줄을 변경한다.

at -f ./"File Name" 2358 $dt
dt=`expr $dt + 1`
at -f ./at.sh 0002 $dt

########### CUT HERE ##################
 
@@@@@@@@@@@@@@@@@@@@[ 원문 ]@@@@@@@@@@@@@@@@@@@@
 
RUN DAILY WITH AT

UNIX provides a command called "at" which can be used to run jobs according
to the specfied time.

To run a particular job in every hour, every day use the following set of
commands in a file called "at.sh" which will be executed recursively everyday.

########### CUT HERE ##################

#! /usr/bin/sh

# dt is a variable used to store current date

dt=`date | cut -c5-10`

# tm is a variable used to store current time

tm=`date | cut -c12-13`

while [ $tm -le 23 ]
do

# "at" is the command ad -f is the option used to execute a specified
# file. "file Name" should be an executable file.

 at -f  ./"file Name" $tm $dt
 tm=`expr $tm + 1`
done

# With out manual intervention, automatic change over to the next day's job
# scheduling

at -f ./"File Name" 2358 $dt
dt=`expr $dt + 1`
at -f ./at.sh 0002 $dt

########### CUT HERE ##################
반응형
Posted by She쥐포s

2007. 11. 3. 21:00 Unix

자동 단어 완성기능

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                             UNIX GURU UNIVERSE
                                UNIX HOT TIP
 
                       Unix Tip 2335 - May 24, 2006
 
                   http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
자동 단어 완성기능
 
tcsh에서 TAB키는 임의의 응용프로그램(예를 들면 pico, cd, rm, chown등)에 사용될
임의의 이름을 자동으로 완성해준다.(auto complete기능) 또한 root디렉토리(/)부터
절대 경로까지도 자동으로 완성해준다.
 
root(/)로부터 자신의 .cshrc 파일을 열고자 한다면..
 
"pico /ho"[TAB] -> "pico /home/"
계속해서 "you"[TAB] -> "yourusername"
결과적으로 "pico /home/yourusername/"를 얻을 수 있다.
다음으로 ".cs"[TAB] -> ".cshrc"를 얻을 수 있다.
결과적으로 "pico /home/yourusername/.cshrc"를 얻을 수 있다.
상당히 적은 수의 키스트로크로..
 
하지만 yourusername과 yourothername이라는 사용자가 있다고 해보자.
 
그러면 shell이 beep음을 낼 것이며 TAB키를 한번 더 입력하면 "your"로 시작하는
모든 파일 리스트를 보게 될 것이다.
이름이 다른부분에 커서가 위치하게 될 것이며 다른 부분을 입력하고 TAB을 입력하라.
 
이 팁은 명령어에도 작용한다.
 
※ 譯者 註: Linux의 Shell(보통 bash)에서는 기본적으로 지원하는 기능이다.
-------------------------------------------------------
 
AUTO WORD COMPLETION
 
In tcsh, the TAB key will automatically
complete any name in the current
directory for any application (for pico,
cd, rm, chown)... It will even complete
paths from root.
 
Soo... If you want to open your .cshrc
from root you do..
 
"pico /ho"[TAB] -> "pico /home/"
Then continue with "yuo"[tab] -> "yourusername"
Then you get "pico /home/yourusername/"
And then type ".cs"[TAB] -> ".cshrc"
So in the end you get "pico /home/yourusername/.cshrc"
In a lot less stokes...
 
But say there are 2 users called
yourusername and yourothername.
 
Well, then the shell will beep, and if
you hit TAB again, you will get a listing
off all the files that start with "you".
You can then continue to the point where
the names differ, and then hit TAB.
 
This also works for commands.
반응형
Posted by She쥐포s
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                             UNIX GURU UNIVERSE
                                UNIX HOT TIP

                       Unix Tip 2333 - May 22, 2006

                   
http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

GREP을 이용하여 빈줄 지우기

awk에 익숙하지 않지만 단순 아스키 파일에서 빈줄을 지우는 빠르고 쉬운 방법을
원하는 사람들은 'grep'과 결합하여 'cat'을 사용하는 것이 효과적인 방법이다.

cat file1 | grep -v '^$' >file2
mv -f file2 file1

----------------------------------------------------------------------

DELETING BLANK LINES USING GREP

For thos who are not familiar with
awk, but still want a quick and easy
way of removing blank lines from a
flat ascii file, remember that the
use of 'cat' in conjuction with
'grep' is just as effective.

cat file1 | grep -v '^$' >file2
mv -f file2 file1
반응형
Posted by She쥐포s
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                             UNIX GURU UNIVERSE
                                UNIX HOT TIP
 
                       Unix Tip 2332 - May 21, 2006
 
                   http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

데이터 영역 크기 제한하기
 
ulimit와 limit를 이용하여 "데이터 영역"의 크기를 제한할 수 있다.
 
ksh에서는:

$ ulimit -d KB단위크기
 
현재의 모든 리소스 제한을 보고 싶다면

$ ulimit -a
 
csh 또는 tcsh에서는:
$ limit datasize KB단위크기
 
현재의 모든 리소스 제한을 보고 싶다면
 
$ limit

예를 들자면:

$ ulimit -d 141073
$ ulimit -a

-----------------------------------------------------------
LIMIT THE SIZE OF DATA AREA
 
You can limit the size of "data area"
using ulimit and limit.

Under sh or ksh:
$ ulimit -d SIZE_IN_KB
 
Displays all current resource limits
$ ulimit -a

under csh or tcsh:
$ limit datasize SIZE_IN_KB
 
Displays all current resource limits
$ limit

For example:
$ ulimit -d 141073
$ ulimit -a
반응형
Posted by She쥐포s
PROBE-SCSI-ALL and IOSTAT
 
시스템이 온라인일때 모든 SCSI장비를 검색하려면 다음 명령을 실행하여
검색을 할 수 있다.
 
# iostat -En
 
이 팁은 SPARC 플랫폼상의 Solaris 2.6에서 사용할 수 있다.
 
---------------------------------------------------------------------
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                             UNIX GURU UNIVERSE
                                UNIX HOT TIP
 
                       Unix Tip 2331 - May 20, 2006
 
                   http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

PROBE-SCSI-ALL and IOSTAT
 
If you want to do probe-scsi-all
when the system is online, you
can do it by running the following
command:
 
# iostat -En
 
This is applicable for Solaris 2.6 on SPARC platform.
반응형
Posted by She쥐포s

2007. 11. 3. 20:47 Unix

여러파일 조작하기

여러 파일 조작하기
 
동시에 여러 파일에 대해 조작을 할 필요성을 느낀적이 있는가???
 
여기 그에 대한 해답(솔루션)이 있다.
 
예를 들어, 하나의 파일에 대해서 뿐만 아니라 일련의 파일에 대해서도
(grep을 이용하여) 문자를 찾고, awk 또는 펄스크립트등을 실행하는 등의
여러가지 작업을 수행할 필요가 있다면 unix 프롬프트상에서 다음의
명령어를 사용하라.
 
 $<: foreach i (<file_list>)
 ? echo $i
 ? grep <search_pattern> $i > tmp
 ? awk -f awk_script tmp >> report
 ? ....
 ? ....
 ? end
$<:
 
꺽쇄괄호안의 파일리스트는 다음의 두 종류가 올 수 있다.
 
* 특정한 이름을 지정
 
* 파일 이름의 목록을 포함하는 유닉스 변수. 예를 들면 "p"라는 변수는
다음에 보는 것처럼 "data"라는 문자로 시작하는 모든 파일을 지정할 수
있다.
 
   set p = (data*)
 
다른 예제를 들자면
 
   set g = `grep -l "Startpoint" * `
 
또는
 
   set all = *
(위의 내용은 현재 디렉토리의 모든 파일명을 "all"이라는 변수에 할당한다.
 
그리고 변수명을 "foreach"라는 명령어와 함께 사용한다면 다음과 같이
될 것이다.
 
$<:  foreach i ($all)
  .....
  .....
end
 
-----------------<원문>-------------------
OPERATING ON MULTIPLE FILES
 
Have you ever felt the need to perform a
set of operations on multiple files
simultaneously???
 
Here is a solution for that.
 
For instance, if it is required to perform
multiple operations like searching a string
(using grep), and executing an awk or perl
script etc, etc. on not just one file but a
set of files, use the following commands at
the unix prompt:
 
 $<: foreach i (<file_list>)
 ? echo $i
 ? grep <search_pattern> $i > tmp
 ? awk -f awk_script tmp >> report
 ? ....
 ? ....
 ? end
$<:
 
The files list in the brackets can be either
 
* Specifically mentioned
 
* A unix variable which contains a list of
file names.  For instance, the variable
"p" can be assigned all the files starting
with string "data" as follows:
   set p = (data*)
Other examples are:
   set g = `grep -l "Startpoint" * `
or
   set all = *
(This assigns all file names in the current
directory to the variable "all" )
 
And its usage with the "foreach" command will
be as follows:
 
$<:  foreach i ($all)
  .....
  .....
end
반응형
Posted by She쥐포s

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                             UNIX GURU UNIVERSE
                                UNIX HOT TIP

                       Unix Tip 2744 - July  8, 2007

                   
http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

출력결과 읽기

vi에서 다음을 입력하라:

:r !my_command

위 명령은 편집하고 있는 다음 라인에 입력한 명령의 출력결과가 입력될 것이다.

@@@@@@@@@@@@@@@[원문]@@@@@@@@@@@@@@@@

READ IN THE OUTPUT

While in VI, if you enter:

:r !my_command

Then you will insert the output of
the command you've entered on the
next line of the file that you're editing.

반응형
Posted by She쥐포s
이전버튼 1 2 3 4 5 이전버튼

블로그 이미지
She쥐포s
Yesterday
Today
Total

달력

 « |  » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

최근에 올라온 글

최근에 달린 댓글

글 보관함