[AIX 운영 체제와 장치 관리 12] 명령 — 구문·플래그·매개변수, 사용법 표기, whereis·man·whatis, history·r·fc, alias, 국제 문자 텍스트 서식, cal·calendar·factor·apropos

핵심 정리

  • 명령 형식은 CommandName flag(s) parameter(s)이며 대소문자를 가립니다. 세미콜론으로 한 줄에 여러 명령을, 백슬래시로 한 명령을 여러 줄에 씁니다. 대시로 시작하는 매개변수 앞에는 --를 둡니다.
  • 사용법 표기에서 대괄호는 선택, 중괄호는 필수, 세로 막대는 하나만 고름, 줄임표는 반복, 대시는 표준 입력을 뜻합니다.
  • Korn 셸의 history는 마지막 16개 명령을 보여 주고($HOME/.sh_history), r로 다시 실행하며 r old=new 번호로 첫 번째 일치만 바꿔 실행하고, fc로 편집기(FCEDIT, 기본 /usr/bin/ed)에서 고쳐 실행합니다.
  • whatis와 apropos는 catman -w로 만든 /usr/share/man/whatis 데이터베이스를 쓰며 각각 man -f, man -k와 같습니다.
  • 서식 명령은 유럽 확장 단일 바이트 문자를 지원하고 별표 붙은 명령은 멀티바이트 언어도 처리합니다. 직접 입력할 수 없으면 \[N] 16진 코드 형식을 씁니다.
항목 내용
버전 AIX 6.1 (5.3판과 거의 같음)
원문 Operating system and device management — 5.3판 317328쪽, 6.1판 122133쪽
관련 명령어 ls, mkdir, shutdown, whereis, man, whatis, catman -w, history, r, fc, alias, cal, calendar, factor, apropos
관련 파일 $HOME/.sh_history, /usr/include/sys/limits.h, /usr/share/man/whatis, $HOME/calendar

어떤 명령은 단어 하나만 입력해 실행할 수 있습니다. 한 명령의 출력이 다른 명령의 입력이 되도록 명령을 결합할 수도 있습니다.

한 명령의 출력이 다른 명령의 입력이 되도록 명령을 결합하는 것을 파이프라고 합니다.

플래그는 명령의 동작을 더 자세히 정합니다. 플래그는 명령행에서 명령 이름과 함께 쓰는 수정자이며 보통 앞에 대시가 붙습니다.

명령을 묶어 파일에 저장할 수도 있습니다. 이런 파일을 셸 프로시저나 셸 스크립트라고 합니다. 명령을 하나하나 실행하는 대신 명령이 든 파일을 실행합니다.

명령을 입력하려면 프롬프트에서 명령 이름을 입력하고 Enter를 누릅니다.

text
$ CommandName

관련 개념

  • 셸 기능 — 셸을 시스템 인터페이스로 쓰면 여러 이점이 있습니다.

관련 작업

  • 셸 스크립트 만들기와 실행 — 셸 스크립트는 명령이 하나 이상 든 파일입니다. 셸 스크립트를 쓰면 지루한 명령, 크거나 복잡한 명령 순서, 일상 작업을 쉽게 할 수 있습니다. 셸 스크립트 파일 이름을 입력하면 시스템이 파일에 든 명령 순서를 실행합니다.

명령 구문과 명령 이름

어떤 명령은 단어 하나만 입력해 실행할 수 있지만, 다른 명령은 플래그와 매개변수를 씁니다. 명령마다 필수와 선택 플래그·매개변수를 지정하는 구문이 있습니다.

명령의 일반 형식은 다음과 같습니다.

text
CommandName flag(s) parameter(s)

명령에 관한 일반 규칙은 다음과 같습니다.

  • 명령, 플래그, 매개변수 사이의 공백은 의미가 있습니다.
  • 명령을 세미콜론(;)으로 구분하면 두 명령을 한 줄에 입력할 수 있습니다. 예:
text
$ CommandOne ; CommandTwo

셸은 명령을 차례로 실행합니다.

  • 명령은 대소문자를 가립니다. 셸은 대문자와 소문자를 구분합니다. 셸에게 print는 PRINT나 Print와 같지 않습니다.
  • 아주 긴 명령은 백슬래시(\) 문자로 여러 줄에 걸쳐 입력할 수 있습니다. 백슬래시는 셸에게 줄이 이어진다는 뜻입니다. 다음 예는 두 줄에 걸친 명령 하나입니다.
text
$ ls Mail info temp \
(press Enter)
> diary
(the > prompt appears)

> 문자는 보조 프롬프트($는 root가 아닌 사용자의 기본 1차 프롬프트)로, 현재 줄이 앞 줄의 연속임을 나타냅니다. csh(C 셸)는 보조 프롬프트를 보여 주지 않으며, 줄은 단어 경계에서 끊어야 하고, 1차 프롬프트는 %입니다.

모든 명령의 첫 단어는 명령 이름입니다. 명령 이름만 있는 명령도 있습니다.

명령 플래그

명령 이름 뒤에 플래그가 여러 개 올 수 있습니다. 플래그는 명령의 동작을 바꾸며 옵션이라고도 합니다.

플래그는 공백이나 탭으로 구분하며 보통 대시(-)로 시작합니다. 예외로 ps, tar, ar는 일부 플래그 앞에 대시가 필요 없습니다. 예를 들어 다음 명령에서

text
ls -a -F

ls는 명령 이름이고 -a -F는 플래그입니다.

명령에 플래그를 쓰면 명령 이름 바로 뒤에 옵니다. 한 글자 플래그는 대시 하나로 합칠 수 있습니다. 예를 들어 앞 명령은 다음처럼 쓸 수도 있습니다.

text
ls -aF

매개변수가 실제로 대시(-)로 시작하는 경우가 있습니다. 이때는 매개변수 앞에 구분자 대시 두 개(--)를 씁니다. --는 그 뒤가 플래그가 아니라 매개변수라고 명령에 알립니다.

예를 들어 -tmp라는 디렉터리를 만들려고 다음 명령을 입력하면

text
mkdir -tmp

시스템은 다음과 비슷한 오류 메시지를 보여 줍니다.

text
mkdir: Not a recognized flag: t
Usage: mkdir [-p] [-m mode] Directory ...

올바른 입력 방법은 다음과 같습니다.

text
mkdir -- -tmp

이제 새 디렉터리 -tmp가 만들어졌습니다.

명령 매개변수

명령 이름 뒤에 플래그가 여러 개 오고, 그 뒤에 매개변수가 올 수 있습니다. 매개변수는 인수나 피연산자라고도 합니다. 매개변수는 명령이 실행하는 데 필요한 정보를 지정합니다.

