'Linux'에 해당되는 글 789건

  1. 2014.09.17 ps / top 차이점?
  2. 2014.09.17 rdate / ntp
  3. 2014.09.16 nice
  4. 2014.09.04 ctrl - alt - t 로 터미널 실행
  5. 2014.09.03 bash VI 모드 / Emacs 모드
  6. 2014.09.03 우분투에서 특정 패키지의 업데이트 금지하기
  7. 2014.09.01 bash 파일 상태 관련 if
  8. 2014.08.30 audit
  9. 2014.08.30 history - bash
  10. 2014.08.29 dd - disk duplicate
Linux2014. 9. 17. 14:01
ps로도 cpu 점유율을 볼 수 있지만
top보다 낮게 나오는 경향이 있어서 검색을 해보니

ps는 ps한 시점에 proc에서 검색한 cpu 사용량이고
top은 proc에서 일정 주기로 합산해서 cpu 사용율을 출력한다 한다.
[링크 : http://unix.stackexchange.com/questions/58539/top-and-ps-not-showing-the-same-cpu-result]
[링크 : http://linux.die.net/man/1/top
[링크 : http://linux.die.net/man/1/ps]  


특정 프로세스의 cpu 사용시간을 볼 경우 -o 옵션을 주면된다.
$ ps -o pid,comm,etime,time -p $PID
[링크 : http://serverfault.com/...linux-how-to-get-average-cpu-utilization-of-a-process-over-specified-period-of]


'Linux' 카테고리의 다른 글

avahi  (0) 2014.11.10
unknown filesystem type linux_raid_member / RAID 하드 마운트하기  (0) 2014.09.22
rdate / ntp  (0) 2014.09.17
nice  (0) 2014.09.16
bash VI 모드 / Emacs 모드  (0) 2014.09.03
Posted by 구차니
Linux2014. 9. 17. 10:44
ntp는 123
rdate 37 포트를 사용한다.

간혹 rdate가 안되는 경우도 있는 것 같으니
NTP를 추천하는 것 같기도..
[링크 : http://coffeenix.net/bbs/viewtopic.php?p=2123&sid=0d8c95c161ac6b4fb07617492784b47d]

[링크 : http://en.wikipedia.org/wiki/Time_Protocol]
[링크 : http://en.wikipedia.org/wiki/Network_Time_Protocol]

내부적으로는 rdate도 Time protocol을 이용해 시간을 받아오지만
rdate의 경우 시간을 받아오면 바로 설정해버려서 문제가 될 수도 있기에 ntp로의 이전을 추천한다고 한다.
[링크 : http://en.wikipedia.org/wiki/Rdate]

'Linux' 카테고리의 다른 글

unknown filesystem type linux_raid_member / RAID 하드 마운트하기  (0) 2014.09.22
ps / top 차이점?  (0) 2014.09.17
nice  (0) 2014.09.16
bash VI 모드 / Emacs 모드  (0) 2014.09.03
bash 파일 상태 관련 if  (0) 2014.09.01
Posted by 구차니
Linux2014. 9. 16. 08:51
nice 값을 늘릴때는
 # nice -5 command args

nice 값을 줄일때에는
 # nice -n -5 command args
[링크 : http://blog.nextcube.pe.kr/115]


man page를 봐도 먼가.. 직관적으로 와닫지 않는 설명 .. -_-a
Synopsis
nice [OPTION] [COMMAND [ARG]...]

Description
Run COMMAND with an adjusted niceness, which affects process scheduling. With no COMMAND, print the current niceness. Nicenesses range from -20 (most favorable scheduling) to 19 (least favorable).

-n, --adjustment=N
add integer N to the niceness (default 10)
--help
display this help and exit
--version
output version information and exit
 
[링크 : http://linux.die.net/man/1/nice

'Linux' 카테고리의 다른 글

ps / top 차이점?  (0) 2014.09.17
rdate / ntp  (0) 2014.09.17
bash VI 모드 / Emacs 모드  (0) 2014.09.03
bash 파일 상태 관련 if  (0) 2014.09.01
audit  (0) 2014.08.30
Posted by 구차니
Linux/Ubuntu2014. 9. 4. 09:22
회사 옮기고 첨 알은 단축키 ㄷㄷ
일단 metacity에서 단축키로 기본 등록이 된 것으로 보이는데..
Ubuntu 10.04 LTS 기준으로는
시스템 - 기본 설정 - 키보드 바로 가기에 설정이 존재한다.



[링크 : http://askubuntu.com/questions/133718/how-do-i-unbind-ctrl-alt-t]
Posted by 구차니
Linux2014. 9. 3. 11:04
$ set -o vi
를 사용하면 명령어 줄 에서 vi 처럼 편집이 가능한데
증상으로는 home 키를 누르거나 하면 대문자로 바뀐다 -_-
아무튼 home / end를 쓰기 위해서는
vi 모드를 해제해야 하는데
vi 모드의 반대(?)는 emcas 모드?!!?!?

$ set -o vi
$ set -o emacs

$ set -o
allexport       off
braceexpand     on
emacs           on
errexit         off
errtrace        off
functrace       off
hashall         on
histexpand      on
history         on
ignoreeof       off
interactive-comments    on
keyword         off
monitor         on
noclobber       off
noexec          off
noglob          off
nolog           off
notify          off
nounset         off
onecmd          off
physical        off
pipefail        off
posix           off
privileged      off
verbose         off
vi              off
xtrace          off
$ set -o
allexport       off
braceexpand     on
emacs           off
errexit         off
errtrace        off
functrace       off
hashall         on
histexpand      on
history         on
ignoreeof       off
interactive-comments    on
keyword         off
monitor         on
noclobber       off
noexec          off
noglob          off
nolog           off
notify          off
nounset         off
onecmd          off
physical        off
pipefail        off
posix           off
privileged      off
verbose         off
vi              on
xtrace          off

'Linux' 카테고리의 다른 글

rdate / ntp  (0) 2014.09.17
nice  (0) 2014.09.16
bash 파일 상태 관련 if  (0) 2014.09.01
audit  (0) 2014.08.30
history - bash  (0) 2014.08.30
Posted by 구차니
Linux/Ubuntu2014. 9. 3. 10:31
hold 라고 하는데.
ubuntu 10.04 LTS에서 찾아보니..

apt-mark로 처리가 가능한 것으로 보인다.
NAME
       apt-mark - mark/unmark a package as being automatically-installed

SYNOPSIS
       apt-mark [-hv] [-f=FILENAME] {markauto | unmarkauto} package...  | showauto

DESCRIPTION
       apt-mark will change whether a package has been marked as being automatically installed.

       When you request that a package is installed, and as a result other packages are installed
       to satisfy its dependencies, the dependencies are marked as being automatically installed.
       Once these automatically installed packages are no longer depended on by any manually
       installed packages, they will be removed by e.g.  apt-get or aptitude.

       markauto
           markauto is used to mark a package as being automatically installed, which will cause
           the package to be removed when no more manually installed packages depend on this
           package.

       unmarkauto
           unmarkauto is used to mark a package as being manually installed, which will prevent
           the package from being automatically removed if no other packages depend on it.

       showauto
           showauto is used to print a list of automatically installed packages with each package
           on a new line.
 

문제는..
apt-get에서 --ignore-hold 라는게 있다는 점 -_-a 
      --ignore-hold
           Ignore package Holds; This causes apt-get to ignore a hold placed on a package. This
           may be useful in conjunction with dist-upgrade to override a large number of undesired
           holds. Configuration Item: APT::Ignore-Hold.
 
[링크: http://askubuntu.com/questions/18654/how-to-prevent-updating-of-a-specific-package]

'Linux > Ubuntu' 카테고리의 다른 글

manpath  (0) 2014.12.07
ctrl - alt - t 로 터미널 실행  (0) 2014.09.04
Ubuntu 14.04 LTS desktop 64bit edition  (0) 2014.06.14
우분트 포트란 패키지  (4) 2014.06.13
우분투 설치된 패키지 목록 얻기  (0) 2014.05.24
Posted by 구차니
Linux2014. 9. 1. 15:59

PrimaryMeaning
-a FILE ] True if FILE exists.
-b FILE ] True if FILE exists and is a block-special file.
-c FILE ] True if FILE exists and is a character-special file.
-d FILE ] True if FILE exists and is a directory.
-e FILE ] True if FILE exists.
-f FILE ] True if FILE exists and is a regular file.
-g FILE ] True if FILE exists and its SGID bit is set.
-h FILE ] True if FILE exists and is a symbolic link.
-k FILE ] True if FILE exists and its sticky bit is set.
-p FILE ] True if FILE exists and is a named pipe (FIFO).
-r FILE ] True if FILE exists and is readable.
-s FILE ] True if FILE exists and has a size greater than zero.
-t FD ] True if file descriptor FD is open and refers to a terminal.
-u FILE ] True if FILE exists and its SUID (set user ID) bit is set.
-w FILE ] True if FILE exists and is writable.
-x FILE ] True if FILE exists and is executable.
-O FILE ] True if FILE exists and is owned by the effective user ID.
-G FILE ] True if FILE exists and is owned by the effective group ID.
-L FILE ] True if FILE exists and is a symbolic link.
-N FILE ] True if FILE exists and has been modified since it was last read.
-S FILE ] True if FILE exists and is a socket.
FILE1 -nt FILE2 ] True if FILE1 has been changed more recently than FILE2, or if FILE1 exists and FILE2 does not.
FILE1 -ot FILE2 ] True if FILE1 is older than FILE2, or is FILE2 exists and FILE1 does not.
FILE1 -ef FILE2 ] True if FILE1 and FILE2 refer to the same device and inode numbers.
-o OPTIONNAME ] True if shell option "OPTIONNAME" is enabled.
[ -z STRING ] True of the length if "STRING" is zero.
[ -n STRING ] or [ STRING ] True if the length of "STRING" is non-zero.
[ STRING1 == STRING2 ] True if the strings are equal. "=" may be used instead of "==" for strict POSIX compliance.
[ STRING1 != STRING2 ] True if the strings are not equal.
[ STRING1 < STRING2 ] True if "STRING1" sorts before "STRING2" lexicographically in the current locale.
[ STRING1 > STRING2 ] True if "STRING1" sorts after "STRING2" lexicographically in the current locale.
[ ARG1 OP ARG2 ] "OP" is one of -eq-ne-lt-le-gt or -ge. These arithmetic binary operators return true if "ARG1" is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to "ARG2", respectively. "ARG1" and "ARG2" are integers.

