[user@localhost ~]$ pwd /home/user
[user@localhost ~]$ cd / [user@localhost /]$ pwd / [user@localhost /]$ ls bin dev home lib media mnt proc sbin srv tmp var boot etc initrd lost+found misc opt root selinux sys usr
[user@localhost /]$ cd ~ [user@localhost ~]$ pwd /home/user
[user@localhost ~]$ cd ../.. [user@localhost /]$ pwd /
[user@localhost /]$ cd ~ [user@localhost ~]$ ls [user@localhost ~]$ ls -a . .bash_logout .bashrc .emacs .kde .zshrc .. .bash_profile .canna .gtkrc .xemacs
[user@localhost ~]$ ls -al 合計 52 drwx------ 4 user user 4096 5月 25 09:58 . drwxr-xr-x 7 root root 4096 5月 25 09:58 .. -rw-r--r-- 1 user user 302 5月 25 09:58 .bash_logout -rw-r--r-- 1 user user 191 5月 25 09:58 .bash_profile -rw-r--r-- 1 user user 124 5月 25 09:58 .bashrc -rw-r--r-- 1 user user 5542 5月 25 09:58 .canna -rw-r--r-- 1 user user 438 5月 25 09:58 .emacs -rw-r--r-- 1 user user 120 5月 25 09:58 .gtkrc drwxr-xr-x 3 user user 4096 5月 25 09:58 .kde drwxr-xr-x 2 user user 4096 5月 25 09:58 .xemacs -rw-r--r-- 1 user user 658 5月 25 09:58 .zshrc
[user@localhost ~]$ mkdir Literacy [user@localhost ~]$ ls Literacy
[user@localhost ~]$ cd Literacy/ [user@localhost Literacy]$ wget http://rat.cis.k.hosei.ac.jp/data/lili.zip --10:03:21-- http://rat.cis.k.hosei.ac.jp/data/lili.zip => `lili.zip' rat.cis.k.hosei.ac.jp をDNSに問いあわせています... 133.25.90.36 rat.cis.k.hosei.ac.jp[133.25.90.36]:80 に接続しています... 接続しました。 HTTP による接続要求を送信しました、応答を待っています... 200 OK 長さ: 8,039 [application/zip] 100%[====================================>] 8,039 --.--K/s 10:03:21 (53.99 MB/s) - `lili.zip' saved [8,039/8,039] [user@localhost Literacy]$ ls lili.zip [user@localhost Literacy]$ unzip lili.zip Archive: lili.zip inflating: LinuxLiteracy01.tar.gz [user@localhost Literacy]$ ls LinuxLiteracy01.tar.gz lili.zip
[user@localhost Literacy]$ tar -zxf LinuxLiteracy01.tar.gz [user@localhost Literacy]$ ls LinuxLiteracy01.tar.gz drill_2 drill_4 drill_6 drill_8 gpl2.txt lili.zip drill_1 drill_3 drill_5 drill_7 drill_9 hello
tarのオプションは解凍時に-zx(v)f、圧縮時に-c(v)fを指定します。
[user@localhost Literacy]$ ls ~/Literacy/ LinuxLiteracy01.tar.gz drill_2 drill_4 drill_6 drill_8 gpl2.txt lili.zip drill_1 drill_3 drill_5 drill_7 drill_9 hello [user@localhost Literacy]$ ls -F ~/Literacy/ LinuxLiteracy01.tar.gz drill_3/ drill_6/ drill_9/ lili.zip drill_1/ drill_4/ drill_7/ gpl2.txt drill_2/ drill_5/ drill_8/ hello
lsの-Fオプションは、ファイルの種類によって末尾に記号を付加します。
drill_*はディレクトリなのでファイル名の後に'/'が付加されています。
[user@localhost Literacy]$ cat hello Hello! Linux world.
[user@localhost Literacy]$ cp hello hello.bak [user@localhost Literacy]$ ls LinuxLiteracy01.tar.gz drill_2 drill_4 drill_6 drill_8 gpl2.txt hello.bak drill_1 drill_3 drill_5 drill_7 drill_9 hello lili.zip [user@localhost Literacy]$ cat hello.bak Hello! Linux world.
[user@localhost Literacy]$ rm hello [user@localhost Literacy]$ ls LinuxLiteracy01.tar.gz drill_2 drill_4 drill_6 drill_8 gpl2.txt lili.zip drill_1 drill_3 drill_5 drill_7 drill_9 hello.bak
[user@localhost Literacy]$ mv hello.bak hello [user@localhost Literacy]$ ls LinuxLiteracy01.tar.gz drill_2 drill_4 drill_6 drill_8 gpl2.txt lili.zip drill_1 drill_3 drill_5 drill_7 drill_9 hello [user@localhost Literacy]$ cat hello Hello! Linux world.
[user@localhost Literacy]$ cat gpl2.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your ---------------------------------------------------------------------------------/ [user@localhost Literacy]$ head gpl2.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. ---------------------------------------------------------------------------------/ [user@localhost Literacy]$ tail gpl2.txt ---------------------------------------------------------------------------------/ `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice
[user@localhost Literacy]$ less gpl2.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your ---------------------------------------------------------------------------------/
[user@localhost Literacy]$ find ~/Literacy/ -name sample /home/user/Literacy/drill_4/drill_7/sample /home/user/Literacy/drill_3/drill_2/sample
[user@localhost Literacy]$ mv drill_1 drill_10 [user@localhost Literacy]$ ls LinuxLiteracy01.tar.gz drill_2 drill_4 drill_6 drill_8 gpl2.txt lili.zip drill_10 drill_3 drill_5 drill_7 drill_9 hello
[user@localhost Literacy]$ cp -r drill_2 drill_11 [user@localhost Literacy]$ ls LinuxLiteracy01.tar.gz drill_11 drill_3 drill_5 drill_7 drill_9 hello drill_10 drill_2 drill_4 drill_6 drill_8 gpl2.txt lili.zip
ディレクトリをコピーする場合は-rオプションを指定します。
[user@localhost ~]$ rm -r Literacy/
ディレクトリを削除する場合はオプション-rを指定します。