매개변수를 지정하지 않으면 명령은 기본값을 쓸 수 있습니다. 예를 들어 다음 명령에서

text
ls -a temp

ls는 명령 이름, -a는 플래그, temp는 매개변수입니다. 이 명령은 temp 디렉터리의 모든(-a) 파일을 보여 줍니다.

다음 예에서는

text
ls -a

매개변수가 없으므로 기본값은 현재 디렉터리입니다.

다음 예에서는

text
ls temp mail

플래그가 없고 temp와 mail이 매개변수입니다. 이 경우 temp와 mail은 서로 다른 디렉터리 이름입니다. ls 명령은 두 디렉터리의 숨김 파일을 뺀 모든 파일을 보여 줍니다.

매개변수나 옵션 인수가 숫자 값이거나 숫자 값을 담고 있으면, 따로 지정하지 않는 한 숫자는 십진 정수로 해석합니다. /usr/include/sys/limits.h 파일에 정의된 0부터 INT_MAX까지의 숫자를 구문상 숫자 값으로 인식합니다.

쓰려는 명령이 음수를 매개변수나 옵션 인수로 받으면 /usr/include/sys/limits.h 파일에 정의된 INT_MIN부터 INT_MAX까지의 숫자를 쓸 수 있습니다. 그렇다고 이 범위의 모든 숫자가 의미상 올바른 것은 아닙니다. 일부 인쇄 명령처럼 더 좁은 범위만 허용하는 명령도 있습니다. 오류가 나면 오류 메시지는 명령 구문이 틀렸다는 것이 아니라 값이 지원 범위를 벗어났다고 알려 줍니다.

사용법 표기

사용법 표기는 명령 구문을 나타내는 방법으로, 대괄호([ ]), 중괄호({ }), 세로 막대(|) 같은 기호로 이루어집니다.

다음은 unget 명령의 사용법 표기 예입니다.

unget [ -rSID ] [ -s ] [ -n ] File ...

명령 사용법 표기에는 다음 규칙을 씁니다.

  • 명령행에 그대로 입력해야 하는 항목은 굵게 씁니다. 명령 이름, 플래그, 리터럴 문자가 여기에 듭니다.
  • 이름으로 바꿔야 하는 변수를 나타내는 항목은 기울임꼴로 씁니다. 플래그 뒤의 매개변수와 Files, Directories처럼 명령이 읽는 매개변수가 여기에 듭니다.
  • 대괄호로 감싼 매개변수는 선택입니다.
  • 중괄호로 감싼 매개변수는 필수입니다.
  • 대괄호나 중괄호로 감싸지 않은 매개변수는 필수입니다.
  • 세로 막대는 매개변수를 하나만 고른다는 뜻입니다. 예를 들어 [ a | b ]는 a나 b를 고르거나 아무것도 고르지 않을 수 있다는 뜻입니다. 마찬가지로 { a | b }는 a나 b 가운데 하나를 꼭 골라야 한다는 뜻입니다.
  • 줄임표(...)는 매개변수를 명령행에서 반복할 수 있다는 뜻입니다.
  • 대시(-)는 표준 입력을 나타냅니다.

shutdown 명령

root 사용자 권한이 있으면 shutdown 명령으로 시스템을 멈출 수 있습니다. shutdown 명령을 쓸 권한이 없으면 운영 체제에서 로그아웃만 하고 시스템은 실행 중인 채로 둡니다.

주의: 먼저 시스템을 종료하지 않고 전원을 끄지 마십시오. 시스템 전원을 끄면 시스템에서 실행 중인 모든 프로세스가 끝납니다. 다른 사용자가 시스템에서 작업 중이거나 백그라운드에서 작업이 실행 중이면 데이터를 잃을 수 있습니다. 시스템을 멈추기 전에 알맞은 종료 절차를 따르십시오.

프롬프트에서 다음을 입력합니다.

text
shutdown

shutdown 명령이 끝나고 운영 체제가 멈추면 다음 메시지가 나옵니다.

text
....Shutdown completed....

전체 구문은 shutdown 명령을 봅니다.

다른 명령이나 프로그램 찾기(whereis 명령)

whereis 명령은 지정한 파일의 소스, 바이너리, 매뉴얼 섹션을 찾습니다. 이 명령은 표준 위치 목록에서 원하는 프로그램을 찾으려고 합니다.

다음 예를 봅니다.

  • 현재 디렉터리에서 문서가 없는 파일을 찾으려면 다음을 입력합니다.
text
whereis -m -u *
  • 이름에 Mail이 든 모든 파일을 찾으려면 다음을 입력합니다.
text
whereis Mail

시스템은 다음과 비슷한 정보를 보여 줍니다.

text
Mail: /usr/bin/Mail /usr/lib/Mail.rc

전체 구문은 Commands Reference, Volume 6의 whereis 명령을 봅니다.

명령 정보 보기(man 명령)

man 명령은 명령, 서브루틴, 파일에 관한 정보를 보여 줍니다.

man 명령의 일반 형식은 다음과 같습니다.

text
man CommandName

pg 명령에 관한 정보를 얻으려면 다음을 입력합니다.

text
man pg

시스템은 다음과 비슷한 정보를 보여 줍니다.

text
pg Command
Purpose
Formats files to the display.
Syntax
pg [ - Number ] [ -c ] [ -e ] [ -f ] [ -n ] [ -p String ]
[ -s ] [ +LineNumber | +/Pattern/ ] [ File ... ]
Description
The pg command reads a file name from the File parameter and
writes the file to standard output one screen at a time. If you
specify a - (dash) as the File parameter, or run the pg command
without options, the pg command reads standard input. Each
screen is followed by a prompt. If you press the Enter key,
another page is displayed. Subcommands used with the pg command
let you review or search in the file.

전체 구문은 Commands Reference, Volume 3의 man 명령을 봅니다.

명령의 기능 보기(whatis 명령)

whatis 명령은 Command 매개변수로 지정한 명령, 시스템 호출, 라이브러리 함수, 특수 파일 이름을 catman -w 명령으로 만든 데이터베이스에서 찾습니다.

catman -w 명령에 관한 정보는 catman -w를 봅니다. whatis 명령은 매뉴얼 섹션의 머리 줄을 보여 줍니다. 그런 다음 man 명령으로 더 많은 정보를 얻을 수 있습니다. man 명령에 관한 자세한 내용은 man을 봅니다.

whatis 명령은 man -f 명령과 같습니다.

ls 명령이 하는 일을 알아보려면 다음을 입력합니다.