[링크 : http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html]
[링크 : https://linuxacademy.com/blog/linux/conditions-in-bash-scripting-if-statements/]

'Linux' 카테고리의 다른 글

nice  (0) 2014.09.16
bash VI 모드 / Emacs 모드  (0) 2014.09.03
audit  (0) 2014.08.30
history - bash  (0) 2014.08.30
dd - disk duplicate  (0) 2014.08.29
Posted by 구차니
Linux2014. 8. 30. 21:43
history 등으로 추적하기에는 힘들기 때문에
(만약에 외부에서 들어와서 해킹하면 history 삭제는 기본일테니?)
audit을 통해 사용자들의 명령어를 전부 기록하는 방법이 있다고 한다.

물론 보안적인 목적이 아니라면..
개인의 입력을 전부 녹화하는 거라
웬지 사용자 측면에서 찜찜할 수 밖에 없는지라
크게 권장할 만한 기술은 아닐것으로 보여진다.

[링크 : http://serverfault.com/questions/336217/how-do-i-log-every-command-executed-by-a-user]
[링크 : http://www.cyberciti.biz/tips/howto-log-user-activity-using-process-accounting.html]

'Linux' 카테고리의 다른 글

bash VI 모드 / Emacs 모드  (0) 2014.09.03
bash 파일 상태 관련 if  (0) 2014.09.01
history - bash  (0) 2014.08.30
dd - disk duplicate  (0) 2014.08.29
/etc/login.defs 로 암호 최소 길이 수정하기  (0) 2014.08.29
Posted by 구차니
Linux2014. 8. 30. 20:46
history는 지금까지 사용한 명령어의 목록을 보여주는 프로그램이다.
(정확하게는 쉘 명령어)
[링크 : http://linux.die.net/man/1/history] bash built-in command
[링크 : http://linux.die.net/man/3/history] library

typedef void * histdata_t;

typedef struct _hist_entry {
  char *line;
  char *timestamp;
  histdata_t data;
} HIST_ENTRY;

HIST_ENTRY ** the_history_list;

typedef struct _hist_state {
  HIST_ENTRY **entries; /* Pointer to the entries themselves. */
  int offset;           /* The location pointer within this array. */
  int length;           /* Number of elements within this array. */
  int size;             /* Number of slots allocated to this array. */
  int flags;
} HISTORY_STATE;

$HISTFILE에 history 내용이 저장되며
bash일 경우 ~/.bash_history 에 저장된다.

$HISTTIMEFORMAT을 통해 history 명령시 명령을 수행한 시간등을 같이 출력이 가능해진다.


개인사용자가 사용한 명령어를 보는데 있어서(사고 쳤을때 라던가?)
제한적이지만(히스토리 기능을 꺼버릴수도 있으니) 개별 사용자의 history를 추적하는것도 방법이긴 하나..
date 값 까지 출력하지 않으면 큰 의미가 없을 것으로 생각된다.

[링크 : http://stackoverflow.com/questions/8561983/retrieving-command-line-history]
[링크 : http://www.tecmint.com/history-command-examples/]
[링크 : http://www.cyberciti.biz/faq/unix-linux-bash-history-display-date-time/]


+
2019.02.14

export HISTTIMEFORMAT="%y/%m/%d %T " 

보기 편한(?) "년/월/일 시:분:초" 포맷으로 출력된다.



'Linux' 카테고리의 다른 글

bash 파일 상태 관련 if  (0) 2014.09.01
audit  (0) 2014.08.30
dd - disk duplicate  (0) 2014.08.29
/etc/login.defs 로 암호 최소 길이 수정하기  (0) 2014.08.29
mount - relatime / noatime  (0) 2014.08.28
Posted by 구차니
Linux2014. 8. 29. 15:47
일반적으로 파티션을 덤프하거나
파티션을 만들기 위해 파일을 생성하거나(가상 디스크 파일)
이럴때 사용하는 녀석인데..

ibs는 input block size(read) 기본 512
obs는 output block size(write) 기본 512
bs 는 ibs와 obs를 동시에 대체한다.

seek는 일종의 offset으로
obs * seek 부터 쓰기 시작하며
값이 설정되지 않았다면 기본값인 512byte를 점프하게 된다.

count는 몇번 반복하냐며
ibs * count 만큼의 용량으로 복사하게 된다.

bs=BYTES
    read and write BYTES bytes at a time (also see ibs=,obs=)
cbs=BYTES
    convert BYTES bytes at a time
conv=CONVS
    convert the file as per the comma separated symbol list
count=BLOCKS
    copy only BLOCKS input blocks
ibs=BYTES
    read BYTES bytes at a time (default: 512)
if=FILE
    read from FILE instead of stdin
iflag=FLAGS
    read as per the comma separated symbol list
obs=BYTES
    write BYTES bytes at a time (default: 512)
of=FILE
    write to FILE instead of stdout
oflag=FLAGS
    write as per the comma separated symbol list
seek=BLOCKS
    skip BLOCKS obs-sized blocks at start of output
[링크  : http://linux.die.net/man/1/dd

'Linux' 카테고리의 다른 글

audit  (0) 2014.08.30
history - bash  (0) 2014.08.30
/etc/login.defs 로 암호 최소 길이 수정하기  (0) 2014.08.29
mount - relatime / noatime  (0) 2014.08.28
linux shared object(so) tutorial  (0) 2014.06.30
Posted by 구차니