ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • HPUX - Shell Basic
    IoT 과정 2017. 6. 21. 11:36
    반응형

    $ ps

       PID TTY       TIME COMMAND

     12608 pts/tg    0:00 telnetd

     13471 pts/tg    0:00 ps

     12609 pts/tg    0:00 sh      <--- shell


    Alias : command line interpretor [ alias dir=ls, alias rm="rm -i", alias cp="cp -i", unalias dir ]

    {

    $ dir

    README.exrc     color3          funfile         mod5.dir        peach

    abcdefXlmnop    color4          funfile.123     myfile          prog1

    $ alias rm='rm -i'
    $ rm b*
    backup: ? (y/n)

    }

    File Name Completion : fra "ESC" "ESC" -> frankenstein

    command history : command "history"

    recalling commands : Press "ESC", k scrolls backward through the command history, scrolls forward through the command history [then, work as command mode]

    env : environment describes your session to the programs you run

    set : describes your local variables and environment variables

    setting Shell variables

    syntax : name=value

    $ color=red
    $ set
    ....
    color=red
    ....
    $ color=blue
    $ set
    ....
    color=blue
    ....
    }

    TERM variable : Describes your terminal type and screen size to the programs you run
    {
    $ env
    ...
    TERM=vt100    [terminal model, virtual terminal 100]
    ...
    $ TERM=yohan
    ....
    TERM=yohan
    ....
    command clear, vi won't work [screen oriented file won't work]
    }

    PATH variable : A list of directories where the shell will search for the commands you type
    {
    $ env
    ...
    PATH=/usr/bin/:/usr/bin/X11:/usr/contrib/bin:.
    ...
    $ ping 59.29.225.254
    sh: ping:  not found.
    $ whereis ping
    ping: /usr/sbin/ping /usr/share/man/man1m.Z/ping.1m
    $ /usr/sbin/ping 59.29.225.254
    PING 59.29.225.254: 64 byte packets
    64 bytes from 59.29.225.254: icmp_seq=0. time=12. ms
    64 bytes from 59.29.225.254: icmp_seq=1. time=0. ms
    64 bytes from 59.29.225.254: icmp_seq=2. time=0. ms
    64 bytes from 59.29.225.254: icmp_seq=3. time=0. ms
    ....
    }

    Common Variable Assignments

    OLDPWD=/tmp
    PWD=/home/user11
    PS1=
    HISTFILE=$HOME/.sh_history
    ...

    What Happens at Login?

    $ PS1='$PWD $ '
    /home/user11 $ 
    /home/user11 $ 
    /home/user11 $ exit
    write at process on memory

    during login process shell(= /usr/bin/sh) reads .profile configuration 
    $ vi .profile
    add PS1='$PWD $ '

    1 getty 1) display /etc/issue  2) login prompt "login :"

    2 login 1) id / password check 

    {

    $ more /etc/passwd 

    ....

    user10:It3J7kO99AKcc:310:301:student:/home/user10:/usr/bin/sh

    user11:JHzzLKLoXDPUs:311:301:student:/home/user11:/usr/bin/sh

    ....

    username:passwd:UID:GID:comment    :HOME directory :shell

    }

           2) 홈디렉토리 위치

           3) 쉘프로그램 실행

    3 /usr/bin/sh 1)read /etc/profile  (managed by root)

           2) $HOME/.profile (managed by owner, $home/.bash_prfile in Linux)  // export 사용시 자식쉘 생성시 참조

           3) $HOME/.shrc or /.kshrc , /.bashrc (managed by owner) // 자식쉘 생성 시 참조

    [ 1) -> 2) -> 3) 순서로 참조, 겹친 변수 설정들은 가장 최신으로 참조한 선언에 따른다.]

    {

    .shrc를 읽는 조건

    $ vi .profile

    add export ENV=$HOME/.shrc

    }


    where date : searches a list of directories for a command

    which date : 어디에 있는 파일(명령어)을 사용하는지 보여줌





    반응형

    'IoT 과정' 카테고리의 다른 글

    HPUX - File Name Generation  (0) 2017.06.21
    HPUX - Shell Advanced Features  (0) 2017.06.21
    HPUX - Shell Basic  (0) 2017.06.21
    HPUX - vi  (0) 2017.06.20
    HPUX - File Permissions and Access  (0) 2017.06.20
    HPUX - Navigating the File System, Managing Files  (0) 2017.06.19

    댓글 0

Designed by Tistory.