text
whatis ls

시스템은 다음과 비슷한 정보를 보여 줍니다.

text
ls(1)  -Displays the contents of a directory.

전체 구문은 Commands Reference, Volume 6의 whatis 명령을 봅니다.

이전에 입력한 명령 나열(history 명령)

history 명령으로 이전에 입력한 명령을 나열합니다.

history 명령은 마지막으로 입력한 16개 명령을 나열하는 Korn 셸 내장 명령입니다. Korn 셸은 입력한 명령을 보통 $HOME/.sh_history라는 명령 기록 파일에 저장합니다. 이 명령을 쓰면 이전 명령을 반복해야 할 때 시간을 아낄 수 있습니다.

기본적으로 Korn 셸은 root가 아닌 사용자는 마지막 128개, root 사용자는 512개 명령의 텍스트를 저장합니다. 기록 파일 크기(HISTSIZE 환경 변수로 지정)에는 제한이 없지만, 기록 파일이 아주 크면 Korn 셸이 느리게 시작할 수 있습니다.

참고: Bourne 셸은 명령 기록을 지원하지 않습니다.

이전에 입력한 명령을 나열하려면 프롬프트에서 다음을 입력합니다.

text
history

history 명령만 입력하면 이전에 입력한 16개 명령을 나열합니다. 시스템은 다음과 비슷한 정보를 보여 줍니다.

text
928   ls
929   mail
930   printenv MAILMSG
931   whereis Mail
932   whatis ls
933   cd /usr/include/sys
934   ls
935   man pg
936   cd
937   ls | pg
938   lscons
939   tty
940   ls *.txt
941   printenv MAILMSG
942   pwd
943   history

목록은 먼저 $HOME/.sh_history 파일에서 명령의 위치를 보여 주고 그 뒤에 명령을 보여 줍니다.

이전 다섯 개 명령을 나열하려면 프롬프트에서 다음을 입력합니다.

text
history -5

다음과 비슷한 목록이 나옵니다.

text
939   tty
940   ls *.txt
941   printenv MAILMSG
942   pwd
943   history
944   history -5

history 명령 뒤에 숫자를 쓰면 그 번호부터 이전에 입력한 모든 명령을 나열합니다.

938번 이후의 명령을 나열하려면 프롬프트에서 다음을 입력합니다.

text
history 938

다음과 비슷한 목록이 나옵니다.

text
938   lscons
939   tty
940   ls *.txt
941   printenv MAILMSG
942   pwd
943   history
944   history -5
945   history 938

관련 개념

  • 운영 체제 셸 — 운영 체제와의 인터페이스를 셸이라고 합니다.
  • 명령 기록 치환 — fc 내장 명령으로 기록 파일의 일부를 나열하거나 편집합니다. 편집하거나 나열할 부분을 고르려면 명령의 번호나 첫 글자(들)를 지정합니다.

r 별명으로 명령 반복

Korn 셸 별명 r로 이전 명령을 반복합니다.

r을 입력하고 Enter를 누르며, 명령 번호나 명령의 첫 글자(들)를 지정할 수 있습니다.

시스템에서 지금 쓸 수 있는 디스플레이를 나열하려면 프롬프트에서 lsdisp를 입력합니다. 시스템은 화면에 정보를 돌려줍니다. 같은 정보를 다시 받으려면 프롬프트에서 다음을 입력합니다.

text
r

시스템은 가장 최근에 입력한 명령을 다시 실행합니다. 이 예에서는 lsdisp 명령이 실행됩니다.

ls *.txt 명령을 반복하려면 프롬프트에서 다음을 입력합니다.

text
r ls

Korn 셸 별명 r은 지정한 글자(들)로 시작하는 가장 최근 명령을 찾습니다.

r 별명으로 문자열 치환

Korn 셸 별명 r로 명령을 실행하기 전에 고칠 수 있습니다.

이때 Old=New 형식의 치환 매개변수로 명령을 실행 전에 고칩니다.

다음 예는 r 별명 쓰는 방법을 보여 줍니다.

  • 940번 명령행이 ls *.txt이고 ls *.exe를 실행하려면 프롬프트에서 다음을 입력합니다.
text
r txt=exe 940

940번 명령을 txt 대신 exe로 바꿔 실행합니다.

  • 940번 줄의 명령이 소문자 l로 시작하는 가장 최근 명령이면 다음처럼 입력해도 됩니다.
text
r txt=exe l

참고: Old 문자열의 첫 번째 일치만 New 문자열로 바뀝니다. 명령 번호나 글자 없이 Korn 셸 별명 r을 입력하면 바로 앞에 입력한 명령에 치환합니다.

명령 기록 편집

Korn 셸 내장 명령 fc로 명령 기록 파일의 일부를 나열하거나 편집합니다.

편집하거나 나열할 부분을 고르려면 명령의 번호나 첫 글자(들)를 지정합니다. 명령 하나나 명령 범위를 지정할 수 있습니다.

fc 내장 명령의 인수로 편집기 프로그램을 지정하지 않으면 FCEDIT 변수에 지정한 편집기를 씁니다. FCEDIT 변수가 정의되지 않았으면 /usr/bin/ed 편집기를 씁니다. 편집한 명령은 편집기를 끝낼 때 출력되고 실행됩니다. FCEDIT 변수 값은 printenv 명령으로 볼 수 있습니다.

다음은 명령 기록을 편집하는 예입니다.

  • 다음 명령을 실행하려는데
text
cd /usr/tmp

933번 명령행과 아주 비슷하다면 프롬프트에서 다음을 입력합니다.

text
fc 933

그러면 기본 편집기가 933번 명령행을 띄웁니다. include/sys를 tmp로 바꾸고 편집기를 끝내면 편집한 명령이 실행됩니다.

  • fc 명령에 쓸 편집기를 지정할 수도 있습니다. 예를 들어 /usr/bin/vi 편집기로 명령을 편집하려면 프롬프트에서 다음을 입력합니다.
text
fc -e vi 933

그러면 vi 편집기가 933번 명령행을 띄웁니다.

  • 편집할 명령 범위를 지정할 수도 있습니다. 예를 들어 930번부터 940번까지 명령을 편집하려면 프롬프트에서 다음을 입력합니다.
text
fc 930 940

그러면 기본 편집기가 930번부터 940번까지 명령행을 띄웁니다. 편집기를 끝내면 편집기에 있던 모든 명령이 차례로 실행됩니다.

명령 별명 만들기(alias 셸 명령)

