Closed fr-sato closed 10 years ago
本課題の工数見積もり(4/7分)は以下の通りとします。
echo "hello world";
ここまでを夜礼までの1時間半で行います。 宜しくお願い致します。
mkdir work
$ cd work
[(省略) work]$
$ touch hello.sh
echo "hello world";
$ vim hello.sh
$ ./hello.sh
-bash: ./hello.sh: Permission denied
$ ls -l
total 4 -rw-rw-r-- 1 (省略) 20 Apr 7 08:36 hello.sh
664
rw
になっている。つまり、読み込み・書き込みは出来るが実行ができない(4+2=6
)。4+2+1=7
。0
。$ chmod 700 hello.sh
$ ls -l
すると以下の通りになる。-rwx------ 1 (省略) 20 Apr 7 08:36 hello.sh
$ ./hello.sh
コマンドを実行すると、hello world
が表示された。 夜礼が近いので本日はここまでとし、7以降は明日行います。
コマンドと出力結果は基本的にOKです。
入力したコマンドや実行前、実行後の確認や出力結果は、Issueのコメントに記述して下さい。
ただ上記の仕様は満たしていないです。例えば1や3の場合、ディレクトリやファイルが作成されたかどうかlsコマンドを使って確認する所までしないと、本当に作成したかどうかの確認にはならないです。
$ touch hello.sh
$ ls -l hello.sh
-rw-r--r-- 1 *** *** 0 4 7 18:42 hello.sh
あとコマンドの実行結果を残す時は↑のようになるべく全ての履歴を残すようにしましょう、そうすると他の人が確認したり、自分で後から確認した時に状況を把握しやすくなります。
のでその辺を意識して再度 https://github.com/fr-itaya/training/issues/3#issuecomment-39710513 を書き直してみて下さい。
本日の作業は14:05開始、工数見積もりは4時間と致します。 内訳は下記の通りです。
宜しくお願い致します。
https://github.com/fr-itaya/training/issues/3#issuecomment-39710513 修正です。
$ mkdir work
$ mkdir work
$ ls -l
drwxrwxr-x 2 *** *** 4096 Apr 8 05:15 work
$ cd work
$ cd work
$ pwd
/home/***/work
$ touch hello.sh
$ touch hello.sh
$ ls -l
-rw-rw-r-- 1 *** *** 0 Apr 8 05:24 hello.sh
echo "hello world";
$ vim hello.sh
$ ls -l
total 0
-rw-rw-r-- 1 *** *** 0 Apr 8 05:24 hello.sh
$ vim hello.sh
$ ls -l
total 4
-rw-rw-r-- 1 *** *** 20 Apr 8 05:30 hello.sh
$ ./hello.sh
$ ./hello.sh
-bash: ./hello.sh: Permission denied
664
rw
になっている。つまり、読み込み・書き込みは出来るが実行はできない(4+2=6
)。4+2+1=7
。 0
。$ chmod 700 hello.sh
$ ls -l
total 4
-rw-rw-r-- 1 *** *** 20 Apr 8 05:30 hello.sh
$ chmod 700 hello.sh
$ ls -l
total 4
-rwx------ 1 *** *** 20 Apr 8 05:30 hello.sh
$ ./hello.sh
hello world
続いて14:50から7以降を実行、出力結果の確認に入ります。
$ cp hello.sh hello_copy.sh
$ cp hello.sh hello_copy.sh
$ ls -l
total 8
-rwx------ 1 *** *** 20 Apr 8 06:02 hello_copy.sh
-rwx------ 1 *** *** 20 Apr 8 05:30 hello.sh
$ mv hello.sh hello_move.sh
$ mv hello.sh hello_move.sh
$ ls -l
total 8
-rwx------ 1 *** *** 20 Apr 8 06:02 hello_copy.sh
-rwx------ 1 *** *** 20 Apr 8 05:30 hello_move.sh
$ rm hello_move.sh
$ rm hello_move.sh
$ ls -l
total 4
-rwx------ 1 *** *** 20 Apr 8 06:02 hello_copy.sh
$ cd
$ pwd
/home/***/work
$ cd
$ pwd
/home/***
$ cp -Rv work work_copy
-R
:ディレクトリの内容を全てコピー-v
:処理内容の表示$ ls -l
total 116
-rw-rw-r-- 1 *** *** 952 Apr 7 06:18 dl.tar.gz
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 doc
-rw-rw-r-- 1 *** *** 44645 Apr 7 06:16 ds.zip
drwxrwxr-x 2 *** *** 4096 May 26 2010 gist414375-24c6049f621f07db839e8cdd133e396756d642db
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 nerdtree_plugin
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 plugin
drwxrwxr-x 3 *** *** 4096 Mar 20 02:49 public_html
-rw-rw-r-- 1 *** *** 43528 Apr 4 07:38 TEST
drwxrwxr-x 2 *** *** 4096 Apr 8 06:08 work
$ ls -l work
total 4
-rwx------ 1 *** *** 20 Apr 8 06:02 hello_copy.sh
$ cp -Rv work work_copy
`work' -> `work_copy'
`work/hello_copy.sh' -> `work_copy/hello_copy.sh'
$ mv work_copy work_move
$ ls -l
total 120
-rw-rw-r-- 1 *** *** 952 Apr 7 06:18 dl.tar.gz
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 doc
-rw-rw-r-- 1 *** *** 44645 Apr 7 06:16 ds.zip
drwxrwxr-x 2 *** *** 4096 May 26 2010 gist414375-24c6049f621f07db839e8cdd133e396756d642db
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 nerdtree_plugin
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 plugin
drwxrwxr-x 3 *** *** 4096 Mar 20 02:49 public_html
-rw-rw-r-- 1 *** *** 43528 Apr 4 07:38 TEST
drwxrwxr-x 2 *** *** 4096 Apr 8 06:08 work
drwxrwxr-x 2 *** *** 4096 Apr 8 06:15 work_copy
$ mv work_copy work_move
$ ls -l
total 120
-rw-rw-r-- 1 *** *** 952 Apr 7 06:18 dl.tar.gz
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 doc
-rw-rw-r-- 1 *** *** 44645 Apr 7 06:16 ds.zip
drwxrwxr-x 2 *** *** 4096 May 26 2010 gist414375-24c6049f621f07db839e8cdd133e396756d642db
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 nerdtree_plugin
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 plugin
drwxrwxr-x 3 *** *** 4096 Mar 20 02:49 public_html
-rw-rw-r-- 1 *** *** 43528 Apr 4 07:38 TEST
drwxrwxr-x 2 *** *** 4096 Apr 8 06:08 work
drwxrwxr-x 2 *** *** 4096 Apr 8 06:15 work_move
$ rm -r work_move
$ rm -r work_move
$ ls -l
total 116
-rw-rw-r-- 1 *** *** 952 Apr 7 06:18 dl.tar.gz
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 doc
-rw-rw-r-- 1 *** *** 44645 Apr 7 06:16 ds.zip
drwxrwxr-x 2 *** *** 4096 May 26 2010 gist414375-24c6049f621f07db839e8cdd133e396756d642db
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 nerdtree_plugin
drwxrwxr-x 2 *** *** 4096 Apr 7 06:17 plugin
drwxrwxr-x 3 *** *** 4096 Mar 20 02:49 public_html
-rw-rw-r-- 1 *** *** 43528 Apr 4 07:38 TEST
drwxrwxr-x 2 *** *** 4096 Apr 8 06:08 work
$ history
$ history
1 sudo yum update
2 yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libffi-devel openssl-devel git vim tmux
3 sudo su -
4 mkdir public_html
5 mkdir public_html/training
$ history|grep ls
$ history|grep ls
139 ls -l
143 ls -l
147 ls -l
150 ls -l
153 ls -l
$ ls --help
$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort.
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print octal escapes for nongraphic characters
--block-size=SIZE use SIZE-byte blocks. See SIZE format below
-B, --ignore-backups do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last
modification of file status information)
with -l: show ctime and sort by name
otherwise: sort by ctime
-C list entries by columns
--color[=WHEN] colorize the output. WHEN defaults to `always'
or can be `never' or `auto'. More info below
-d, --directory list directory entries instead of contents,
and do not dereference symbolic links
-D, --dired generate output designed for Emacs' dired mode
-f do not sort, enable -aU, disable -ls --color
-F, --classify append indicator (one of */=>@|) to entries
--file-type likewise, except do not append `*'
--format=WORD across -x, commas -m, horizontal -x, long -l,
single-column -1, verbose -l, vertical -C
--full-time like -l --time-style=full-iso
-g like -l, but do not list owner
--group-directories-first
group directories before files.
augment with a --sort option, but any
use of --sort=none (-U) disables grouping
-G, --no-group in a long listing, don't print group names
-h, --human-readable with -l, print sizes in human readable format
(e.g., 1K 234M 2G)
--si likewise, but use powers of 1000 not 1024
-H, --dereference-command-line
follow symbolic links listed on the command line
--dereference-command-line-symlink-to-dir
follow each command line symbolic link
that points to a directory
--hide=PATTERN do not list implied entries matching shell PATTERN
(overridden by -a or -A)
--indicator-style=WORD append indicator with style WORD to entry names:
none (default), slash (-p),
file-type (--file-type), classify (-F)
-i, --inode print the index number of each file
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN
-k like --block-size=1K
-l use a long listing format
-L, --dereference when showing file information for a symbolic
link, show information for the file the link
references rather than for the link itself
-m fill width with a comma separated list of entries
-n, --numeric-uid-gid like -l, but list numeric user and group IDs
-N, --literal print raw entry names (don't treat e.g. control
characters specially)
-o like -l, but do not list group information
-p, --indicator-style=slash
append / indicator to directories
-q, --hide-control-chars print ? instead of non graphic characters
--show-control-chars show non graphic characters as-is (default
unless program is `ls' and output is a terminal)
-Q, --quote-name enclose entry names in double quotes
--quoting-style=WORD use quoting style WORD for entry names:
literal, locale, shell, shell-always, c, escape
-r, --reverse reverse order while sorting
-R, --recursive list subdirectories recursively
-s, --size print the allocated size of each file, in blocks
-S sort by file size
--sort=WORD sort by WORD instead of name: none -U,
extension -X, size -S, time -t, version -v
--time=WORD with -l, show time as WORD instead of modification
time: atime -u, access -u, use -u, ctime -c,
or status -c; use specified time as sort key
if --sort=time
--time-style=STYLE with -l, show times using style STYLE:
full-iso, long-iso, iso, locale, +FORMAT.
FORMAT is interpreted like `date'; if FORMAT is
FORMAT1<newline>FORMAT2, FORMAT1 applies to
non-recent files and FORMAT2 to recent files;
if STYLE is prefixed with `posix-', STYLE
takes effect only outside the POSIX locale
-t sort by modification time
-T, --tabsize=COLS assume tab stops at each COLS instead of 8
-u with -lt: sort by, and show, access time
with -l: show access time and sort by name
otherwise: sort by access time
-U do not sort; list entries in directory order
-v natural sort of (version) numbers within text
-w, --width=COLS assume screen width instead of current value
-x list entries by lines instead of by columns
-X sort alphabetically by entry extension
-1 list one file per line
SELinux options:
--lcontext Display security context. Enable -l. Lines
will probably be too wide for most displays.
-Z, --context Display security context so it fits on most
displays. Displays only mode, user, group,
security context and file name.
--scontext Display only security context and file name.
--help display this help and exit
--version output version information and exit
SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.
Using color to distinguish file types is disabled both by default and
with --color=never. With --color=auto, ls emits color codes only when
standard output is connected to a terminal. The LS_COLORS environment
variable can change the settings. Use the dircolors command to set it.
Exit status:
0 if OK,
1 if minor problems (e.g., cannot access subdirectory),
2 if serious trouble (e.g., cannot access command-line argument).
Report ls bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'ls invocation'
$ sudo passwd
$ sudo passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
$ sudo smbpasswd -a ***
$ sudo smbpasswd -a ***
New SMB password:
Retype new SMB password:
tdbsam_open: Converting version 0.0 database to version 4.0.
tdbsam_convert_backup: updated /etc/samba/passdb.tdb file.
account_policy_get: tdb_fetch_uint32 failed for type 1 (min password length), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 2 (password history), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 3 (user must logon to change password), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 4 (maximum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 5 (minimum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 6 (lockout duration), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 7 (reset count minutes), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 8 (bad lockout attempt), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 9 (disconnect time), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 10 (refuse machine password change), returning 0
Added user ***.
17. 自分のアカウントのパスワードを変更
$ sudo passwd Changing password for user root. New password: Retype new password: passwd: all authentication tokens updated successfully.
出力結果をよく見てほしいのですが、これはrootユーザーのパスワードを変更しています。変更して欲しいのは自分のアカウントのパスワードなのでそれを変更して下さい。
を試して下さい。
それ以外はOKです。
レビュー頂き、ありがとうございます。 17-1, 2を試しましたので、ご確認よろしくお願いいたします。
$ sudo passwd (username)
$ sudo passwd ***
Changing password for user ***.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
$ passwd
$ passwd
Changing password for user ***.
Changing password for ***.
(current) UNIX password:
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
OKです、お疲れ様でした。
Software Design 2014年6月号p55-89、特集「UNIX必須コマンドトレーニング」より 新たな知見が得られましたので、ここに纏めます。
whatis
:コマンド名からマニュアルの要約を検索・表示
-w
:ワイルドカード(*
)を使うapropos
:引数に渡された文字列をコマンドの名前と要約から検索・表示パイプ( | )
を使ってコマンドを連結すれば良い。リダイレクト機能
を使う。
以下のコマンドはどちらもファイルへの出力コマンドだが、違いは次の通り。>
:既にファイルが存在する場合、空にして書込む【取扱注意】>>
:既にファイルが存在する場合、末尾に追記する今日は一先ずここまで。
■目的
Windowsではマウスをクリックするれば大抵のことはできますが、Linuxではコマンドを使って操作していきます。ここではPuTTYを用いて基本的なコマンドを覚えてもらいます。
■アクセス方法
自分のPCからPuTTYを使用して開発環境にリモートアクセスします。
■課題
下記のコマンドを実行しその結果を確認して下さい。入力したコマンドや実行前、実行後の確認や出力結果は、Issueのコメントに記述して下さい。記述する際にはMarkdown記述を用いて見やすいよう工夫して下さい。
echo "hello world";