별명을 쓰면 명령, 파일 이름, 셸 텍스트에 짧은 이름을 붙일 수 있습니다. 별명을 쓰면 자주 하는 작업에서 시간을 많이 아낄 수 있습니다.

Korn 셸 내장 명령 alias로 어떤 단어를 명령의 별명으로 정의합니다. 별명으로 내장 명령은 다시 정의할 수 있지만 예약어는 다시 정의할 수 없습니다.

별명 이름의 첫 글자는 메타 문자를 뺀 출력 가능한 아무 문자나 될 수 있습니다. 나머지 글자는 올바른 파일 이름과 같은 규칙을 따라야 합니다.

별명을 만드는 형식은 다음과 같습니다.

text
alias Name = String

Name 매개변수는 별명 이름을, String 매개변수는 문자열을 지정합니다. String에 공백이 있으면 따옴표로 감쌉니다.

다음은 별명을 만드는 예입니다.

  • rm -i 명령(파일을 지우기 전에 묻습니다)의 별명을 만들려면 프롬프트에서 다음을 입력합니다.
text
alias rm="/usr/bin/rm -i"

이 예에서는 rm 명령을 입력할 때마다 실제로는 /usr/bin/rm -i가 실행됩니다.

  • ls -alF | pg 명령(현재 디렉터리의 숨김 파일까지 모든 파일의 자세한 정보를 보여 주고, 실행 파일에는 *, 디렉터리에는 /를 붙이며, 화면 단위로 넘깁니다)에 dir라는 별명을 만들려면 프롬프트에서 다음을 입력합니다.
text
alias dir="/usr/bin/ls -alF | pg"

이 예에서는 dir 명령을 입력할 때마다 실제로는 /usr/bin/ls -alF | pg가 실행됩니다.

  • 가진 모든 별명을 보려면 프롬프트에서 다음을 입력합니다.
text
alias

시스템은 다음과 비슷한 정보를 보여 줍니다.

text
rm="/usr/bin/rm -i"
dir="/usr/bin/ls -alF | pg"

관련 개념

  • Korn 셸이나 POSIX 셸의 명령 별명 — Korn 셸(POSIX 셸)에서는 별명을 만들어 명령을 사용자에 맞게 바꿀 수 있습니다.

텍스트 서식의 국제 문자 지원

텍스트 서식 명령으로 유럽 언어에 쓰는 국제 확장 문자 집합으로 된 텍스트를 다룰 수 있습니다.

국제 확장 문자 집합은 여러 유럽 언어에 쓰는 문자와 기호, 그리고 영어 문자·숫자·구두점으로 이루어진 ASCII 부분 집합을 제공합니다.

유럽 확장 문자 집합의 모든 문자에는 ASCII 형식이 있습니다. 이 형식으로 입력에서 확장 문자를 나타내거나, 유럽 확장 문자를 지원하는 키보드 같은 장치로 문자를 직접 입력할 수 있습니다.

다음 텍스트 서식 명령은 단일 바이트 문자를 쓰는 모든 국제 언어를 지원합니다. 이 명령은 /usr/bin에 있습니다(별표(*)가 붙은 명령은 멀티바이트 언어의 텍스트 처리도 지원합니다).

text
addbib*         hyphen          pic*             pstext
checkmm         ibm3812         ps4014           refer*
checknr*        ibm3816         ps630            roffbib*
col*            ibm5587G*       psbanne          soelim*
colcrt          ibm5585H-T*     psdit            sortbib*
deroff*         indxbib*        psplot           tbl*
enscript        lookbib*        psrev            troff*
eqn*            makedev*        psroff           vgrind
grap*           neqn*           psrv             xpreview*
hplj            nroff*

앞 목록에 없는 텍스트 서식 명령과 매크로 패키지는 국제 문자를 처리하도록 되어 있지 않습니다.

관련 개념

  • 텍스트 서식의 멀티바이트 문자 지원 — 일부 텍스트 서식 명령으로 멀티바이트 언어의 텍스트를 처리할 수 있습니다.

확장 단일 바이트 문자를 쓰는 텍스트 서식

입력 장치가 유럽 언어 확장 문자 집합의 문자를 지원하면 직접 입력할 수 있습니다.

그렇지 않으면 다음 ASCII 이스케이프 시퀀스 형식으로 이 문자를 나타냅니다.

\[N] 형식이며, N은 문자의 2자리나 4자리 16진 코드입니다.

참고: NCesc 형식 \<xx>는 더 이상 지원하지 않습니다.

확장 문자가 든 텍스트는 쓰는 언어의 서식 규칙에 따라 출력됩니다. 특정 출력 장치의 인터페이스에 정의되지 않은 문자는 출력도 오류 표시도 없습니다.

요청, 매크로 패키지, 명령의 이름은 영어에 기반하지만, 대부분 유럽 확장 문자 집합의 문자가 든 입력(파일 이름과 매개변수 등)을 받을 수 있습니다.

nroff와 troff 명령과 그 전처리기는 명령 입력이 ASCII여야 하며, 그렇지 않으면 복구할 수 없는 구문 오류가 납니다. 국제 문자(단일 바이트든 멀티바이트든)는 따옴표 안이나 서식을 적용할 다른 텍스트 안에서 입력할 수 있습니다. 예를 들어 pic 명령의 매크로를 쓰면

text
define foobar % SomeText %

define 지시문 뒤에 지정한 이름 foobar는 ASCII여야 합니다. 그러나 바꿀 텍스트 SomeText에는 ASCII가 아닌 문자가 들어가도 됩니다.

텍스트 서식의 멀티바이트 문자 지원

일부 텍스트 서식 명령으로 멀티바이트 언어의 텍스트를 처리할 수 있습니다.

이 명령은 텍스트 서식의 국제 문자 지원 절의 목록에서 별표(*)로 표시돼 있습니다. 목록에 없는 텍스트 서식 명령은 국제 문자를 처리하도록 되어 있지 않습니다.

입력 장치가 지원하면 멀티바이트 문자를 직접 입력할 수 있습니다. 그렇지 않으면 어떤 멀티바이트 문자든 ASCII 형식 \[N]으로 입력할 수 있으며, N은 문자의 2·4·6·7·8자리 16진 인코딩입니다.

요청, 매크로, 명령의 이름은 영어에 기반하지만, 대부분 어떤 종류의 멀티바이트 문자가 든 입력(파일 이름과 매개변수 등)이든 받을 수 있습니다.

단일 바이트 텍스트로 텍스트 서식 명령을 써 봤다면, 멀티바이트 로케일에서 눈여겨보거나 특유한 점은 다음과 같습니다.

  • 텍스트에 하이픈 넣기를 하지 않습니다.
  • 멀티바이트 숫자 출력에는 특수 서식 형이 필요합니다. 일본어 서식 형을 쓸 수 있습니다.
  • 텍스트는 가로줄로 출력되며 왼쪽에서 오른쪽으로 채워집니다.
  • 문자 간격이 일정하므로 문자가 자동으로 열에 맞춰집니다.
  • 특정 출력 장치의 인터페이스에 정의되지 않은 문자는 출력도 오류 표시도 없습니다.

관련 개념

  • 텍스트 서식의 국제 문자 지원 — 텍스트 서식 명령으로 유럽 언어에 쓰는 국제 확장 문자 집합으로 된 텍스트를 다룰 수 있습니다.

달력 보기

cal 명령으로 달력을 표준 출력에 쓸 수 있습니다.

Month 매개변수는 달력을 볼 달을 정합니다. 1월부터 12월까지 각각 1부터 12까지의 숫자입니다. Month를 지정하지 않으면 cal 명령은 이번 달을 기본으로 씁니다.

Year 매개변수는 달력을 볼 해를 정합니다. cal 명령은 1년부터 9999년까지 어느 해의 달력이든 보여 줄 수 있으므로 끝 두 자리가 아니라 연도 전체를 입력합니다. Year를 지정하지 않으면 cal 명령은 올해를 기본으로 씁니다.

다음은 cal 명령 쓰는 예입니다.

  1. 워크스테이션에 2002년 2월 달력을 보려면 다음을 입력합니다.
text
cal 2 2002
  1. Enter를 누릅니다.
  2. 2002년 달력을 인쇄하려면 다음을 입력합니다.
text
cal 2002 | qprt
  1. Enter를 누릅니다.

전체 구문은 Commands Reference, Volume 1의 cal 명령을 봅니다.

알림 메시지 보기

calendar라는 파일을 읽어 알림 메시지를 볼 수 있습니다. 이 파일은 calendar 명령을 쓰려고 홈 디렉터리에 만듭니다. 이 명령은 파일에서 오늘이나 내일 날짜가 든 줄을 표준 출력에 씁니다.

calendar 명령은 Dec. 7이나 12/7 같은 날짜 형식을 인식합니다. 별표(*) 뒤에 슬래시(/)가 오는 특수 문자도 인식합니다. 예를 들어 */7은 매달 7일로 해석합니다.

금요일에는 calendar 명령이 금·토·일·월요일 날짜가 든 모든 줄을 씁니다. 그러나 이 명령은 공휴일을 인식하지 못합니다. 공휴일에도 평소처럼 동작하며 다음 날 일정만 보여 줍니다.

일반적인 calendar 파일 쓰기

일반적인 calendar 파일은 다음과 비슷합니다.

text
*/25 - Prepare monthly report
Aug. 12 - Fly to Denver
aug 23 - board meeting
Martha out of town - 8/23, 8/24, 8/25
8/24 - Mail car payment
sat aug/25 - beach trip
August 27 - Meet with Simmons
August 28 - Meet with Wilson

calendar 명령을 실행하려면 다음을 입력합니다.

text
calendar

오늘이 8월 24일 금요일이면 calendar 명령은 다음을 보여 줍니다.

text
*/25 - Prepare monthly report
Martha out of town - 8/23, 8/24, 8/25
8/24 - Mail car payment
sat aug/25 - beach trip
August 27 - Meet with Simmons

include 문이 든 calendar 파일 쓰기

include 문이 든 calendar 파일은 다음과 비슷합니다.

text
#include </tmp/out>
1/21 -Annual review
1/21 -Weekly project meeting
1/22 *Meet with Harrison in Dallas*
Doctor’s appointment - 1/23
1/23 -Vinh’s wedding

calendar 명령을 실행하려면 다음을 입력합니다.

text
calendar

오늘이 1월 21일 수요일이면 calendar 명령은 다음을 보여 줍니다.

text
Jan.21 Goodbye party for David
Jan.22 Stockholder meeting in New York
1/21 -Annual review
1/21 -Weekly project meeting
1/22 *Meet with Harrison in Dallas*

calendar 명령의 결과를 보면 /tmp/out 파일에 다음 줄이 들어 있었음을 알 수 있습니다.

text
Jan.21 Goodbye party for David
Jan.22 Stockholder meeting in New York

전체 구문은 Commands Reference, Volume 1의 calendar 명령을 봅니다.

수 인수분해

factor 명령으로 수를 인수분해할 수 있습니다.

Number 매개변수 값을 지정하지 않고 호출하면 factor 명령은 1E14(100,000,000,000,000)보다 작은 양수를 입력하기를 기다립니다. 그런 다음 그 수의 소인수를 표준 출력에 씁니다. 인수를 차례로 보여 주며, 같은 인수가 여러 번 쓰이면 그 횟수만큼 보여 줍니다. 끝내려면 0이나 숫자가 아닌 문자를 입력합니다.

인수를 주고 호출하면 factor 명령은 Number 매개변수의 소인수를 구해 결과를 표준 출력에 쓰고 끝납니다.

다음은 인수를 계산하는 예입니다.

  1. 123의 소인수를 계산하려면 다음을 입력합니다.
text
factor 123
  1. Enter를 누릅니다. 다음이 나옵니다.
text
123 3 41

전체 구문은 Commands Reference, Volume 2의 factor 명령을 봅니다.

키워드로 명령 찾기

apropos 명령으로 제목에 주어진 키워드가 하나라도 든 man 페이지 섹션을 볼 수 있습니다.

apropos 명령은 단어를 하나씩 따로 보며 대소문자를 가리지 않습니다. 다른 단어의 일부인 단어도 보여 줍니다. 예를 들어 compile이라는 단어를 찾으면 compiler라는 단어도 모두 찾습니다.

참고: 키워드가 든 데이터베이스는 /usr/share/man/whatis이며, 먼저 catman -w 명령으로 만들어야 합니다.

apropos 명령은 man 명령에 -k 옵션을 쓰는 것과 같습니다.

예를 들어 제목에 password라는 단어가 든 매뉴얼 섹션을 찾으려면 다음을 입력합니다.

text
apropos password

Enter를 누릅니다.

전체 구문은 Commands Reference, Volume 1의 apropos 명령을 봅니다.

영어 원문

Commands

Some commands can be entered simply by typing one word. It is also possible to combine commands so that the output from one command becomes the input for another command.

Combining commands so that the output from one command becomes the input for another command is known as piping.

Flags further define the actions of commands. A flag is a modifier used with the command name on the command line, usually preceded by a dash.

Commands can also be grouped together and stored in a file. These files are known as shell procedures or shell scripts. Instead of executing the commands individually, you execute the file that contains the commands.

To enter a command, type the command name at the prompt, and press Enter.

text
$ CommandName

Related concepts

Shell features There are advantages to using the shell as an interface to the system.

Related tasks

Creating and running a shell script A shell script is a file that contains one or more commands. Shell scripts provide an easy way to carry out tedious commands, large or complicated sequences of commands, and routine tasks. When you enter the name of a shell script file, the system executes the command sequence contained by the file.

Command syntax and command names

Although some commands can be entered by simply typing one word, other commands use flags and parameters. Each command has a syntax that designates both the required and optional flags and parameters.

The general format for a command is as follows:

text
CommandName flag(s) parameter(s)

The following are some general rules about commands:

  • Spaces between commands, flags, and parameters are significant.

  • Two commands can be entered on the same line by separating the commands with a semicolon (;). For example:

text
$ CommandOne ; CommandTwo

The shell runs the commands sequentially.

  • Commands are case-sensitive. The shell distinguishes between uppercase and lowercase letters. To the shell, print is not the same as PRINT or Print.

  • A very long command can be entered on more than one line by using the backslash (\) character. A backslash signifies line continuation to the shell. The following example is one command that spans two lines:

text
$ ls Mail info temp \
(press Enter)
> diary
(the > prompt appears)

The > character is your secondary prompt ($ is the nonroot user's default primary prompt), indicating that the current line is the continuation of the previous line. Note that csh (the C shell) gives no secondary prompt, and the break must be at a word boundary, and its primary prompt is %.

The first word of every command is the command name. Some commands have only a command name.

Command flags:

A number of flags might follow the command name. Flags modify the operation of a command and are sometimes called options.

A flag is set off by spaces or tabs and usually starts with a dash (-). Exceptions are ps, tar, and ar, which do not require a dash in front of some of the flags. For example, in the following command:

text
ls -a -F

ls is the command name, and -a -F are the flags.

When a command uses flags, they come directly after the command name. Single-character flags in a command can be combined with one dash. For example, the previous command can also be written as follows:

text
ls -aF

There are some circumstances when a parameter actually begins with a dash (-). In this case, use the delimiter dash dash (—) before the parameter. The — tells the command that whatever follows is not a flag but a parameter.

For example, if you want to create a directory named -tmp and you type the following command:

text
mkdir -tmp

The system displays an error message similar to the following:

text
mkdir: Not a recognized flag: t
Usage: mkdir [-p] [-m mode] Directory ...

The correct way of typing the command is as follows:

text
mkdir -- -tmp

Your new directory, -tmp, is now created.

Command parameters:

After the command name, there might be a number of flags, followed by parameters. Parameters are sometimes called arguments or operands. Parameters specify information that the command needs in order to run.

If you do not specify a parameter, the command might assume a default value. For example, in the following command:

text
ls -a temp

ls is the command name, -a is the flag, and temp is the parameter. This command displays all (-a) the files in the directory temp.

In the following example:

text
ls -a

the default value is the current directory because no parameter is given.

In the following example:

text
ls temp mail

no flags are given, and temp and mail are parameters. In this case, temp and mail are two different directory names. The ls command displays all but the hidden files in each of these directories.

Whenever a parameter or option-argument is, or contains, a numeric value, the number is interpreted as a decimal integer, unless otherwise specified. Numerals in the range 0 to INT_MAX, as defined in the /usr/include/sys/limits.h file, are syntactically recognized as numeric values.

If a command you want to use accepts negative numbers as parameters or option-arguments, you can use numerals in the range INT_MIN to INT_MAX, both as defined in the /usr/include/sys/limits.h file. This does not necessarily mean that all numbers within that range are semantically correct. Some commands have a built-in specification permitting a smaller range of numbers, for example, some of the print commands. If an error is generated, the error message lets you know the value is out of the supported range, not that the command is syntactically incorrect.

Usage statements

Usage statements are a way to represent command syntax and consist of symbols such as brackets ([ ]), braces (), and vertical bars (|).

The following is a sample of a usage statement for the unget command:

unget [ -rSID ] [ -s ] [ -n ] File ...

The following conventions are used in the command usage statements:

  • Items that must be entered literally on the command line are in bold. These items include the command name, flags, and literal characters.

  • Items representing variables that must be replaced by a name are in italics. These items include parameters that follow flags and parameters that the command reads, such as Files and Directories.

  • Parameters enclosed in brackets are optional.

  • Parameters enclosed in braces are required.

  • Parameters not enclosed in either brackets or braces are required.

  • A vertical bar signifies that you choose only one parameter. For example, [ a | b ] indicates that you can choose a, b, or nothing. Similarly, { a | b } indicates that you must choose either a or b.

  • Ellipses ( ... ) signify the parameter can be repeated on the command line.

  • The dash ( - ) represents standard input.

Shutdown command

If you have root user authority, you can use the shutdown command to stop the system. If you are not authorized to use the shutdown command, simply log out of the operating system and leave it running.

Attention: Do not turn off the system without first shutting down. Turning off the system ends all processes running on the system. If other users are working on the system, or if jobs are running in the background, data might be lost. Perform proper shutdown procedures before you stop the system.

At the prompt, type the following:

text
shutdown

When the shutdown command completes and the operating system stops running, you receive the following message:

text
....Shutdown completed....

See the shutdown command for the complete syntax.

Locating another command or program (whereis command)

The whereis command locates the source, binary, and manuals sections for specified files. The command attempts to find the desired program from a list of standard locations.

See the following examples:

  • To find files in the current directory that have no documentation, type the following:
text
whereis -m -u *
  • To find all of the files that contain the name Mail, type the following:
text
whereis Mail

The system displays information similar to the following:

text
Mail: /usr/bin/Mail /usr/lib/Mail.rc

See the whereis command in the Commands Reference, Volume 6 for the complete syntax.

Displaying information about a command (man command)

The man command displays information on commands, subroutines, and files.

The general format for the man command is as follows:

text
man CommandName

To obtain information about the pg command, type the following:

text
man pg

The system displays information similar to the following:

(14줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

See the man command in the Commands Reference, Volume 3 for the complete syntax.

Displaying the function of a command (whatis command)

The whatis command looks up a given command, system call, library function, or special file name, as specified by the Command parameter, from a database you create using the catman -w command.

For information about the catman -w command, see catman -w. The whatis command displays the header line from the manual section. You can then issue the man command to obtain additional information. For more information about the man command, see man.

The whatis command is equivalent to using the man -f command.

To find out what the ls command does, type the following:

text
whatis ls

The system displays information similar to the following:

text
ls(1)  -Displays the contents of a directory.

See the whatis command in the Commands Reference, Volume 6 for the complete syntax.

Listing previously entered commands (history command)

Use the history command to list commands that you have previously entered.

The history command is a Korn shell built-in command that lists the last 16 commands entered. The Korn shell saves commands that you entered to a command history file, usually named $HOME/.sh_history. Using this command saves time when you need to repeat a previous command.

By default, the Korn shell saves the text of the last 128 commands for nonroot users and 512 commands for the root user. The history file size (specified by the HISTSIZE environment variable) is not limited, although a very large history file size can cause the Korn shell to start slowly.

Note: The Bourne shell does not support command history.

To list the previous commands you entered, at the prompt, type the following:

text
history

The history command entered by itself lists the previous 16 commands entered. The system displays information similar to the following:

(16줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

The listing first displays the position of the command in the $HOME/.sh_history file followed by the command.

To list the previous five commands, at the prompt, type the following:

text
history -5

A listing similar to the following is displayed:

text
939   tty
940   ls *.txt
941   printenv MAILMSG
942   pwd
943   history
944   history -5

The history command followed by a number lists all the previous commands entered, starting at that number.

To list the commands since 938, at the prompt, type the following:

text
history 938

A listing similar to the following is displayed:

text
938   lscons
939   tty
940   ls *.txt
941   printenv MAILMSG
942   pwd
943   history
944   history -5
945   history 938

Related concepts

Operating system shells Your interface to the operating system is called a shell. Command history substitution Use the fc built-in command to list or edit portions of the history file. To select a portion of the file to edit or list, specify the number or the first character or characters of the command.

Repeating commands using the r alias

Use the r Korn shell alias to repeat previous commands.

Type r, and press Enter, and you can specify the number or the first character or characters of the command.

If you want to list the displays currently available on the system, type lsdisp at the prompt. The system returns the information on the screen. If you want the same information returned to you again, at the prompt, type the following:

text
r

The system runs the most recently entered command again. In this example, the lsdisp command runs.

To repeat the ls *.txt command, at the prompt, type the following:

text
r ls

The r Korn shell alias locates the most recent command that begins with the character or characters specified.

String substitution using the r alias

You can use the r Korn shell alias to modify a command before it is run.

In this case, a substitution parameter of the form Old=new can be used to modify the command before it is run.

The following examples show how to use the r alias:

  • If command line 940 is ls *.txt, and you want to run ls *.exe, at the prompt, type the following:
text
r txt=exe 940

This runs command 940, substituting exe for txt.

  • If the command on line 940 is the most recent command that starts with a lowercase letter l, you can also type the following:
text
r txt=exe l

Note: Only the first occurrence of the Old string is replaced by the New string. Entering the r Korn shell alias without a specific command number or character performs the substitution on the immediately previous command entered.

Editing the command history

Use the fc Korn shell built-in command to list or edit portions of the command history file.

To select a portion of the file to edit or list, specify the number or the first character or characters of the command. You can specify a single command or range of commands.

If you do not specify an editor program as an argument to the fc Korn shell built-in command, the editor specified by the FCEDIT variable is used. If the FCEDIT variable is not defined, the /usr/bin/ed editor is used. The edited command or commands are printed and run when you exit the editor. Use the printenv command to display the value of the FCEDIT variable.

The following are examples of how to edit the command history:

  • If you want to run the command:
text
cd /usr/tmp

which is very similar to command line 933, at the prompt, type the following:

text
fc 933

At this point, your default editor appears with the command line 933. Change include/sys to tmp, and when you exit your editor, the edited command is run.

  • You can also specify the editor you want to use in the fc command. For example, if you want to edit a command using the /usr/bin/vi editor, at the prompt, type the following:
text
fc -e vi 933

At this point, the vi editor appears with the command line 933.

  • You can also specify a range of commands to edit. For example, if you want to edit the commands 930 through 940, at the prompt, type the following:
text
fc 930 940

At this point, your default editor appears with the command lines 930 through 940. When you exit the editor, all the commands that appear in your editor are run sequentially.

Creating a command alias (alias shell command)

An alias lets you create a shortcut name for a command, file name, or any shell text. By using aliases, you save a lot of time when doing tasks you do frequently. You can create a command alias.

Use the alias Korn shell built-in command to define a word as an alias for some command. You can use aliases to redefine built-in commands but not to redefine reserved words.

The first character of an alias name can be any printable character except the metacharacters. Any remaining characters must be the same as for a valid file name.

The format for creating an alias is as follows:

text
alias Name = String

in which the Name parameter specifies the name of the alias, and the String parameter specifies a string of characters. If String contains blank spaces, enclose it in quotation marks.

The following are examples how to create an alias:

  • To create an alias for the command rm -i (prompts you before deleting files), at the prompt, type the following:
text
alias rm="/usr/bin/rm -i"

In this example, whenever you enter the command rm, the actual command performed is /usr/bin/rm -i.

  • To create an alias named dir for the command ls -alF | pg (which displays detailed information of all the files in the current directory, including the invisible files; marks executable files with an * and directories with a /; and scrolls per screen), at the prompt, type the following:
text
alias dir="/usr/bin/ls -alF | pg"

In this example, whenever you enter the command dir, the actual command performed is /usr/bin/ls -alF | pg.

  • To display all the aliases you have, at the prompt, type the following:
text
alias

The system displays information similar to the following:

text
rm="/usr/bin/rm -i"
dir="/usr/bin/ls -alF | pg"

Related concepts

Command aliasing in the Korn shell or POSIX shell The Korn shell, or POSIX shell, allows you to create aliases to customize commands.

International character support in text formatting

You can use text formatting commands to work with text composed of the international extended character set used for European languages.

The international extended character set provides the characters and symbols used in many European languages, as well as an ASCII subset composed of English-language characters, digits, and punctuation.

All characters in the European extended character set have ASCII forms. These forms can be used to represent the extended characters in input, or the characters can be entered directly with a device such as a keyboard that supports the European extended characters.

The following text-formatting commands support all international languages that use single-byte characters. These commands are located in /usr/bin. (The commands identified with an asterisk (*) support text processing for multibyte languages.

text
addbib*         hyphen          pic*             pstext
checkmm         ibm3812         ps4014           refer*
checknr*        ibm3816         ps630            roffbib*
col*            ibm5587G*       psbanne          soelim*
colcrt          ibm5585H-T*     psdit            sortbib*
deroff*         indxbib*        psplot           tbl*
enscript        lookbib*        psrev            troff*
eqn*            makedev*        psroff           vgrind
grap*           neqn*           psrv             xpreview*
hplj            nroff*

Text-formatting commands and macro packages not in the preceding list have not been enabled to process international characters.

Related concepts

Multibyte character support in text formatting Certain text formatting commands can be used to process text for multibyte languages.

Text formatting with extended single-byte characters

If your input device supports characters from the European-language extended character set, you can enter them directly.

Otherwise, use the following ASCII escape sequence form to represent these characters:

The form \[N], where N is the 2- or 4-digit hexadecimal code for the character.

Note: The NCesc form \<xx> is no longer supported.

Text containing extended characters is output according to the formatting conventions of the language in use. Characters that are not defined for the interface to a specific output device produce no output or error indication.

Although the names of the requests, macro packages, and commands are based on English, most of them can accept input (such as file names and parameters) containing characters in the European extended character set.

For the nroff and troff commands and their preprocessors, the command input must be ASCII, or an unrecoverable syntax error will result. International characters, either single-byte or multibyte, can be entered when enclosed within quotation marks and within other text to be formatted. For example, using macros from the pic command:

text
define foobar % SomeText %

After the define directive, the specified name, foobar, must be ASCII. However, the replacement text, SomeText, can contain non-ASCII characters.

Multibyte character support in text formatting

Certain text formatting commands can be used to process text for multibyte languages.

These commands are identified with an asterisk (*) in the list under International character support in text formatting. Text formatting commands not in the list have not been enabled to process international characters.

If supported by your input device, multibyte characters can be entered directly. Otherwise, you can enter any multibyte character in the ASCII form \[N], where N is the 2-, 4-, 6-, 7-, or 8-digit hexadecimal encoding for the character.

Although the names of the requests, macros, and commands are based on English, most of them can accept input (such as file names and parameters) containing any type of multibyte character.

If you are already familiar with using text-formatting commands with single-byte text, the following list summarizes characteristics that are noteworthy or unique to the multibyte locales:

  • Text is not hyphenated.

  • Special format types are required for multibyte numerical output. Japanese format types are available.

  • Text is output in horizontal lines, filled from left to right.

  • Character spacing is constant, so characters automatically align in columns.

  • Characters that are not defined for the interface to a specific output device produce no output or error indication.

Related concepts

International character support in text formatting You can use text formatting commands to work with text composed of the international extended character set used for European languages.

Displaying a Calendar

You can write a calendar to standard output by using the cal command.

The Month parameter names the month for which you want the calendar. It can be a number from 1 through 12 for January through December, respectively. If no Month is specified, the cal command defaults to the current month.

The Year parameter names the year for which you want the calendar. Because the cal command can display a calendar for any year from 1 through 9999, type the full year rather than just the last two digits. If no Year is specified, the cal command defaults to the present year.

The following are examples of how to use the cal command:

  1. To display a calendar for February 2002 at your workstation, type:
text
cal 2 2002
  1. Press Enter.

  2. To print a calendar for the year 2002, type:

text
cal 2002 | qprt
  1. Press Enter.

See the cal command in Commands Reference, Volume 1 for the complete syntax.

Displaying reminder messages

You can display a reminder message by reading a file named calendar. This file is created in your home directory with the calendar command. The command writes to standard output any line in the file that contains today's or tomorrow's date.

You can read a file named calendar, which you create in your home directory with the calendar command. The command writes to standard output any line in the file that contains today's or tomorrow's date.

The calendar command recognizes date formats such as Dec. 7 or 12/7. It also recognizes the special character asterisk (*) when it is followed by a slash (/). It interprets */7, for example, as signifying the seventh day of every month.

On Fridays, the calendar command writes all lines containing the dates for Friday, Saturday, Sunday, and Monday. The command does not, however, recognize holidays. On holidays the command functions as usual and gives only the next day's schedule.

Using a typical calendar file

A typical calendar file might look similar to the following:

text
*/25 - Prepare monthly report
Aug. 12 - Fly to Denver
aug 23 - board meeting
Martha out of town - 8/23, 8/24, 8/25
8/24 - Mail car payment
sat aug/25 - beach trip
August 27 - Meet with Simmons
August 28 - Meet with Wilson

To run the calendar command, type:

text
calendar

If today is Friday, August 24, the calendar command displays the following:

text
*/25 - Prepare monthly report
Martha out of town - 8/23, 8/24, 8/25
8/24 - Mail car payment
sat aug/25 - beach trip
August 27 - Meet with Simmons

Using a calendar file that contains an include statement

A calendar file that contains an include statement might look like the following:

text
#include </tmp/out>
1/21 -Annual review
1/21 -Weekly project meeting
1/22 *Meet with Harrison in Dallas*
Doctor’s appointment - 1/23
1/23 -Vinh’s wedding

To run the calendar command, type:

text
calendar

If today is Wednesday, January 21, the calendar command displays the following:

text
Jan.21 Goodbye party for David
Jan.22 Stockholder meeting in New York
1/21 -Annual review
1/21 -Weekly project meeting
1/22 *Meet with Harrison in Dallas*

The results of the calendar command indicate the /tmp/out file contained the following lines:

text
Jan.21 Goodbye party for David
Jan.22 Stockholder meeting in New York

See the calendar command in Commands Reference, Volume 1 for the complete syntax.

Factoring a Number

You can factor numbers with the factor command.

When called without specifying a value for the Number parameter, the factor command waits for you to enter a positive number less than 1E14 (100,000,000,000,000). It then writes the prime factors of that number to standard output. It displays each factor in order and the proper number of times if the same factor is used more than once. To exit, enter 0 (zero) or any non-numeric character.

When called with an argument, the factor command determines the prime factors of the Number parameter, writes the results to standard output, and exits.

The following is an example of how to calculate factors:

  1. To calculate the prime factors of the number 123, type
text
factor 123
  1. Press Enter. The following displays:
text
123 3 41

See the factor command in Commands Reference, Volume 2 for the complete syntax.

Locating a command by keyword

You can display the man page sections that contain any of the given Keywords in their title by using the apropos command.

The apropos command considers each word separately is not case-sensitive. Words that are part of other words are also displayed. For example, when looking for the word compile, the apropos command also finds all instances of the word compiler.

Note: The database containing the keywords is /usr/share/man/whatis, which must first be generated with the catman -w command.

The apropos command is equivalent to using the man command with the -k option.

For example, to find the manual sections that contain the word password in their titles, type:

text
apropos password

Press Enter.

See the apropos command in the Commands Reference, Volume 1 for the complete syntax.