grep

PATH/etc/passwd/etc/group/etc/shadow/etc/gshadow

passwddpkg

deb

rpm

dpkg

apt-get

apt
rpm

yum

dnf

dpkg

rpm
apt-get
yum

apt

dnf

figletfiglet$ figlet-bash: figlet: command not foundapt-cacheaptsearchパッケージ名searchパッケージ名

apt-cachefiglet$ apt-cache search figlet
figlet - Make large character ASCII banners out of ordinary
text （通常のテキストを大きなASCII文字バナーで表示する）

root
sudo
apt-getinstall

パッケージ名aptinstall

パッケージ名$ sudo apt-get install figlet
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
figlet0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Need to get 184 kB of archives.
After this operation, 741 kB of additional disk space will be used.
Get:1 http://archive.raspbian.org/raspbian stretch/main armhf figlet armhf 2.2.5-2[184 kB]
Fetched 184 kB in 0s (213 kB/s)
Selecting previously unselected package figlet.
(Reading database ... 115701 files and directories currently installed.)
Preparing to unpack .../figlet_2.2.5-2_armhf.deb ...
Unpacking figlet (2.2.5-2) ...
Setting up figlet (2.2.5-2) ...
update-alternatives: using /usr/bin/figlet-figlet to provide /usr/bin/figlet(figlet) in auto mode
Processing triggers for man-db (2.7.6.1-2) ...

$ figlet Awesome!
_

_

/ \__

_____

___

___

_ __ ______| |/ _ \ \ /\ / / _ \/ __|/ _ \| '_ ` _ \ / _ \ |/ ___ \ V/_/V /__/\__ \ (_) | | | | | |__/_|\_\_/\_/ \___||___/\___/|_| |_| |_|\___(_)

yumsearchパッケージ名searchパッケージ名dnf

$ yum search speaking cow
Last metadata expiration check: 1:30:49 ago on Tue 23 Apr 2019 11:02:33 PM -03.
==================== Name & Summary Matched: speaking, cow ====================
cowsay.noarch : Configurable speaking/thinking cow （設定可能な話す/考える牛）

yuminstall

パッケージ名dnf

install

ッケージ名$ sudo yum install cowsay
Last metadata expiration check: 2:41:02 ago on Tue 23 Apr 2019 11:02:33 PM -03.
Dependencies resolved.
==============================================================================
PackageArch

VersionRepository

Size==============================================================================
Installing:
cowsaynoarch

3.04-10.fc28

fedora46 k

Transaction Summary==============================================================================
Install

1 Package

Total download size: 46 k
Installed size: 76 k
Is this ok [y/N]: y

Downloading Packages:
cowsay-3.04-10.fc28.noarch.rpm

490 kB/s |

46 kB

00:00

==============================================================================Total

53 kB/s |

46 kB

00:00

Running transaction checkTransaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing:

1/1

Installing: cowsay-3.04-10.fc28.noarch

1/1

Running scriptlet: cowsay-3.04-10.fc28.noarch

1/1パVerifying: cowsay-3.04-10.fc28.noarch

1/1

Installed:cowsay.noarch 3.04-10.fc28
Complete!

cowsay$ cowsay "Brought to you by yum"_______________________< Brought to you by yum >----------------------\^__^\(oo)\_______
(__)\

)\/\

||----w |||||figletcowsayremoveパッケージ名yum

apt-getremoveremoveパッケージ名パッケージ名sudo$ sudo apt-get remove figlet
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
figlet0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 741 kB disk space will be freed.
Do you want to continue? [Y/n] Y

dnf

apt

removeremoveパッケージ名(Reading database ... 115775 files and directories currently installed.)
Removing figlet (2.2.5-2) ...
Processing triggers for man-db (2.7.6.1-2) ...

$ sudo yum remove cowsay
Dependencies resolved.
==================================================================================
PackageArch

VersionRepository

Size==================================================================================
Removing:
cowsaynoarch

3.04-10.fc28@fedora

76 k

Transaction Summary==================================================================================
Remove1 Package

Freed space: 76 k
Is this ok [y/N]: yRunning transaction checkTransaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing:

1/1

Erasing: cowsay-3.04-10.fc28.noarch

1/1

Running scriptlet: cowsay-3.04-10.fc28.noarch

1/1

Verifying

1/1: cowsay-3.04-10.fc28.noarch

Removed:cowsay.noarch 3.04-10.fc28
Complete!

203.0.113.165

www.lpi.org

dpkgrpm
apt-get
yum
dnf

png
doc
xls
ppt
wav

dpkgrpm
apt-getyumdnf

apt-getinstall

blender
blender

png
doc
xls
ppt
wav

apt-get purge cupsCOPYINGCtrl

Alt

F#

F#

Ubuntu 18.10 arrelia tty3
arrelia login:arrelia

tty3
Ctrl

Alt

F3

F3

DNT:

Ctrl

1

Ctrl

Shift

Shift

N

P
Ctrl

Cmd

qwerty

IwbhiIha1000flM

123456654321Ctrl

Shift

A

Ctrl

Alt

F#

Ctrl

ShiftAechohistory
PATH
exporttype

ユーザー名@ホスト名 作業ディレクトリ 種別

carol@mycomputer:~$root@mycomputer:~#[dave@mycomputer ~]$[root@mycomputer ~]#

ユーザー名

ホスト名
hostname

作業ディレクトリ
~

種別
$
#

root

$

コマンド

[オプション/パラメータ...][引数...]$ ls -l /home

ls

-l
-l
--format=long$ ls -al$ ls -a -l$ ls --all --format=long/home--helpcd

setexportPATH

type$ type echo
echo is a shell builtin$ type man
man is /usr/bin/man$ TWOWORDS="two words"$ touch $TWOWORDS$ ls -l-rw-r--r-- 1 carol carol

0 Mar 10 14:56 two-rw-r--r-- 1 carol carol

0 Mar 10 14:56 words$ touch "$TWOWORDS"

$ ls -l-rw-r--r-- 1 carol carol

0 Mar 10 14:56-rw-r--r-- 1 carol carol

0 Mar 10 14:58 'two words'

two-rw-r--r-- 1 carol carol

0 Mar 10 14:56

words$ touch '$TWOWORDS'$ ls -l-rw-r--r-- 1 carol carol

0 Mar 10 15:00 '$TWOWORDS'-rw-r--r-- 1 carol carol

0 Mar 10 14:56-rw-r--r-- 1 carol carol

0 Mar 10 14:58 'two words'-rw-r--r-- 1 carol carol

0 Mar 10 14:56

two
words

TWOWORDS=

$

\

`
\

¥

$USER

$ echo I am $USER
I am tom$ echo "I am $USER"
I am tom$ touch new file$ ls -l-rw-rw-r-- 1 tom students 0 Oct 8 15:18 file-rw-rw-r-- 1 tom students 0 Oct 8 15:18 new$ touch "new file"$ ls -l-rw-rw-r-- 1 tom students 0 Oct 8 15:19 new file

touch

_

.

$ echo I am $USER
I am tom$ echo 'I am $USER'
I am $USER$USER$ echo $USER
carol

\

$ echo \$USER$USER

cat -n /etc/passwd
cat-n/etc/passwd
ls -l /etc

ls -l -a

cd /home/user

pwd
mv

cd
cat
exit

echo "$HOME is my home directory"
touch "$USER"
touch 'touch'echo /home/user is my home directory

{

}
game
game1

game2

bash

echo

ls

type

touch

hostnamels -l /etc
ls
-l
/etc
ls -l -als-l -a

cd /home/user
cd/home/user

cd
cat
exit

touch "$USER"
touch 'touch'

touch

{

}
game
game1

game2

$ touch game{1..5}
$ ls
game1

game2

game3

game4

game5

game
?

$ rm game?

PATH
USER=$ greeting=hello=echo$ echo greeting
greeting$$ echo $greeting
hello

DATE

$ echo $greetingecho$ echo $greeting world
hello world$ bash -c 'echo $greeting world'
world

unset

$ echo $greetinghey$ unset greeting$ echo $greeting

unset

$
$
unset

export$ greeting=hello$ export greeting

export$ export greeting=hey$ export greeting=hey$ echo $greeting world
hey world$ bash -c 'echo $greeting world'
hey world

TZ

date

$ TZ=EST date
Thu 31 Jan 10:07:35 EST 2019
$ TZ=GMT date
Thu 31 Jan 15:07:35 GMT 2019

env
PATH
PATH

$ echo $PATH/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$ PATH=$PATH:new_directory

$ echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin$ PATH=$PATH:/home/user/bin$ echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/user/bin

PATH

$PATH

$PATH

$ mybin=/opt/bin$ PATH=$PATH:$mybin$ echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/user/bin:/opt/bi
n

PATH
PATH

$ echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

which
nano

$ which nano
/usr/bin/nano

nano/usr/bin$ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/usr/games$ echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/usr/gamesnano

$ which nanowhich: no nano in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/usr/games)$ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin$ which nano
/usr/bin/nano

PATHnumberORDERnr_files/etc/passwd
wc

ME

ME

USER

:

HOME

ME

today

today1env

echo

exportunset

number$ number=5

ORDER$ export ORDER=desc$ echo number
number$ echo ORDER
ORDER$ echo $number
5$ echo $ORDER
desc

numberORDER

nr_files/etc/passwd
wc$ nr_files=`wc -l /etc/passwd`

ME$ export ME=$USER

USER

ME

:

HOME

ME

$ ME=$ME:$HOME$ echo $ME
user:/home/user

today$ today=$(TZ=GMT date)$ echo $today
Thu 31 Jan 15:07:35 GMT 2019

$ today=$(TZ=EST date)$ echo $today
Thu 31 Jan 10:07:35 EST 2019

today1$ today1=$(date)$ echo $today1
Thu 31 Jan 10:07:35 EST 2019

man
info
/usr/share/doc/
locate/usr/share/doc/

man

help

info
man

locate--helpinfo

--helpman
man$ man mkdir

mkdir
Q

passwd
passwdpasswd/etc/passwd

passwdpasswd(1)passwd(5)manpasswdpasswd(1)

man

man

1

passwdless5

passwdless
linux/linux?linuxNH$ info mkdir

man

man

info
?

/usr/share/doc//usr/share/doc/

README
readme.txt

READMEREADME

locatelocatelocate$ locate note/lib/udev/keymaps/zepto-znote/usr/bin/zipnote/usr/share/doc/initramfs-tools/maintainer-notes.html/usr/share/man/man1/zipnote.1.gz

locatelocatelocateパターン

locate*PATTERN*
locatelocateupdatedb
updatedb

find
find

find
locatefindlocatelocate

find

find
-name

~$ cd Downloads~/Downloads$ find . -name thesis.pdf./thesis.pdf~/Downloads$ find ~ -name thesis.pdf/home/carol/Downloads/thesis.pdf

find

find

Downloads

man

ls
cat
cut
cd
cp
mv
mkdir
touch
wc
passwd
rm
rmdir
more
less
whereis
head
tail
sort
tr
chmod
grep
ls

man

locateREADMEtest

locatefindlocateman

User├── Documents|├──Hello||├──hey2||├──helloa||└──ola5|└──World|└──earth9├── Downloads|├──Music|└──Songs|├──collection1|└──collection2├── Test|└── passa└── test

man
man
man
info

man

info

locatelocatefind

updatedb
locate

man

ls
cat
cut
cd
cp
mv

mkdir
touch

wc

passwd
rm
rmdir
more
less

whereis

head
tail
sort

tr

chmod
grep
ls

-t

--sort=timemanlocateREADME$ locate -l 3 README/etc/alternatives/README/etc/init.d/README/etc/rc0.d/README

test$ touch test
$ locate test
/home/user/test

locate$ sudo updatedb

find$ find ~ -name test

locate$ find . -name test
/home/user/test

man

cd

User
├── Documents|├──Hello||├──hey2||├──helloa||└──ola5|└──World|└──earth9├── Downloads|├──Music|└──Songs|├──collection1|└──collection2├── Test|└── passa└── test

mkdir

touch

$ ls -R$ find ~ -name "*[0-9]"$ locate "*[0-9]"

$ rm -r Documents Downloads Test test

ls

cd
.
home

..
~

$ treeDocuments├── Mission-Statement.txt└── Reports└── report2018.txt
1 directory, 2 files

Documents

Mission-Statement.txt

Reports

Reportsreport2018.txt

Documents

Reportstree\$ cd Mission\ Statements

report2018.txt

.

.txt

user@hostname ~/Documents/Reports $userhostname
Reports

user@hostname ~/Documents/Reports $ pwd/home/user/Documents/Reportspwd/Documents

user

user

Reports

Documents

home

home
home

/

pwd
/home/user~ls

user@hostname ~/Documents/Reports $ ls
report2018.txt

ls
ls

ls

cd
pwd
/home/user/Documents/Reports

user@hostname ~ $ cd /home/user/Documents
user@hostname ~/Documents $ pwd/home/user/Documents
user@hostname ~/Documents $ ls
Mission-Statement.txt Reports

Mission-Statement.txt

Reports
Reports

user@hostname ~/Documents $ cd Reports
user@hostname ~/Documents/Reports $ pwd/home/user/Documents/Reports

user@hostname ~/Documents/Reports $ ls
report2018.txt

pwd/

Reports//└── home└── user└── Documents└── Reports

Reports

cd

ls

Reports-als

user@hostname ~/Documents/Reports $ ls -a.
..
report2018.txt

-a

ls

.
Reports..
Documents./report2018.txt
report2018.txt.

user@hostname ~/Documents/Reports $ cd ..
user@hostname ~/Documents $ pwd/home/user/Documents..

user@hostname ~/Documents $ cd ../..
$ pwd
/home

cd

/home/user/Downloads../Reports
/var
docs
/
tree
/
tree

$ sudo tree -F //├── etc/│├── network/

│

│

│

├── systemd/││├── resolved.conf││├── system/││├── system.conf││├── user/││└── user.conf│└── udev/└── interfaces│├── rules.d/│└── udev.conf└── home/├── lost+found/└── user/└── Documents/
12 directories, 5 files-F/$ cd /etc/udev$ ls -a

ls -a

/

home

lost+found//etc/network/$ cd home/lost+found/home/user/Documents//etc/systemd/system/$ pwd/etc/udev/rules.d$ cd ../../systemd/user$ cd ..
$ pwd

pwd

/etc/

/home/user/

$ mkdir "this is a test"$ lsthis is a test

cd

cd

\

this

ls

親
絶対パス

サブディレクトリ
相対パス
.

cd
pwd
ls -a

cd

pwd

ls

mkdir

tree

..

/home/user/Downloads../Reports
/var
docs
/
tree
/
tree

$ sudo tree -F //├── etc/│├── network/

│

│

│

├── systemd/││├── resolved.conf││├── system/││├── system.conf││├── user/││└── user.conf│└── udev/└── interfaces│├── rules.d/│└── udev.conf└── home/├── lost+found/└── user/└── Documents/
12 directories, 5 files$ cd /etc/udev-F/$ ls -als -a

. .. rules.d udev.conf

/

home

lost+found//etc/network/$ cd home/lost+found$ cd etc/network/home/user/Documents//etc/$ cd /etc/etc/systemd/system/$ cd /home/user$ pwd/etc/udev/rules.d$ cd ../../systemd/user$ cd ..
$ pwd

pwd/home/user/

/etc/systemd

$ mkdir "this is a test"$ lsthis is a test

cd

$ cd this\ is\ a\ test

cd

this

$ cd this\ is\ a\ test

\

ls

\\

$ mkdir my\\dir$ ls'my\dir'$ rmdir 'my\dir'$ tree -L 1 //├── bin├── boot├── cdrom├── dev├── etc├── home├── lib├── mnt├── opt├── proc├── root├── run├── sbin├── srv├── sys├── tmp├── usr└── var

/bin

ls

/etc

/var

home

$ tree -L 1 /home/home├── user├── michael└── lara$ tree /home/useruser└── Documents├── Mission-Statement└── Reports└── report2018.txt$ tree /home/home├── user│└── Documents│├── Mission-Statement│└── Reports│└── report2018.txt├── michael│├── Documents

│

│

│

└── Music└── presentation-for-clients.odp

lara
/home

user@hostname ~ $~$ cd ~$ ls
Documentsls/homeuser

michaelsu

user@hostname ~ $ pwd/home/user
user@hostname ~ $ su - michael
Password:michael@hostname ~ $ pwd/home/michael~/home/michaelmichaellara~~/home/lara

~
user

$ ls
Documents$ cd Documents$ lsMission-Statement
Reports$ cd Reports$ lsreport2018.txt$ cd ~$ ls
Documents

user~

Documents/Reports

cd
cd$ cd Documents/Reports$ pwd/home/user/Documents/Reports
$ cd
$ pwd

/home/user~$ ls ~michael
Documents
Musicmichaelmichaeluserreport2018.txt

michaelmichaelless$ less ~user/Documents/Reports/report2018.txt

~

ls

-a
.

..

ls
-a

$ ls -a ~.
..
.bash_history.bash_logout.bash-profile.bashrc
Documents

.

-a

ls

$ ls -l-rw-r--r-- 1 user staff

3606 Jan 132017 report2018.txt-l-rw-r—r-d1

user staff
user

staff

3606

Jan 13 2017

report2018.txt

ls

ls -lhKM
ls -d */
-d*/ls -lt長い形式

変更日時

ls -lrt
長い形式

変更日時

-r

ls -lX
長い形式

ファイル名のサフィックス

.txt

.jpg

ls -S
-S

-t

ls -R
-R

ls

$ ls ~
Documents

user
ls

-X

tree

tree
tree

ls

-R

$ tree /home/useruser└── Documents├── Mission-Statement└── Reports└── report2018.txt$ ls -R ~/home/user/:Documents/home/user/Documents:
Mission-Statement
Reports/home/user/Documents/Reports:
report2018.txt

user
ls
ls
Statement

Mission-

ReportslslslsDocuments-R/├── etc/│├── network/

│

│

│

├── systemd/││├── resolved.conf││├── system/││├── system.conf││├── user/││└── user.conf│└── udev/└── interfaces/│├── rules.d│└── udev.conf└── home/├── lost+found/├── user/│└── Documents/└── michael/└── Music/

network/etc/udev

user

user

Documents

michaelMusic

drwxrwxrwx

5 eric eric

4.0K Apr 26

2011 China/-rwxrwxrwx

1 eric eric

1.5M Jul 18

2011 img_0066.jpg-rwxrwxrwx

1 eric eric

1.5M Jul 18

2011 img_0067.jpg-rwxrwxrwx

1 eric eric

1.6M Jul 18

2011 img_0074.jpg-rwxrwxrwx

1 eric eric

1.8M Jul 18

2011 img_0075.jpg

ls -lh-rwxrwxrwx

1 eric eric

46K Jul 18

2011 scary.jpg-rwxrwxrwx

1 eric eric

469K Jan 292018 Screenshot from 2017-08-13 21-22-

1 eric eric

498K Jan 292018 Screenshot from 2017-08-14 21-18-

1 eric eric

211K Jan 292018 Screenshot from 2018-01-06 23-29--rwxrwxrwx

1 eric eric

150K Jul 18

2011 tobermory.jpg

drwxrwxrwx

6 eric eric

4.0K Apr 26

2011 Tokyo/-rwxrwxrwx

1 eric eric

1.4M Jul 18

2011 Toronto 081.jpg-rwxrwxrwx

1 eric eric

1.4M Jul 18

2011 Toronto 085.jpg-rwxrwxrwx

1 eric eric

944K Jul 18

2011 Toronto 152.jpg-rwxrwxrwx

1 eric eric

728K Jul 18

2011 Toronto 173.jpg

drwxrwxrwx

2 eric eric

4.0K Jun

2016 Wallpapers/

24.png-rwxrwxrwx
07.png-rwxrwxrwx
30.pngls -lrSls -ad */

5

ls

du

-h

ll
ll

-lh

ls

-l
man

ll

~
~

ls
-a

-d

-h

-l

-r

-R

-S

-t

-X

/
├── etc/│├── network/

│

│

│

├── systemd/││├── resolved.conf││├── system/││├── system.conf││├── user/││└── user.conf│└── udev/└── interfaces/│├── rules.d│└── udev.conf└── home/├── lost+found/├── user/│└── Documents/└── michael/└── Music/

network

cd /etc/network/etc/udev

user

cd ~/Documentsuser

michaelcd ~michael/Music

ls

-lh
d

Music

Documents

drwxrwxrwx

5 eric eric

4.0K Apr 26

2011 China/-rwxrwxrwx

1 eric eric

1.5M Jul 18

2011 img_0066.jpg-rwxrwxrwx

1 eric eric

1.5M Jul 18

2011 img_0067.jpg-rwxrwxrwx

1 eric eric

1.6M Jul 18

2011 img_0074.jpg-rwxrwxrwx

1 eric eric

1.8M Jul 18

2011 img_0075.jpg-rwxrwxrwx

1 eric eric

46K Jul 18

2011 scary.jpg-rwxrwxrwx

1 eric eric

469K Jan 292018 Screenshot from 2017-08-13 21-22-

1 eric eric

498K Jan 292018 Screenshot from 2017-08-14 21-18-

1 eric eric

211K Jan 292018 Screenshot from 2018-01-06 23-29--rwxrwxrwx

1 eric eric

150K Jul 18

2011 tobermory.jpg

drwxrwxrwx

6 eric eric

4.0K Apr 26

2011 Tokyo/-rwxrwxrwx

1 eric eric

1.4M Jul 18

2011 Toronto 081.jpg-rwxrwxrwx

1 eric eric

1.4M Jul 18

2011 Toronto 085.jpg-rwxrwxrwx

1 eric eric

944K Jul 18

2011 Toronto 152.jpg-rwxrwxrwx

1 eric eric

728K Jul 18

2011 Toronto 173.jpg

drwxrwxrwx

2 eric eric

4.0K Jun

2016 Wallpapers/

24.png-rwxrwxrwx
07.png-rwxrwxrwx
30.pngls -lrS

ls
scary.jpg
ls -ad */

5

ls

du

-lh

-h

du
du

ll

-s

ls

ll

ll

ls

-l
man

-l
ll

ll

mv cp rm touch
mkdir rmdir

ls
touch

rm

rmdir

echo

cat

mkdir

mv

cp

pwd

find

/etc//ETC/$ cd /
$ ls
bin

dev

home

lib64

mnt

proc

run

srv

tmp

boot

etc

lib

media

opt

root

sbin

sys

usr

var

$ cd ETC
bash: cd: ETC: No such file or directory$ pwd/$ cd etc
$ pwd
/etc

pwd

/ETC
/etc

mkdir

$ cd ~$ pwd/home/user$ ls
Desktop

Documents

Downloads$ mkdir linux_essentials-2.4$ ls
Desktop

Documents

Downloads

linux_essentials-2.4$ cd linux_essentials-2.4$ pwd/home/emma/linux_essentials-2.4

$ cd ~/linux_essentials-2.4

~

mkdir

$ mkdir creating moving copying/files copying/directories deleting/directories
deleting/files globs
mkdir: cannot create directory ‘copying/files’: No such file or directory
mkdir: cannot create directory ‘copying/directories’: No such file or directory
mkdir: cannot create directory ‘deleting/directories’: No such file or directory
mkdir: cannot create directory ‘deleting/files’: No such file or directory$ lscreating

globs

movingmovingcopying

globs

creating

deleting

mkdir

mkdir

--parents
-p

mkdir

$ mkdir -p creating moving copying/files copying/directories deleting/directories
deleting/files globs$ find.
./creating./moving./globs./copying./copying/files./copying/directories./deleting-p./deleting/directories./deleting/files

find

ls

-t

-r

-t
-r

touch
touch

$ touch globs/question1 globs/question2012 globs/question23 globs/question13
globs/question14$ touch globs/star10 globs/star1100 globs/star2002 globs/star2013

globs$ cd globs$ lsquestion1

question14

question23

star1100

question13

question2012

star10star2002

touch

star2013

cat$ cat question14

touch

echo

>

$ echo hello > question15$ cat question15
hello

echo

>
echo
hello

question15

echo

>

mv
moving$ cd ~/linux_essentials-2.4/moving$ touch file1 file22$ echo file3 > file3$ echo file4 > file4
$ ls
file1

file22

file22

file3

file4

file2

mv

$ mv file22 file2
$ ls
file1

file2

file3

file4

mv
file3

$ cat file3

file4

file3$ cat file4
file4$ mv file4 file3$ cat file3
file4
$ ls
file1

file2

file3

file3

file4

-i

mv

$ touch file4 file5$ mv -i file4 file3
mv: overwrite ‘file3’? ymv$ cd ~/linux_essentials-2.4/moving$ mkdir dir1 dir2
$ ls
dir1

dir2

file1

dir1

file1

file2

file3

file3

file5

file5

$ mv file1 dir1
$ ls
dir1

dir2

file2

$ ls dir1
file1

mv
mv

$ mv file2 file3 dir2
$ ls
dir1

dir2

file5

$ ls dir2
file2

file3

mv

dir1
dir3

$ ls
dir1

dir2

file5

$ ls dir1
file1$ mv dir1 dir3
$ ls
dir2

dir3

file5

$ ls dir3
file1

rm

rmdir
file5

$ cd ~/linux_essentials-2.4/moving
$ ls
dir2

dir3

file5

$ rmdir file5
rmdir: failed to remove ‘file5’: Not a directory$ rm file5
$ ls
dir2

dir3

rmdir
rm

deleting$ cd ~/linux_essentials-2.4/$ ls
copying

creating$ rmdir deleting

deleting

globs

movingmovingrmdir: failed to remove ‘deleting’: Directory not empty$ ls -l deleting
total 0drwxrwxr-x. 2 emma emma 6 Mar 26 14:58 directories
drwxrwxr-x. 2 emma emma 6 Mar 26 14:58 files

rmdir

deleting
rmdir$ ls -a deleting/files.

..

$ rmdir deleting/files$ ls -l deleting
directories

rm
-r

rm

-r
rm

rm

-r

$ ls
copying

creating

deleting

globs

moving$ rm deleting
rm: cannot remove ‘deleting’: Is a directory$ ls -l deleting
total 0drwxrwxr-x. 2 emma emma 6 Mar 26 14:58 directories$ rm -r deleting$ lscopying

creating

globs

movingdeleting-irm -ri$ find.
./creating

movingmv

rm-r

./moving./moving/dir2./moving/dir2/file2./moving/dir2/file3./moving/dir3./moving/dir3/file1./globs./globs/question1./globs/question2012./globs/question23./globs/question13./globs/question14./globs/star10./globs/star1100./globs/star2002./globs/star2013./globs/question15./copying./copying/files./copying/directories$ rm -ri moving
rm: descend into directory ‘moving’? yrm: descend into directory ‘moving/dir2’? y
rm: remove regular empty file ‘moving/dir2/file2’? y
rm: remove regular empty file ‘moving/dir2/file3’? y
rm: remove directory ‘moving/dir2’? yrm: descend into directory ‘moving/dir3’? y
rm: remove regular empty file ‘moving/dir3/file1’? y
rm: remove directory ‘moving/dir3’? y
rm: remove directory ‘moving’? ycp$ cd ~/linux_essentials-2.4/copying$ lsdirectories

files$ cp /etc/nsswitch.conf files/nsswitch.conf$ cp /etc/issue /etc/hostname files

cp

copying

mv

cp

cp
hostnameissue$ cd ~/linux_essentials-2.4/copying/files$ lshostname

issue

nsswitch.conf$ cat hostname
mycomputer$ cat issue
Debian GNU/Linux 9 \n \l$ cp hostname issue$ cat issue
mycomputer

files

directories$ cd ~/linux_essentials-2.4/copying$ cp files directories
cp: omitting directory ‘files’ （訳注: ディレクトリ `files`は除外）

cp-r$ cp -r files directories$ find.
./files./files/nsswitch.conf./files/fstab./files/hostname./directories./directories/files./directories/files/nsswitch.conf./directories/files/fstab./directories/files/hostname

-r

cp

cp

$ cp -r files files2$ find.
./files./files/nsswitch.conf./files/fstab./files/hostname./directories./directories/files./directories/files/nsswitch.conf./directories/files/fstab./directories/files/hostname./files2./files2/nsswitch.conf./files2/fstab./files2/hostname

*

?

[]

$ cd ~/linux_essentials-2.4/globs$ lsquestion1

question14

question2012

star10star2002

question13

question15

question23

star1100

star2013$ ls star1*
star10

star1100$ ls star*
star10

star1100

star2002

star2013$ ls star2*
star2002

star2013$ ls star2*2
star2002$ ls star2013*
star2013

*

star*

star

ls

star*

ls

start*
star*ls$ ls star*ls$ ls star10

ls

star1100

star2002

star2013*$ ls star\*ls: cannot access star*: No such file or directory

\
star*

ls

star*

?

$ ls
question1

question14

question2012

star10star2002

starquestion13

question15

question23

star1100

star2013$ ls question?
question1$ ls question1?
question13

question14

question15$ ls question?3question13

question23$ ls question13?
ls: cannot access question13?: No such file or directory

[

]

[
!

^

$ mkdir brackets$ cd brackets$ touch file1 file2 file3 file4 filea fileb filec file5 file6 file7

[ ]

-

$ ls
file1

file2

file3

file4

file5

file6

file7

file5

file6

file6

file7

filea

filea

fileb

filec

$ ls file[1-2]
file1

file2

$ ls file[1-3]
file1

file2

file3

$ ls file[1-25-7]
file1

file2

file5

$ ls file[1-35-6a-c]
file1

file2

file3

$ ls file[1a5]
file1

file5

filea

]

fileb

filec

^

$ ls file[^a]
file1

file2

file3

file4

file5

file6

file7

fileb

filec

[:クラス
名:]

$ ls file[[:digit:]]
file1

file2

file3

file4

file5

file6

file7

file5

file6

file7

$ touch file1a file11$ ls file[[:digit:]a]
file1

file2

file3

file4

filea

$ ls file[[:digit:]]a
file1afile[[:digit:]a][:alnum:][:alpha:][:blank:][:cntrl:][:digit:]
0123456789[:graph:]filea[:lower:]a-z[:print:]
alnum

punct

[:punct:]!

&"[:space:][:upper:]A-Z[:xdigit:]
0123456789abcdefABCDEF

mkdir-p/tmp/outfiles/text/today

$ pwd
/tmp
$ find.
./outfiles./outfiles/text/tmp/tmp/outfiles/tmp/outfiles/text/tmp/outfiles/text/today/tmp/infiles/tmp/infiles/text/tmp/infiles/text/today
mkdir

rm

cp

-v

mv

old

log_[a-z]_201?_*_01.txt
log_3_2017_Jan_01.txt
log_+_2017_Feb_01.txt/tmp/infiles/text/today

log_b_2007_Mar_01.txt
log_f_201A_Wednesday_01.txt

doc100doc200doc301
doc401

cp

rmdir

-p

rm

rm

mv

cp -u

-i

-ri

/*

-f

cp
mkdir

rm

rmdir

-i

-r

cat

cp

echo

find

ls

mkdir

mv

pwd

-r

mv

rm

rmdir

touch

mkdir-p/tmp/outfiles/text/today/tmp/infiles/text/today

$ pwd
/tmp
$ find.
./outfiles./outfiles/text/tmp/tmp/outfiles/text

mkdir

/tmp
/tmp/outfiles/tmp/outfiles/text/tmp/outfiles/text/today/tmp/infiles/tmp/infiles/text/tmp/infiles/text/today
mkdir

rm

cp
-v

$ rm -v a b
removed 'a'removed 'b'$ mv -v a b'a' -> 'b'$ cp -v b c'b' -> 'c'cp-v/tmp/outfiles

$ touch a b c d$ cp a b c d
cp: target 'd' is not a directorymv
mv$ mv a a
mv: cannot move 'a' to a subdirectory of itself, 'a/a'

old

rm

$ rm old*

log_[a-z]_201?_*_01.txt
log_3_2017_Jan_01.txt
log_+_2017_Feb_01.txt
log_b_2007_Mar_01.txt
log_f_201A_Wednesday_01.txt$ ls log_[a-z]_201?_*_01.txt
log_f_201A_Wednesday_01.txt

log_[a-z]log_f_201A_Wednesday_01.txt
_201?

_201

log_f_201A_Wednesday_01.txt_01.txt

doc100doc200log_
log_b_2007_Mar_01.txt*_01.txt

doc301
doc401doc*
doc[1-4]*
doc?0?
doc[1-4]0?

cp

-p

$ man cp-p

same as --preserve=mode,ownership,timestamps--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,time‐stamps), if

possible

additional

attributes:

context,

xattr, all
訳: 指定した属性（デフォルトでは、モード、所有者、タイムスタンプ）を保存します。さらに指定できる属性: context, links, xattr, all

rmdir

-p

rmdir

rm

-p

mkdir

-p

$ find.
./a./a/b./a/b/c$ rmdir -p a/b/c
$ ls

rm

mv

-i

-n

$ cat a-ri--no-clobber

mv

/*

-f

links,

a$ cat bb
$ mv -n a b$ cat b
b

cp -u
cp

-u

$ ls -ltotal 24K
drwxr-xr-x 123 emma student

12K Feb

2 05:34 ..

drwxr-xr-x

2 emma student 4.0K Feb

2 06:56 .

-rw-r--r--

1 emma student

2 Feb

2 06:56 a-rw-r--r--

1 emma student

2 Feb

2 07:00 b$ cat aa$ cat bb
$ cp -u a b$ cat bb
$ cp -u a c$ ls -ltotal 12
-rw-r--r-- 1 emma student 2 Feb

2 06:56 a-rw-r--r-- 1 emma student 2 Feb

2 07:00 b-rw-r--r-- 1 emma student 2 Feb

2 07:00 c

tar
tar
gzip bzip2 xz
zip unzip

tar
tar
tar

bzip2
gzip

xz
xz

bzip2

.zip
zip

$ mkdir ~/linux_essentials-3.1$ cd ~/linux_essentials-3.1$ mkdir compression archiving$ cd compressionunzip

$ cat /etc/* > bigfile 2> /dev/null$ cp bigfile bigfile2$ cp bigfile bigfile3$ cp bigfile bigfile4$ ls -lh
total 2.8M
-rw-r--r-- 1 emma emma 712K Jun 23 08:08 bigfile-rw-r--r-- 1 emma emma 712K Jun 23 08:08 bigfile2-rw-r--r-- 1 emma emma 712K Jun 23 08:08 bigfile3-rw-r--r-- 1 emma emma 712K Jun 23 08:08 bigfile4$ bzip2 bigfile2$ gzip bigfile3$ xz bigfile4$ ls -lh
total 1.2M
-rw-r--r-- 1 emma emma 712K Jun 23 08:08 bigfile-rw-r--r-- 1 emma emma 170K Jun 23 08:08 bigfile2.bz2-rw-r--r-- 1 emma emma 179K Jun 23 08:08 bigfile3.gz-rw-r--r-- 1 emma emma 144K Jun 23 08:08 bigfile4.xz

bigfilebunzip2

gunzipunxz$ bunzip2 bigfile2.bz2$ gunzip bigfile3.gz$ unxz bigfile4.xz$ ls -lh
total 2.8M
-rw-r--r-- 1 emma emma 712K Jun 23 08:20 bigfile-rw-r--r-- 1 emma emma 712K Jun 23 08:20 bigfile2-rw-r--r-- 1 emma emma 712K Jun 23 08:20 bigfile3-rw-r--r-- 1 emma emma 712K Jun 23 08:20 bigfile4

xz

gzip

$ cp bigfile bigfile-gz1$ cp bigfile bigfile-gz9$ gzip -1 bigfile-gz1$ gzip -9 bigfile-gz9$ cp bigfile bigfile-xz1$ cp bigfile bigfile-xz9$ xz -1 bigfile bigfile-xz1$ xz -9 bigfile bigfile-xz9$ ls -lh bigfile bigfile-* *total 3.5M
-rw-r--r-- 1 emma emma 712K Jun 23 08:08 bigfile-rw-r--r-- 1 emma emma 205K Jun 23 13:14 bigfile-gz1.gz-rw-r--r-- 1 emma emma 178K Jun 23 13:14 bigfile-gz9.gz-rw-r--r-- 1 emma emma 156K Jun 23 08:08 bigfile-xz1.xz-rw-r--r-- 1 emma emma 143K Jun 23 08:08 bigfile-xz9.xz

gzip
cat

grep

diff

less

more

gzip
z

xz

zcat

gzip

$ cp /etc/hosts ./$ gzip hosts$ zcat hosts.gz
127.0.0.1

localhost# The following lines are desirable for IPv6 capable hosts::1

localhost ip6-localhost ip6-loopback

ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

tar

bzip2

bz

xz

tar

tar

$ cd ~/linux_essentials-3.1$ tar cf archiving/3.1.tar compression

tar

c

f

compressiont$ tar -tf 3.1.tar
compression/
compression/bigfile-xz1.xz
compression/bigfile-gz9.gz
compression/hosts.gz
compression/bigfile2
compression/bigfile
compression/bigfile-gz1.gz
compression/bigfile-xz9.xz
compression/bigfile3
compression/bigfile4

tar

-

-v

$ cd ~/linux_essentials-3.1/archiving

tar

$ ls
3.1.tar$ tar xf 3.1.tar$ ls
3.1.tarcompression$ cd ~/linux_essentials-3.1/archiving$ rm -rf compression$ ls
3.1.tar$ tar xvf 3.1.tar compression/hosts.gz
compression/
compression/bigfile-xz1.xz
compression/bigfile-gz9.gz
compression/hosts.gz
compression/bigfile2
compression/bigfile
compression/bigfile-gz1.gz
compression/bigfile-xz9.xz
compression/bigfile3
compression/bigfile4$ ls
3.1.tarcompression$ ls compression
hosts.gztar/
3.1.tar$ cd ~/linux_essentials-3.1/archiving$ rm -rf compression$ cd ../compression$ tar cf ../tar/3.1-nodir.tar *$ cd ../archiving$ mkdir untar$ cd untar$ tar -xf ../3.1-nodir.tar

$ ls
bigfilebigfile3

bigfile-gz1.gz

bigfile-xz1.xz

bigfile2

bigfile4

bigfile-gz9.gz

bigfile-xz9.xz

hosts.gz

tar

P

tar

tar

j

J

z

bzip2

xz

gzip

$ cd ~/linux_essentials-3.1/compression$ lsbigfilebigfile3

bigfile-gz1.gz

bigfile-xz1.xz

bigfile2

bigfile4

bigfile-gz9.gz

bigfile-xz9.xz

hosts.gz$ tar -czf gzip.tar.gz bigfile bigfile2 bigfile3$ tar -cjf bzip2.tar.bz2 bigfile bigfile2 bigfile3$ tar -cJf xz.tar.xz bigfile bigfile2 bigfile3$ ls -l | grep tar-rw-r--r-- 1 emma emma

450202 Jun 27 05:56 bzip2.tar.bz2-rw-r--r-- 1 emma emma

548656 Jun 27 05:55 gzip.tar.gz-rw-r--r-- 1 emma emma

147068 Jun 27 05:56 xz.tar.xz

.tar
.tar
xz
.xz

.bz

.gz

bzip2

.tgz

u

$ cd ~/linux_essentials-3.1/compression$ lsbigfilebigfile3

bigfile-gz1.gz

bigfile-xz1.xz

bzip2.tar.bz2

hosts.gz

bigfile2

bigfile4

bigfile-gz9.gz

bigfile-xz9.xz

gzip.tar.gz

xz.tar.xz$ tar cf plain.tar bigfile bigfile2 bigfile3$ tar tf plain.tar
bigfilebigfile2gzip

bigfile3$ tar uf plain.tar bigfile4$ tar tf plain.tar
bigfilebigfile2
bigfile3
bigfile4$ tar uzf gzip.tar.gz bigfile4
tar: Cannot update compressed archives（訳: 圧縮されたアーカイブを更新することはできません）
Try 'tar --help' or 'tar --usage' for more information.

tar

zip

$ cd ~/linux_essentials-3.1$ mkdir zip$ cd zip/$ mkdir dir$ touch dir/file1 dir/file2$ zip -r zipfile.zip dir
adding: dir/ (stored 0%)
adding: dir/file1 (stored 0%)
adding: dir/file2 (stored 0%)$ rm -rf dir$ ls
zipfile.zip$ unzip zipfile.zip

unzipArchive:

zipfile.zip

creating: dir/extracting: dir/file1
extracting: dir/file2$ find.
./zipfile.zip./dir./dir/file1./dir/file2

-r
-r

zip

tar

gzip

archive.tar
archive.tgz
archive.tar.xz

file.tarfile.tar.bz2
file.zip
file.xz
gzip

tar

zip

tar

/

bzip2

xz

tar

tar

tar

z

archive.tgz

tar
zip

unzip

tar

x
c

t

u
tar

gzip
gunzipbunzip2

bzip2

xz

unxz

zcat
grep

bunzip2
bzip2
bzcat
bzip
bzip2
bzip2
gunzip
gzip
gzip
gzip
tar
tar
unxz
xz

more

less

diff

cmp

bzcat

xzcat

v

unzip

xz
xz
zcat
gzip
zip

tar

gzip

bzip2

xz

archive.tar
archive.tgz
archive.tar.xz

file.tarfile.tar.bz2
file.zip
file.xz
gzip

tar

gunzip

tar

tar

uf

gzip

/

-P

-P, --absolute-names
Don't strip leading slashes from file names when creating（訳: アーカイブ作成時にファイル名から先頭のスラッシュを取り除きません）

zip
-#

#

-#
(-0, -1, -2, -3, -4, -5, -6, -7, -8, -9)# に数字を指定することで、圧縮の速度を調整します。
-0は、圧縮しない（ファイルがそのまま格納される）ことを、

archives

-1は最も高速で少ない圧縮を、-9は最も低速で多くの圧縮を、それぞれ意味します。デフォルトの圧縮レベルは6です。
すべての圧縮方法について圧縮速度を制御することを意図していますが、作業中です。現在は、引き下げのみが機能します。

tar--wildcards--wildcardstar$ tar xf tarfile.tar --wildcards dir/file*$ tar --wildcards -xf tarfile.tar dir/file*

tar

tar

tar

z

gunzip$ gunzip archive.tgz$ tar xf archive.tar

archive.tgz

. [ ] *

?

grep
less
cat head tail
sort
cut
wc

>

cat

$ echo "Hello World!" > text
$ cat text
Hello World!

$ echo "Hello!" > text
$ cat text
Hello!

>>$ echo "Hello to you too!" >> text
$ cat text
Hello!
Hello to you too!

$ echo "Hello to you too!" >> text2$ cat text2
Hello to you too!

2>

games
text-error$ find /usr games 2> text-error/usr/usr/share/usr/share/misc---------出力省略---------/usr/lib/libmagic.so.1.0.0/usr/lib/libdns.so.81/usr/games$ cat text-error
find: `games': No such file or directoryfindtext-error$ sort /etc/passwd 2> text-error$ cat text-error

2>>$ sort /etc 2>> text-error$ cat text-error
sort: read failed: /etc: Is a directory

$ sort /etc/shadow 2>> text-error2$ cat text-error2
sort: open failed: /etc/shadow: Permission denied/dev/null$ sort /etc 2> /dev/null<$ cat < text
Hello!
Hello to you too!

trl

$ tr -d "l" < text
Heo!
Heo to you too!

tr

<<

bash

cat

$ cat << hello
> hey
> ola
> hello
hey
ola

cat

&>

&>>

$ find /usr admin &> newfile$ cat newfile/usr/usr/share/usr/share/misc---------出力省略---------/usr/lib/libmagic.so.1.0.0/usr/lib/libdns.so.81/usr/games
find: `admin': No such file or directory$ find /etc/calendar &>> newfile$ cat newfile/usr/usr/share/usr/share/misc---------出力省略---------/usr/lib/libmagic.so.1.0.0

&

sh

csh

/usr/lib/libdns.so.81/usr/games
find: `admin': No such file or directory/etc/calendar/etc/calendar/default

cut$ cut -f 3 -d "/" newfile$ cat newfile
share
share
share
---------Omitted output---------lib
games
find: `admin': No such file or directorycalendarcalendarfind: `admin': No such file or directory

cut

-f
-d
/

cut

|

$ cat /etc/passwd | lessroot:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
:

less
less

ls

-l
head

wc

$ ls -l | head | wc -w
10

head

tail
head
tail
-f
syslog

wc
-w
-l
wc

-c

contents.txt

contents.txt

contents-

sorted.txt/etc/passwd

Documents

contents.txt
field2.txt/etc/passwd

contents.txt/usr/share

test
find

contents.txt
field1.txt

tr-contents.txt

contents.txt

cut

cat

find

less

more

head

tail

sort

wc

contents.txt$ ls -l > contents.txt

contents.txt

contents-

sorted.txt$ sort contents.txt >> contents-sorted.txt/etc/passwd

Documents$ tail /etc/passwd > Documents/newfile

contents.txt
field2.txt$ wc < contents.txt >> field2.txt/etc/passwd$ head -n 5 /etc/passwd | sort -r

contents.txt$ tail -n 9 contents.txt | wc -c
531/usr/share

test
find

$ find /usr/share -name test | wc -l
125

contents.txt
field1.txt$ cut -f 2 -d " " contents.txt &> field1.txt

trcontents.txt-$ tr -d "-" < contents.txt

contents.txt$ sort contents.txt | tr -s " "$ cat contents.txt | tr -s " " | cut -f 9 -d " " | sort -fr

grep
grep

$ grep bash /etc/passwd
root:x:0:0:root:/root:/bin/bash
user:x:1001:1001:User,,,,:/home/user:/bin/bash

grep

grep

-i

-r

-c

-v

-E
|
grep

.

[abcABC][^abcABC]+?

[a-z][^a-z]

sun|moon

^

$

grep

text.txt$ echo "aaabbb1" > text.txt$ echo "abab2" >> text.txt$ echo "noone2" >> text.txt$ echo "class1" >> text.txt$ echo "alien2" >> text.txt$ cat text.txt
aaabbb1
abab2
noone2class1alien2$ grep "ab" text.txt

aaabbb1
abab2$ grep "[ab]" text.txt
aaabbb1
abab2
class1alien2$ grep "^a" text.txt
aaabbb1
abab2
alien2$ grep "2$" text.txt
abab2
noone2alien2

*

+

?

ab
grep
+

$ grep -E "ab.+" text.txt
aaabbb1aaabbb1

abbb
grep

abab2
-E

abab2grep/usr/share/hunspell/en_US.dic

cat

sawgtfixkgts

dig

e

org

c

kay

abi

tuna

pot spot apot
potic spots potatoe

arp99 apple zipper
zoo arive attack

arcane capper zoology
air coper zoloc

0th/pt 3th/tc 9th/pt
0/nm 3/nm 9/nm

Hawaii Dario Ramiro
hawaii Ian Alice

grep

grep

grep

/usr/share/hunspell/en_US.dic

cat$ grep "cat" /usr/share/hunspell/en_US.dic
Alcatraz/M
Decatur/M
Hecate/M...

sawgtfixkgts$ grep -v "[sawgtfixk]" /usr/share/hunspell/en_US.dic
49269
0/nm
1/n1
2/nm
2nd/p
3/nm
3rd/p
4/nm
5/nm
6/nm
7/nm
8/nm
...

dig

$ grep "^...dig" /usr/share/hunspell/en_US.dic
cardigan/SM
condignpredigest/GDS...

e

$ grep -E "e+$" /usr/share/hunspell/en_US.dic
Anglicize
Anglophobe
Anthropocene
...

org

kay

tuna

$ grep -E "org|kay|tuna" /usr/share/hunspell/en_US.dic
Borg/SM
George/MS
Tokay/M
fortunate/UY
...

c

abi

$ grep -cE "^c?ati" /usr/share/hunspell/en_US.dic
3

pot spot apot
potic spots potatoe
pot$
arp99 apple zipper
zoo arive attackp+arcane capper zoology
air coper zoloc
arc|cap|zoo
0th/pt 3th/tc 9th/pt
0/nm 3/nm 9/nm
[0-9]th.+Hawaii Dario Ramiro
hawaii Ian Alice^[A-Z]a.*i+

sed

grep

$ cat contents.txt | tr -s " " | grep "^....rwx"

grep

#!
/bin/bash

for
echo

echo

$ echo "Hello World!"
Hello World!

new_script$ echo 'echo "Hello World!"' > new_script$ cat new_scriptecho "Hello World!"

new_script$ new_script/bin/bash: new_script: command not foundnew_script

PATH
ls

ls
which

$ which ls/bin/lslsecho$ echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/
games:/snap/bin:/bin
new_script

new_script

PATH

PATH
./

$ ./new_script/bin/bash: ./new_script: Permission deniedls -l$ ls -l new_script-rw-rw-r-- 1 user user 20 Apr 30 12:12 new_script664$ chmod +x new_script$ ls -l new_script-rwxrwxr-x 1 user user 20 Apr 30 12:12 new_script$ ./new_script
Hello World!

new_scriptwhich$ which bash
/bin/bash#!
new_script#!/bin/bash# This is our first comment. It is also good practice to document all scripts.
# 訳注: コメントを日本語で書くこともできますが、システムの言語設定によって#表示・編集できないことがあるので、英語で記入することが好まれます

echo "Hello World!"

new_script.sh
.py

vi

.sh

.bash

nano

vi
vi
vim
vi

vi

vi
h

j

k

l
i

ESC

:

vi

nano

vi

nano
Ctrl

[ Welcome to nano.
^G ヘルプ^O 書き込み

^X 終了

^W 検索

^R 読み込み^\ 置換^K 切り取りFor basic help, type Ctrl+G. ]^J 均等割付^U 貼り付け^C カーソル位置^T スペル確認^_ 行を指定

PATH#!/bin/bash# This is our first comment. It is also good practice to comment all scripts.
username=Carolecho "Hello $username!"

username

Carol

echo

$
username$username$ ./new_script.sh
Hello Carol!

_
Username

username{ }${username}#!/bin/bash# This is our first comment. It is also good practice to comment all scripts.
username=Carol
x=2
y=4
z=$x+$yecho "Hello $username!"echo "$x + $y"echo "$z"$ ./new_script.sh
Hello Carol!
2 + 4
2+4

username#!/bin/bash# This is our first comment. It is also good practice to comment all scripts.
username=Carol Smithecho "Hello $username!"$ ./new_script.sh./new_script.sh: line 5: Smith: command not foundHello !

username=Carolusername

Carol
Smith
Smith

"

#!/bin/bash# This is our first comment. It is also good practice to comment all scripts.
username="Carol Smith"echo "Hello $username!"$ ./new_script.sh
Hello Carol Smith!

'"#!/bin/bash# This is our first comment. It is also good practice to comment all scripts.
username="Carol Smith"echo "Hello $username!"echo 'Hello $username!'$ ./new_script.sh
Hello Carol Smith!

Hello $username!

echo$username

Carol

Smith

rm
rm

testfile

testfile#!/bin/bash# This is our first comment. It is also good practice to comment all scripts.
username=$1
echo "Hello $username!"

username$1$ ./new_script.sh Carol
Hello Carol!

#!/bin/bash# This is our first comment. It is also good practice to comment all scripts.
username1=$1
username2=$2
echo "Hello $username1 and $username2!"$ ./new_script.sh Carol Dave
Hello Carol and Dave!

Carol
$1

Dave

$2
$2

$ ./new_script.sh Carol
Hello Carol and !

$1

$2

$#

#!/bin/bash# This is our first comment. It is also good practice to comment all scripts.
username=$1
echo "Hello $username!"echo "Number of arguments: $#."

$ ./new_script.sh Carol Dave
Hello Carol!
Number of arguments: 2.

$#
$#

1

#!/bin/bash# A simple script to greet a single user.
if [ $# -eq 1 ]thenusername=$1
echo "Hello $username!"else
echo "Please enter only one argument."fiecho "Number of arguments: $#."

if

fi

[
then

$ ./new_script.shPlease enter only one argument.
Number of arguments: 0.
$ ./new_script.sh Carol
Hello Carol!
Number of arguments: 1.

if

-eq
$#

-ne

-gt

]

-ge

-lt

-le

$ PATH=~/scripts$ ls
ls: command not foundls/bin/ls

PATH

/bin

~/scripts

elif>/!bin/bash> fruit1 = Apples> fruit2 = Oranges
if [ $1 -lt $# ]thenecho "This is like comparing $fruit1 and $fruit2!"（参考訳:$fruit1と$fruit2を比べるよ！）> elif [$1 -gt $2 ]then>echo '$fruit1 win!'else>echo "Fruit2 win!"> done>guided1.sh$ ./guided1.sh 3 0$ ./guided1.sh 2 4$ ./guided1.sh 0 1

if [ $1 == $number ]thenecho "True!"
fi

-eq

env

yes

no

if

echo

env

which

chmod

$1, $2 … $9

$#

$PATH

-ne

-gt

-ge

-lt

-le

$ PATH=~/scripts$ ls
ls: command not foundls/bin/ls/bin~/scripts
ls

PATH~/scripts

PATH=$PATH:~/scripts
elif>/!bin/bash> fruit1 = Apples> fruit2 = Oranges
if [ $1 -lt $# ]thenecho "This is like comparing $fruit1 and $fruit2!"> elif [$1 -gt $2 ]then>echo '$fruit1 win!'else>echo "Fruit2 win!"> done

#!/bin/bash
fruit1=Apples
fruit2=Oranges
if [ $1 -lt $# ]thenecho "This is like comparing $fruit1 and $fruit2!"
elif [ $1 -gt $2 ]thenecho "$fruit1 win!"elseecho "$fruit2 win!"fi$ ./guided1.sh 3 0

Apples win!

$ ./guided1.sh 2 4Oranges win!

$ ./guided1.sh 0 1

This is like comparing Apples and Oranges!

if [ $1 == $number ]thenecho "True!"fi#!/bin/bash
if [ $# -ne 2 ]thenecho "Error"
elseecho "$2 $1"
fi

-eq
==

abc == abc
abc == ABC
1 == 11+1 == 2

env

PWD

yes

#!/bin/bash
if [ "$1" == "$PWD" ]thenecho "yes"elseecho "no"fino#!/bin/bash# A simple script to greet a single user.
if [ $# -eq 1 ]thenusername=$1
echo "Hello $username!"else
echo "Please enter only one argument."fiecho "Number of arguments: $#."

$#

username"Hellocat
cat
new_script.sh$ cat -n new_script.sh
1#!/bin/bash

2
3# A simple script to greet a single user.

45

if [ $# -eq 1 ]

6

then

7

username=$1

8910echo "Hello $username!"
else

11

echo "Please enter only one argument."

12

fi

13

echo "Number of arguments: $#."

cat

-n

$?

<user>!"

$ echo $?
0

cat

$?

$ cat -n dummyfile.shcat: dummyfile.sh: No such file or directory$ echo $?
1

cat

$?

1

#!/bin/bash

2
3# A simple script to greet a single user.

45

if [ $# -eq 1 ]

6

then

7

username=$1

89echo "Hello $username!"

10exit 0

11

else

12

echo "Please enter only one argument."

13
14

exit 1fi

15echo "Number of arguments: $#."

$ ./new_script.sh Carol
Hello Carol!
$ echo $?
0

echo

$2

exit

$3

friendly2.sh

1#!/bin/bash

2
3# a friendly script to greet users

45

if [ $# -eq 0 ]

6

then

7

echo "Please enter at least one user to greet."8

exit 1

9

else

10

echo "Hello $@!"

11
12

exit 0fi$ ./friendly2.sh Carol Dave Henry
Hello Carol Dave Henry!

$@

$*

$@
0

1

2

Carol

Dave

Henry

arraytest

FILES

FILES="/usr/sbin/accept /usr/sbin/pwck/ usr/sbin/chroot"

arraytest

FILES#!/bin/bash
FILES="/usr/sbin/accept /usr/sbin/pwck/ usr/sbin/chroot"
for file in $FILES
dols -lh $file
done$ ./arraytest
lrwxrwxrwx 1 root root 10 Apr 24 11:02 /usr/sbin/accept -> cupsaccept-rwxr-xr-x 1 root root 54K Mar 22 14:32 /usr/sbin/pwck-rwxr-xr-x 1 root root 43K Jan 14 07:17 /usr/sbin/chroot

friendly2.shusername$@

1#!/bin/bash

2
3# a friendly script to greet users

45

if [ $# -eq 0 ]

6

then

7

echo "Please enter at least one user to greet."8

exit 1

9

else

10

for username in $@

11

do

12

echo "Hello $username!"

13

done

14
15

exit 0fi

do…done$ ./friendly2.sh Carol Dave Henry
Hello Carol!
Hello Dave!
Hello Henry!

1#!/bin/bash

2
3# a friendly script to greet users

45

if [ $# -eq 0 ]

6

then

7

echo "Please enter at least one user to greet."8

exit 1

9

else

10

echo -n "Hello $1"

11

shift

12

for username in $@

13

do

14
15

echo -n ", and $username"
done

16

echo "!"

17
18

exit 0
fi

echo

-n
!

shift
0

1

2

Carol

Dave

Henry

0

1

Dave

Henry

$ ./friendly2.sh Carol
Hello Carol!
$ ./friendly2.sh Carol Dave Henry
Hello Carol, and Dave, and Henry!

friendly2.sh
grep
grep

$ echo Animal | grep "^[A-Za-z]*$"Animal$ echo $?
0$ echo 4n1ml | grep "^[A-Za-z]*$"$ echo $?
1^$[A-Za-z]
*
grep

grep
0

1

1

#!/bin/bash

2
3# a friendly script to greet users

45

if [ $# -eq 0 ]

6

then

7

echo "Please enter at least one user to greet."

89exit 1else

10

for username in $@

11

do

12

echo $username | grep "^[A-Za-z]*$" > /dev/null

13

if [ $? -eq 1 ]

14

then

15

echo "ERROR: Names must only contains letters."

16

exit 2

17

else

18

echo "Hello $username!"

19

fi

20

done

21

exit 022

fi/dev/null
grep
2$ ./friendly2.sh Carol Dave Henry
Hello Carol!

Hello Dave!
Hello Henry!
$ ./friendly2.sh 42 Carol Dave HenryERROR: Names must only contains letters.
$ echo $?
2script1.sh#!/bin/bash
if [ $# -lt 1 ]thenecho "This script requires at least 1 argument."
exit 1fiecho $1 | grep "^[A-Z]*$" > /dev/null
if [ $? -ne 0 ]thenecho "no cake for you!"exit 2fiecho "here's your cake!"exit 0./script1.shecho $?

./script1.sh cakeecho $?

./script1.sh CAKE

echo $?

script2.sh

for filename in $1/*.txt
do
cp $filename $filename.bak
done

for
grep

shift

$?

$@ $*

script1.sh#!/bin/bash
if [ $# -lt 1 ]thenecho "This script requires at least 1 argument."
exit 1fiecho $1 | grep "^[A-Z]*$" > /dev/null
if [ $? -ne 0 ]thenecho "no cake for you!"exit 2fiecho "here's your cake!"exit 0./script1.sh
This script requires at least 1 argument.
echo $?
1./script1.sh cakeno cake for you!
echo $?
2./script1.sh CAKE
here’s your cake!

echo $?
0
script2.sh

for filename in $1/*.txt
do
cp $filename $filename.bak
done

.txt

#!/bin/bash
for i in $@doecho $i | grep "^[0-9]*$" > /dev/null
if [ $? -eq 0 ]then
if [ $i -gt 10 ]thenecho -n "$i "
fi
fi
done
echo ""

$ uname -r
4.15.0-1019-aws

uname$ uname -s
Darwin-s-r$ uname -r
4.15.0-47-generic/dev/sd*

free-m$ free -m
total

used

free

sharedbuff/cacheavailable

Mem:

748

37

51

14

660

645

Swap:

99

0

99

totalfree
shard

buf/cacheavailableused/proc/cpuinfo
lscpu$ lscpu
Architecture:armv7lByte Order:

Little EndianCPU(s):

4

On-line CPU(s) list:

0-3

Thread(s) per core:1

Core(s) per socket:

4

Socket(s):1Model:

4

Model name:

ARMv7 Processor rev 4 (v7l)

CPU max MHz:

1400.0000

CPU min MHz:

600.0000

BogoMIPS:

38.40

Flags:

half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva

idivt vfpd32 lpae evtstrm crc32

lsblk$ lsblk
NAME

MAJ:MIN RM

mmcblk0

179:0

0 29.7G

SIZE RO TYPE MOUNTPOINT
0 disk+-mmcblk0p1 179:1

0 43.9M

0 part /boot+-mmcblk0p2 179:2

0 29.7G

0 part //home/carol/stuff

/dev
sd
a

b

dev/sda/dev/sda3/dev/
mmcblk$ ls -l mmcblk*
brw-rw---- 1 root disk 179, 0 Jun 30 01:17 mmcblk0
brw-rw---- 1 root disk 179, 1 Jun 30 01:17 mmcblk0p1
brw-rw---- 1 root disk 179, 2 Jun 30 01:17 mmcblk0p2

b

p

/dev
/dev

/dev

sd3p3
sdcp3
sdc3

lsblklsblk -f

$ lsblk -f
NAME

FSTYPE LABELUUIDMOUNTPOINT9304-D9FD/bootmmcblk0+-mmcblk0p1 vfat

boot+-mmcblk0p2 ext4

rootfs 29075e46-f0d4-44e2-a9e7-55ac02d6e6cc //dev

sd3p3

sdc
sd3

sdcp3

3
p3

sdc3

lsblklsblk -f

$ lsblk -f
NAME

FSTYPE LABELUUIDMOUNTPOINT9304-D9FD/bootmmcblk0+-mmcblk0p1 vfat

boot+-mmcblk0p2 ext4

rootfs 29075e46-f0d4-44e2-a9e7-55ac02d6e6cc /

lsblk

-f

mmcblk0
mmcblkmmcblk0p1

mmcblk0p2

vfat
/boot

ext4
/

ps top freesyslog dmesg/etc/ /var/log//boot/ /proc/ /dev/ /sys/

/

/
/
/usr
/usr/local/sbin
parted

ip

ls

mv

/bin
mkdir

/usr/sbindelusergroupadd/usr/binfree
sudo

pstreeman/usr/local/sbin/usr/local/bin/usr/local/sbin
/bin

/sbin

/usr/sbin/opt/usr/bin

/home/$USER/bin/home/$USER/.local/bin
echo

$PATH

PATH

which

$ which git/usr/bin/git

/etc
/bin
/boot

/etc
/etc

/etc

/etc

group

hostname

hosts

passwdprofile

shadowrc
bash.bashrc.bashrc
nanorc.conf
resolv.conf

sysctl.conf.d*.conf*.dlogrotate.conf

logrotate.d

logrotate.d/etc/crontab/etc/cron.d

apt/etc/apt/sources.list/etc/apt/sources.list.d

$ ls /etc/apt/sources*/etc/apt/sources.list/etc/apt/sources.list.d:

ホーム
~
.

.bash_history.bash_logout.bashrc.profile.gitconfig.emacs.d1.sshsystemd

systemd/sbin/init/sbin/init/lib/systemd/systemd

/boot
/boot

/boot

config-4.9.0-9-amd64

initrd.img-4.9.0-9-amd64

System-map-4.9.0-9-amd64
System-map

System.map

vmlinuz-4.9.0-9-amd64
vmlinux

z

grub
grub2
/boot

/proc
/proc
/proc

vm

/proc/cpuinfo$ cat /proc/cpuinfo
processor: 0vendor_id: GenuineIntel

cpu family

: 6

model

: 158

model name: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz

stepping: 10

cpu MHz: 3696.000

cache size

: 12288 KB(...)/proc/cmdline$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.9.0-9-amd64 root=UUID=5216e1e4-ae0e-441f-b8f58061c0034c74 ro quiet/proc/modules$ cat /proc/modules
nls_utf8 16384 1 - Live 0xffffffffc0644000
isofs 40960 1 - Live 0xffffffffc0635000
udf 90112 0 - Live 0xffffffffc061e000
crc_itu_t 16384 1 udf, Live 0xffffffffc04be000
fuse 98304 3 - Live 0xffffffffc0605000
vboxsf 45056 0 - Live 0xffffffffc05f9000 (O)joydev 20480 0 - Live 0xffffffffc056e000
vboxguest 327680 5 vboxsf, Live 0xffffffffc05a8000 (O)hid_generic 16384 0 - Live 0xffffffffc0569000(...)

/proc/sys$ ls /proc/sys
abi

debug

1

off

0

dev

fs

kernel

net

user

on

/proc/sys/net/ipv4/ip_forward$ cat /proc/sys/net/ipv4/ip_forward0/proc/sys/kernel/pid_max$ cat /proc/sys/kernel/pid_max
32768

/dev
/dev

vm

/dev/sda1/dev/console/dev/ttyS0-lls# ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 may 25 17:02 /dev/sda
brw-rw---- 1 root disk 8, 1 may 25 17:02 /dev/sda1
brw-rw---- 1 root disk 8, 2 may 25 17:02 /dev/sda2(...)# ls -l /dev/tty*
crw-rw-rw- 1 root tty

5,

0 may 25 17:26 /dev/tty

crw--w---- 1 root tty

4,

0 may 25 17:26 /dev/tty0

crw--w---- 1 root tty

4,

1 may 25 17:26 /dev/tty1

(...)

b

c
*
ls

/dev
/dev/zero/dev/null
ビットバケツ-l/dev/sd*ls-l/dev/tty**

/dev/urandom

/sys
sysfs

/sys

/proc/sys
/dev/
/sys
enp0s3cat$ cat /sys/class/net/enp0s3/address
08:00:27:02:b2:74

free/proc/meminfo$ free
total

used

free

sharedbuff/cacheavailable

Mem:

4050960

1474960

1482260

Swap:

419225204192252

total

used

free

sharedtmpfs
buff/cacheavailable

free

-b

-m

-g

-h

-h

$ free -h

KiB

96900

10937402246372

totalused

freesharedbuff/cacheavailable

Mem:

3,9G

1,4G

1,5G

75M

1,0G

2,2G

Swap:

4,0G

0B

4,0G

whichwhichrootswaponkill
cutusermod
cron
ps

/etc

~

.bashrc
bash.bashrc
passwd.profile
resolv.conf
sysctl.conf
/boot

4
15
0
50
/dev

vmlinuz-4.15.0-50-generic/dev/sd*/proc/meminfo

free/proc/meminfo

free
total
free
sharedbuff/cacheavailablefree/proc/meminfo

/
bin
/etc

/usr

sbin

~

.

/boot

/proc

/dev

/dev

/sys

cat

/dev/zero/dev/null/dev/urandom/usr/local

free

ls

which

whichwhichrootswaponwhich swapon/sbin/swapon

killwhich kill/bin/killcutwhich cut

/usr/bin/cut

usermodwhich usermod/usr/sbin/usermod

cronwhich cron/usr/sbin/cronpswhich ps/bin/ps/etc~.bashrc
bash.bashrc
passwd.profile
resolv.conf
sysctl.conf
/boot

4
15
0
50
/dev

ls /dev/sd*

vmlinuz-4.15.0-50-generic/dev/sd*/dev/hd*/dev/nvme*/proc/meminfo

free/proc/meminfo

free

free

/proc/meminfo

total

MemTotal

SwapTotal

free

MemFree

SwapFreesharedShmem

buff/cache

Buffers

available

MemAvailable

CachedSReclaimablesystemd

journald

PID

top
top

PPID

$ toptop - 11:10:29 up

2:21,

Tasks:

1 running,

73 total,

0,3 sy,1 user,load average: 0,11, 0,20, 0,1472 sleeping,

0,0 ni, 99,7 id,

0 stopped,
0,0 wa,0 zombie%Cpu(s):0,0 us,KiB Mem :1020332 total,

909492 free,

38796 used,

0,0 hi,

72044 buff/cache

0,0 si,0,0 stKiB Swap:

1046524 total,

1046524 free,0 used.

873264 avail Mem

PID USER

PR

NI

VIRT

RES

SHR S %CPU %MEM

TIME+ COMMAND

436 carol

20

0

42696

3624

3060 R0,70,40:00.30 top

4 root

20

0

0

0

0 S

0,3

0,0

0:00.12 kworker/0:0

399 root

20

0

95204

6748

5780 S0,30,70:00.22 sshd

1 root

20

0

56872

6596

5208 S0,00,60:01.29 systemd

2 root

20

0

0

0

0 S

0,0

0,0

0:00.00 kthreadd

3 root

20

0

0

0

0 S

0,0

0,0

0:00.02 ksoftirqd/0

5 root

0 -20

0

0

0 S

0,0

0,0

0:00.00 kworker/0:0H

6 root

20

0

0

0

0 S

0,0

0,0

0:00.00 kworker/u2:0

7 root

20

0

0

0

0 S

0,0

0,0

0:00.08 rcu_sched

8 root

20

0

0

0

0 S

0,0

0,0

0:00.00 rcu_bh

9 root

rt

0

0

0

0 S

0,0

0,0

0:00.00 migration/0

10 root

0 -20

0

0

0 S

0,0

0,0

0:00.00 lru-add-drain

(...)

top

top
top

M

N

T

P

R
top

htop
atop

ps
ps

top

ps
ps

$ ps
PID TTY

TIME CMD

2318 pts/0

00:00:00 bash

2443 pts/0

00:00:00 ps

PID
TTY

TIME

ps

CMD

-f

$ ps -f
UID

PID

PPID

C STIME TTY

carol

2318

1682

0 08:38 pts/1

00:00:00 bash

TIME CMD

carol

2443

2318

0 08:46 pts/1

00:00:00 ps -f-f$ ps -uf
USER

PID %CPU %MEM

VSZ

RSS TTY

carol

2318

0.0

0.1

21336

5140 pts/1

Ss

08:38

0:00 bash

carol

2492

0.0

0.0

38304

3332 pts/1

R+

08:51

0:00

carol

1780

0.0

0.1

21440

5412 pts/0

Ss

08:28

0:00 bash

carol

2291

0.0

0.7 305352 28736 pts/0

Sl+

08:35

0:00

index.en.adoc -nw(...)

STAT STARTTIME COMMAND\_ ps -uf\_ emacs

ps-v$ ps -v
PID TTY

STAT

TIME

MAJFL

1163 tty2

Ssl+

0:00

1

TRS

DRS

RSS %MEM COMMAND

67 201224 5576

0.1 /usr/lib/gdm3/gdm-x-

session (...)(...)

pstree

/proc
/proc

/proc
PID

carol@debian:~# ls /proc
1

108

13

17

21

27

354

41

665

8

9

10

109

14

173

22

28

355

42

7

804

915

103

11

140

18

23

29

356

428

749

810

918

104

111

148

181

24

3

367

432

75

811

105

112

149

19

244

349

370

433

768

83

106

115

15

195

25

350

371

5

797

838

107

12

16

2

26

353

404

507

798

899

(...)

PID

1

# ls /proc/1/
attr

cmdlineenvironiomem

autogroup

comm

exe

limitsmountinfo numa_maps

auxv

coredump_filterfdloginuid

mounts...

# cat /proc/1/cmdline; echonsoom_adj

/sbin/init/sbin/init;echo
cat /proc/1/cmdline

uptime$ uptime
22:12:54 up 13 days, 20:26,

1 user,load average: 2.91, 1.59, 0.39

2.91
1.59

0.39

/var/log

/var/log/var/log/var/log/var/log/auth.log/var/log/kern.log/var/log/syslog/var/log/messages

less# less /var/log/messages
Jun

4 18:22:48 debian liblogging-stdlog:[origin software="rsyslogd"

swVersion="8.24.0" x-pid="285" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
Jun 29 16:57:10 debian kernel: [0.000000] Linux version 4.9.0-8-amd64 (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1
SMP Debian 4.9.130-2 (2018-10-27)
Jun 29 16:57:10 debian kernel: [0.000000] Command line:

BOOT_IMAGE=/boot/vmlinuz-4.9.0-8-amd64 root=/dev/sda1 ro quiet

tail

-f

# tail -f /var/log/messagesJul

9 18:39:37 debian kernel: [2.350572] RAPL PMU: hw unit of domain psys 2^-0

JoulesJul

9 18:39:37 debian kernel: [2.512802] input: VirtualBox USB Tablet as

/devices/pci0000:00/0000:00:06.0/usb1/1-1/1-1:1.0/0003:80EE:0021.0001/input/input7Jul

9 18:39:37 debian kernel: [2.513861] Adding 1046524k swap on /dev/sda5.

Priority:-1 extents:1 across:1046524k FSJul

9 18:39:37 debian kernel: [2.519301] hid-generic 0003:80EE:0021.0001:

input,hidraw0: USB HID v1.10 Mouse [VirtualBox USB Tablet] on usb-0000:00:06.01/input0
Jul

9 18:39:37 debian kernel: [2.623947] snd_intel8x0 0000:00:05.0: white list

rate for 1028:0177 is 48000
Jul

9 18:39:37 debian kernel: [2.914805] IPv6: ADDRCONF(NETDEV_UP): enp0s3:

link is not readyJul

9 18:39:39 debian kernel: [4.937283] e1000: enp0s3 NIC Link is Up 1000

Mbps Full Duplex, Flow Control: RXJul

9 18:39:39 debian kernel: [4.938493] IPv6: ADDRCONF(NETDEV_CHANGE):

enp0s3: link becomes readyJul

9 18:39:40 debian kernel: [5.315603] random: crng init doneJul

9 18:39:40 debian kernel: [5.315608] random: 7 urandom warning(s) missed

due to ratelimiting/var/log/wtmp
file$ file /var/log/wtmp/var/log/wtmp: dBase III DBT, version number 0, next free block index 8/var/log/wtmp
last$ last
carol

tty2

:0

Thu May 30 10:53

still logged inrebootsystem boot

4.9.0-9-amd64

Thu May 30 10:52

still running

carol

tty2

:0

Thu May 30 10:47 - crashrebootsystem boot

4.9.0-9-amd64

Thu May 30 09:11(00:05)still runningcaroltty2:0

Tue May 28 08:28 - 14:11(05:42)

rebootsystem boot

4.9.0-9-amd64

Tue May 28 08:27 - 14:11(05:43)

carol

tty2

:0

Mon May 27 19:40 - 19:52(00:11)

rebootsystem boot

4.9.0-9-amd64

Mon May 27 19:38 - 19:52(00:13)

carol

tty2

:0

Mon May 27 19:35 - down

(00:03)

rebootsystem boot

4.9.0-9-amd64

Mon May 27 19:34 - 19:38(00:04)/var/log/wtmp/var/log/btmp
lastb

logrotate# ls /var/log/apache2/
access.log

error.log

error.log.2.gz

error.log.1

error.log.2.gz

other_vhosts_access.log.gz

syslogdmesg/var/log/dmesg
grep
less

$ dmesg | grep boot[0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.9.0-9-amd64

root=UUID=5216e1e4-ae0e-441f-b8f5-8061c0034c74 ro quiet[

0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs[

0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.9.0-9-amd64

root=UUID=5216e1e4-ae0e-441f-b8f5-8061c0034c74 ro quiet[

0.144986] AppArmor: AppArmor disabled by boot time parameter

(...)

journald
journalctl

journalctl# journalctl-- Logs begin at Tue 2019-06-04 17:49:40 CEST, end at Tue 2019-06-04 18:13:10 CEST.
-jun 04 17:49:40 debian systemd-journald[339]: Runtime journal (/run/log/journal/)is 8.0M, max 159.6M, 151.6M free.
jun 04 17:49:40 debian kernel: microcode: microcode updated early to revision 0xcc,
date = 2019-04-01
Jun 04 17:49:40 debian kernel: Linux version 4.9.0-8-amd64 (debiankernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) )Jun 04 17:49:40 debian kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-4.9.0-8-amd64
root=/dev/sda1 ro quiet
(...)

-k

--dmesg

dmesg# journalctl -k[

0.000000] Linux version 4.9.0-9-amd64 (debian-kernel@lists.debian.org) (gccversion 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) ) #1 SMP Debian 4.9.168-1+deb9u2(2019-05-13)[

0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.9.0-9-amd64

root=UUID=5216e1e4-ae0e-441f-b8f5-8061c0034c74 ro quiet(...)

journalctl

-b --boot-ujournalctl

-u

-f
tail

-f

apache2.service

apache2topcarol@debian:~$ top
top - 13:39:16 up 31 min,Tasks:

73 total,

1 user,2 running,
0.4 sy,load average: 0.12, 0.15, 0.1071 sleeping,

0.0 ni, 98.6 id,

0 stopped,%Cpu(s):1.1 us,KiB Mem :1020332 total,

698700 free,170664 used,

150968 buff/cache

KiB Swap:

1046524 total,

1046524 free,0 used.

710956 avail Mem

SHR S %CPU %MEM

TIME+ COMMAND

VIRT

RES

0.0 wa,0 zombie

0.0 hi,0.0 si,0.0 st

PID USERPR

NI

605 nobody

20

0 1137620 132424

34256 S

6.3 13.0

1:47.24 ntopng

444 www-data

20

03647804132

2572 S

0.3

0.4

0:00.44 apache2734 root

20

0

95212

7004

6036 S

0.3

0.7

0:00.36 sshd

887 carol

20

0

46608

3680

3104 R

0.3

0.4

0:00.03 top

1 root

20

0

56988

6688

5240 S

0.0

0.7

0:00.42 systemd

2 root

20

0

0

0

0 S

0.0

0.0

0:00.00 kthreadd

3 root

20

0

0

0

0 S

0.0

0.0

0:00.09 ksoftirqd/0

4 root

20

0

0

0

0 S

0.0

0.0

0:00.87 kworker/0:0

(...)

carol

top

top

/proc

/var/log/wtmp/var/log/btmp/run/log/journal/2a7d9730cd3142f4b15e20d6be631836/system.journal

grep

wtmp

kern.log

auth.logJul10

13:37:39

debiandbus[303]:'org.freedesktop.nm_dispatcher'/var/log/auth.log/var/log/kern.log/var/log/syslog/var/log/messages[system]

Successfully

activated

serviceJul 10 11:23:58 debian kernel: [ 1.923349] usbhid: USB HID core driver/var/log/auth.log/var/log/kern.log/var/log/syslog/var/log/messages
Jul 10 14:02:53 debian sudo: pam_unix(sudo:session): session opened for user rootby carol(uid=0)/var/log/auth.log/var/log/kern.log/var/log/syslog/var/log/messagesJul10

11:23:58

debianNetworkManager[322]:

NetworkManager (version 1.6.2) is starting…
/var/log/auth.log/var/log/kern.log/var/log/syslog/var/log/messages
journalctl

ssh
networking
rsyslog
cron<info>[1562750638.8672]

top

top

top

exec

ps
exec

/bin/shdmesg

ls/dev/sd*

dmesg

ls

/dev/sd*

PID

PPID

top

ps
/proc

/var
kern.log

auth.log

ログローテーション

journalctl

cat

dmesg

echo

file

grep

last

less

ls

journalctl
systemdtailtopcarol@debian:~$ top
top - 13:39:16 up 31 min,Tasks:

73 total,

1 user,2 running,
0.4 sy,load average: 0.12, 0.15, 0.1071 sleeping,

0.0 ni, 98.6 id,

0 stopped,%Cpu(s):1.1 us,KiB Mem :1020332 total,

698700 free,170664 used,

150968 buff/cache

KiB Swap:

1046524 total,

1046524 free,0 used.

710956 avail Mem

SHR S %CPU %MEM

TIME+ COMMAND

VIRT

RES

0.0 wa,0 zombie

0.0 hi,0.0 si,0.0 st

PID USERPR

NI

605 nobody

20

0 1137620 132424

34256 S

6.3 13.0

1:47.24 ntopng

444 www-data

20

03647804132

2572 S

0.3

0.4

0:00.44 apache2734 root

20

0

95212

7004

6036 S

0.3

0.7

0:00.36 sshd

887 carol

20

0

46608

3680

3104 R

0.3

0.4

0:00.03 top

1 root

20

0

56988

6688

5240 S

0.0

0.7

0:00.42 systemd

2 root

20

0

0

0

0 S

0.0

0.0

0:00.00 kthreadd

3 root

20

0

0

0

0 S

0.0

0.0

0:00.09 ksoftirqd/0

4 root

20

0

0

0

0 S

0.0

0.0

0:00.87 kworker/0:0

(...)

carol
top
top

/proc

/proc/887

systemd
top

PID

1

/var/log/wtmp
last/var/log/btmp
lastb/run/log/journal/2a7d9730cd3142f4b15e20d6be631836/system.journal
journalctl
grep

wtmp
last
kern.log
less /var/log/kern.log
auth.log
less /var/log/auth.log

dmesg

Jul

journalctl -k

10

13:37:39

journalctl --dmesg

debiandbus[303]:'org.freedesktop.nm_dispatcher'/var/log/auth.log[system]

Successfully

activated

service/var/log/kern.log/var/log/syslog/var/log/messages
Jul 10 11:23:58 debian kernel: [ 1.923349] usbhid: USB HID core driver/var/log/auth.log/var/log/kern.log/var/log/syslog/var/log/messages
Jul 10 14:02:53 debian sudo: pam_unix(sudo:session): session opened for user rootby carol(uid=0)/var/log/auth.log/var/log/kern.log/var/log/syslog/var/log/messagesJul10

11:23:58

debianNetworkManager[322]:<info>[1562750638.8672]

NetworkManager (version 1.6.2) is starting…
/var/log/auth.log/var/log/kern.log/var/log/syslog/var/log/messages
journalctl

sshjournalctl -u ssh.service

networking

journalctl -u networking.service

rsyslogjournalctl -u rsyslog.service

cronjournalctl -u cron.service

top

k

kill

m

M

top

W
top

~/.config/procps/toprc
ls
top

Shift

~
-a

W

exec

ps
exec

/bin/shexec/bin/sh/bin/sh$ echo $$19877$ ps auxf | grep 19877 | head -1
carol

19877

0.0

0.0

7448

3984 pts/25$ exec /bin/shsh-5.0$ ps auxf | grep 19877 | head -1

Ss

21:17

0:00

\_ bashcarol

19877

0.0

0.0

7448

3896 pts/25

Ss

21:17

0:00

\_ /bin/shdmesg[ 1967.700468] sd 6:0:0:0: [sdb] Attached SCSI removable disk

ls/dev/sd*/dev/sda/dev/sdb/dev/sdb1/dev/sdb/dev/sdb1/dev/sdb2
dmesg[ 2458.881695] usb 1-9: USB disconnect, device number 6

ls/dev/sda1/dev/sdb2/dev/sd*/dev/sda /dev/sda1

route ip route show
ifconfig ip addr show
netstat ss/etc/resolv.conf /etc/hosts
IPv4 IPv6
ping
host

ip

link

show

$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode
DEFAULT group default qlen 1000
link/ether 00:0c:29:33:3b:25 brd ff:ff:ff:ff:ff:ff

lo

ens33

lo
00:00:00:00:00:00

ens33

00:0c:29:33:3b:25

192.168.0.1

11000000.10101000.00000000.00000001

11000000.10101000.00000000.00000001

1011111111.11111111.11111111.00000000

255.255.255.0

192.168.0.0

192.168.0.255

1
192.168.0.1/24

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16

ip

addr

add
ens33
255.255.255.0

192.168.0.5/24$ sudo ip addr add 192.168.0.5/255.255.255.0 dev ens33

ip addr show

$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
qlen 1000

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft foreverinet6 ::1/128 scope hostvalid_lft forever preferred_lft forever
25: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP groupdefault qlen 1000
link/ether 00:0c:29:33:3b:25 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.5/24 192.168.0.255 scope global ens33
valid_lft forever preferred_lft foreverinet6 fe80::010c:29ff:fe33:3b25/64 scope link noprefixroutevalid_lft forever preferred_lft forever

lo

ens33

ping

エコー要求

$ ping -c 3 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=2.16 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.85 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=3.41 ms--- 192.168.0.1 ping statistics --3 packets transmitted, 3 received, 0% packet loss, time 5ms
rtt min/avg/max/mdev = 1.849/2.473/3.410/0.674 ms

-c

3

ping
ping

Ctrl

C

ip route show

$ ip route show
127.0.0.0/8 via 127.0.0.1 dev lo0
192.168.0.0/24 dev ens33 scope link

192.168.0.1$ sudo ip route add default via 192.168.0.1

ip route show

$ ip route show
default via 192.168.0.1 dev ens33
127.0.0.0/8 via 127.0.0.1 dev lo0
192.168.0.0/24 dev ens33 scope link

2001:0db8:0000:abcd:0000:0000:0000:7334

0f

2001:db8:0:abcd:0:0:0:7334::

2001:db8:0:abcd::7334

::

fc

fd

fe80

$ sudo ip addr add 2001:db8:0:abcd:0:0:0:7334/64 dev ens33

ip

addr

show

$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft foreverinet6 ::1/128 scope hostvalid_lft forever preferred_lft forever
25: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP groupdefault qlen 1000
link/ether 00:0c:29:33:3b:25 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.5/24 192.168.0.255 scope global ens33
valid_lft forever preferred_lft foreverinet6 fe80::010c:29ff:fe33:3b25/64 scope link noprefixroutevalid_lft forever preferred_lft foreverinet6 2001:db8:0:abcd::7334/64 scope global
valid_lft forever preferred_lft foreverfe80::010c:29ff:fe33:3b25/64

ping$ ping 2001:db8:0:abcd::1
PING 2001:db8:0:abcd::1(2001:db8:0:abcd::1) 56 data bytes
64 bytes from 2001:db8:0:abcd::1: icmp_seq=1 ttl=64 time=0.030 ms
64 bytes from 2001:db8:0:abcd::1: icmp_seq=2 ttl=64 time=0.040 ms
64 bytes from 2001:db8:0:abcd::1: icmp_seq=3 ttl=64 time=0.072 ms--- 2001:db8:0:abcd::1 ping statistics --3 packets transmitted, 3 received, 0% packet loss, time 43ms
rtt min/avg/max/mdev = 0.030/0.047/0.072/0.018 ms

ping
ping6
ping
fe80::/64

$ ping6 -c 1 fe80::010c:29ff:fe33:3b25%ens33
PING fe80::010c:29ff:fe33:3b25(fe80::010c:29ff:fe33:3b25) 56 data bytes
64 bytes from fe80::010c:29ff:fe33:3b25%ens33: icmp_seq=1 ttl=64 time=0.049 ms--- fe80::010c:29ff:fe33:3b25 ping statistics --1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.049/0.049/0.049/0.000 ms

example.com/etc/resolv.conf$ cat /etc/resolv.conf
search lpi
nameserver 192.168.0.1/etc/hosts

127.0.0.1

localhost.localdomain

localhost::1

localhost.localdomain

localhost

192.168.0.10

server2001:db8:0:abcd::f server

host$ host learning.lpi.org

learning.lpi.org has address 208.94.166.198

dig$ dig learning.lpi.org; <<>> DiG 9.14.3 <<>> learning.lpi.org;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21525;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1;; OPT PSEUDOSECTION:; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 2ac55879b1adef30a93013705d3306d2128571347df8eadf (bad);; QUESTION SECTION:;learning.lpi.org.

IN

A

550 INA;; ANSWER SECTION:
learning.lpi.org.

208.94.166.198;; Query time: 3 msec;; SERVER: 192.168.0.1#53(192.168.0.1);; WHEN: Sat Jul 20 14:20:21 EST 2019;; MSG SIZE

rcvd: 89

A

ss

ss

-p
-s
-4

-6

-t

-u

-l

$ ss -t
State

Recv-Q

Send-Q

ESTAB

0

ESTAB
ESTAB
ESTAB
...

Local Address:Port

Peer Address:Port0

192.168.0.5:49412

192.168.0.1:https

00192.168.0.5:37616

192.168.0.1:https

00192.168.0.5:40114

192.168.0.1:https

00192.168.0.5:54948

192.168.0.1:imap

ens33
192.168.10.10/24
2001:0:0:abcd:0:8a2e:0370:7334/64

192.168.10.1
120.56.78.35
172.16.57.47
10.100.49.162
200.120.42.6
example.com

192.168.0.15

sudo ip -6 route add default via 2001:db8:0:abcd::1

ss

Total: 978 (kernel 0)
TCP:

4 (estab 0, closed 0, orphaned 0, synrecv 0, timewait 0/0), ports 0

Transport Total

IP

IPv6

*

0

-

-

RAW

1

0

1

UDP

7

5

2

TCP

4

3

1

INET

12

8

4

FRAG

0

0

0

dig

host

ip

ping

ss

ens33
192.168.10.10/24
2001:0:0:abcd:0:8a2e:0370:7334/64

sudo ip addr add 192.168.10.10/24 dev ens33
sudo ip addr add 2001:0:0:abcd:0:8a2e:0370:7334/64 dev ens33

192.168.10.1
120.56.78.35
172.16.57.47
10.100.49.162
200.120.42.6
example.com

192.168.0.15

192.168.0.15

example.com

sudo ip -6 route add default via 2001:db8:0:abcd::1

2001:db8:0:abcd::1

ss
-u

ss -s

Total: 978 (kernel 0)
TCP:

4 (estab 0, closed 0, orphaned 0, synrecv 0, timewait 0/0), ports 0

Transport Total
*

0

IP
-

IPv6
-

RAW

1

0

1

UDP

7

5

2

TCP

4

3

1

INET

12

8

4

FRAG

0

0

0

/etc/passwd /etc/shadow /etc/groupid last who w
sudo sunewuser

newuser

root

root

0
/root

root

/home

/bin/bash

root

zsh

/sbin/nologin
sftp

/home
/sbin/nologin

/home/usr/share/httpd/var/www/html/

bash
csh

ksh

zsh
chsh

$ chshChanging the login shell for emma
Enter the new value, or press ENTER for the default
Login Shell [/bin/bash]: /usr/bin/zsh-s$ chsh -s /usr/bin/zsh

id

$ id
uid=1024(emma) gid=1024(emma)1024(emma),20(games),groups=10240(netusers),20480(netadmin)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

emma
1024
1024

last

$ last
emma

pts/3

::1

Fri Jun 14 04:28

still logged inrebootsystem boot5.0.17-300.fc30. Fri Jun 14 04:03

rebootsystem boot5.0.17-300.fc30. Wed Jun

5 14:32 - 15:19(00:46)

rebootsystem boot5.0.17-300.fc30. Sat May 25 18:27 - 19:11(00:43)

rebootsystem boot5.0.16-100.fc28. Sat May 25 16:44 - 17:06(00:21)

rebootsystem boot5.0.9-100.fc28.x Sun May 12 14:32 - 14:46(00:14)

root

tty2

Fri May 10 21:55 - 21:55(00:00)still running

...

emma

pts/3

root

last

tty2

lastb

who

w

$ who
emma

pts/3

2019-06-14 04:28 (::1)$ w
05:43:41 up
USER

TTY

emma

pts/3

1:40,

1 user,load average: 0.25, 0.53, 0.51

LOGIN@

IDLE

04:28

1:14m

JCPU

0.04s

PCPU WHAT

0.04s -bash

emma
pts/3
w

IDLE

JCPU

-bash

PCPU
PCPU

su
sudo
su

emma ~$ su Password:root ~#

root
#
root

su
$
root

#

root
su
su

-

-

root

su
root
sudo

$ cat /sys/devices/virtual/dmi/id/board_serial
cat: /sys/devices/virtual/dmi/id/board_serial: Permission denied$ sudo cat /sys/devices/virtual/dmi/id/board_serial[sudo] password for emma:/6789ABC/sudo
sudoers

sudo

/etc
root

/etc/passwd/etc/group/etc/shadow/etc/gshadow

/etc/etc/passwd/etc/grouproot/etc/gshadow/etc/shadow
su

sudo

root
/etc/sudoers
sudo/etc/sudoers.dsudoers/etc/sodoers/etc/sudoers
visudo/etc/passwd:

ユーザー名:パスワード:UID:GID:GECOS:ホームディレクトリ:シェル

ユーザー名
root

nobody

emma

パスワード
x
/etc/shadow

UID
0

99

1024

GID
0

99

1024

GECOS
Emma Smith,42 Douglas St,555.555.5555
ホームディレクトリ/root/home/emma

シェル/bin/bash/sbin/nologin/bin/ksh

emma

emma:x:1000:1000:Emma Smith,42 Douglas St,555.555.5555:/home/emma:/bin/bash,

名前, 所在地, 連絡先

名前

所在地

連絡先

chfn
chfn
vipw

$ chfnChanging the user information for emma
Enter the new value, or press ENTER for the default
Full Name: Emma Smith
Room Number []: 42Work Phone []: 555.555.5555
Home Phone []: 555.555.6666/etc/group:

名前:パスワード:GID:メンバー

名前
root

users

emma

パスワード
x
/etc/gshadow
GID
0

99

1024

メンバー
jsmith,emma

students

students:x:1023:jsmith,emma/etc/gshadow/etc/shadow:

ユーザー名:パスワード:最終変更日:最短期間:最長期間:警告日:イナクティブ:失効日

ユーザー名/etc/passwd

root

nobody

emma

パスワード
!!

!$1$01234567$ABC…

$6$012345789ABCDEF$012…

最終変更日
17909
最短期間

最長期間

警告日

インアクティブ

失効日/etc/shadow

インアクティブ

失効日

emma:$6$nP532JDDogQYZF8I$bjFNh9eT1xpb9/n6pmjlIwgu7hGjH/eytSdttbmVv0MlyTMFgBIXESFNUm
To9EGxxH1OT1HGQzR0so4n1npbE0:18064:0:99999:7:::/etc/shadow/etc/shadow!!

!$1$01234567$ABC…
!

$1$0123456789ABC$012…

$$1$01234567$ABC…
1$5$01234567ABCD$012…
5$6$01234567ABCD$012…
6/etc/shadowid$ id emma
uid=1000(emma) gid=1000(emma)
groups=1000(emma),4(adm),5(tty),10(uucp),20(dialout),27(sudo),46(plugdev)

grep

emma

$ grep emma /etc/passwd
emma:x:1000:1000:Emma Smith,42 Douglas St,555.555.5555,:/home/emma:/bin/ksh

last

w

who

who

w -his

w

-h

w

-s

-i

/etc/group/etc/passwd/etc/shadow/etc/sudoers/usr/bin/ksh

root

/home

/etc/passwd/etc/group/etc/shadow/etc/sudoers
sudo

id

last

who

w
who
su

sudo

chsh

chfn

id

$ id emma
uid=1000(emma) gid=1000(emma)
groups=1000(emma),4(adm),5(tty),10(uucp),20(dialout),27(sudo),46(plugdev)/etc/passwd/etc/group/etc/shadow

w

grep

emma

$ grep emma /etc/passwd
emma:x:1000:1000:Emma Smith,42 Douglas St,555.555.5555,:/home/emma:/bin/ksh

emma
x

x

1000
1000
Emma Smith,42 Douglas St,555.555.5555/home/emma/bin/ksh

last

w

w

who

who

last
w

who

who

w -his

w

-h

w

-s

-i

w
last

/etc/shadow/etc/passwd/etc/group/etc/group/etc/passwd/etc/group/etc/group/etc/passwd/etc/shadow/etc/sudoers/etc/shadow/etc/sudoers/usr/bin/ksh$ chsh -s /usr/bin/ksh

root

/home
root
/home
/home

root

/etc/passwd /etc/shadow /etc/group /etc/skel/
useradd groupadd
passwd/etc//etc/passwd/etc/group/etc/shadow/etc/gshadow

/etc/passwd/etc/passwd

frank:x:1001:1001::/home/frank:/bin/bashx/bin/bash

/etc/group/etc/groupdeveloper:x:1002:x/etc/shadow/etc/shadow

frank:$6$i9gjM4Md4MuelZCd$7jJa8Cd2bbADFH4dwtfvTvJLOYCCCBf/.jYbK1IMYx7Wh4fErXcc2xQVU
2N1gb97yIYaiqH.jjJammzof2Jfr/:18029:0:99999:7:::!

0

/etc/gshadow/etc/gshadow

developer:$6$7QUIhUX1WdO6$H7kOYgsboLkDseFHpk04lwAtweSUQHipoxIgo83QNDxYtYwgmZTCU0qSC
uCkErmyR263rvHiLctZVDR7Ya9Ai1::

newgrp!

newgrpgpasswd

useradd

userdelfrank# useradd frankpasswd# passwd frankChanging password for user frank.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

useradd

grep
frank

cat /etc/passwd | grep frank

grep frank /etc/passwd
useradd

-c

-d

-e

-f

-g

-G

-m

-M

-s

-u

id

# id frank
uid=1000(frank) gid=1000(frank) groups=1000(frank)# groups frank
frank : frank/etc/login.defs

groups-muserdel-r# userdel -r frank/etc/skel

ls -Algroupadd

developer# groupadd -g 1090 developer-gdevelopergroupdel# groupdel developer

useradd

passwdpasswd
-d

-e

-l

-u

-S

developer:x:1010:frank,grace,daveroot:x:0:0:root:/root:/bin/bash

henry:$1$.AbCdEfGh123456789A1b2C3d4.:18015:20:90:5:30::

henry:x:1000:1000:User Henry:/home/henry:/bin/bash

staff:!:dave:carol,emma# cat /etc/passwd | tail -3
dave:x:1050:1050:User Dave:/home/dave:/bin/bash
carol:x:1051:1015:User Carol:/home/carol:/bin/shhenry:x:1052:1005:User Henry:/home/henry:/bin/tcsh# cat /etc/group | tail -3
web_admin:x:1005:frank,emma
web_developer:x:1010:grace,kevin,christian
dave:x:1050:# cat /etc/shadow | tail -3
dave:$6$AbCdEfGh123456789A1b2C3D4e5F6G7h8i9:0:20:90:7:30::
carol:$6$q1w2e3r4t5y6u7i8AbcDeFgHiLmNoPqRsTu:18015:0:60:7:::
henry:!$6$123456789aBcDeFgHa1B2c3d4E5f6g7H8I9:18015:0:20:5:::# cat /etc/gshadow | tail -3
web_admin:!:frank:frank,emma
web_developer:!:kevin:grace,kevin,christian
dave:!::

carol

dave

henry

henry

web_developer

coraluseradd-mdave/etc/login.defs

CREATE_HOME

USERGROUPS_ENAB

dave

dave

dave

sys_admin

web_admin

db_admincarol
sys_admin

web_admin

dave
web_admin

db_admincarol

sys_admin

db_adminls-l/etc/passwd/etc/groupls-l/usr/bin/passwd/etc/shadow/etc/gshadowuseraddgroupadd

userdelgroupdelpasswddeveloper:x:1010:frank,grace,dave/etc/grouproot:x:0:0:root:/root:/bin/bash/etc/passwd
henry:$1$.AbCdEfGh123456789A1b2C3d4.:18015:20:90:5:30::/etc/shadow
henry:x:1000:1000:User Henry:/home/henry:/bin/bash/etc/passwd
staff:!:dave:carol,emma/etc/gshadow# cat /etc/passwd | tail -3
dave:x:1050:1050:User Dave:/home/dave:/bin/bash
carol:x:1051:1015:User Carol:/home/carol:/bin/shhenry:x:1052:1005:User Henry:/home/henry:/bin/tcsh# cat /etc/group | tail -3
web_admin:x:1005:frank,emma
web_developer:x:1010:grace,kevin,christian
dave:x:1050:# cat /etc/shadow | tail -3
dave:$6$AbCdEfGh123456789A1b2C3D4e5F6G7h8i9:0:20:90:7:30::
carol:$6$q1w2e3r4t5y6u7i8AbcDeFgHiLmNoPqRsTu:18015:0:60:7:::
henry:!$6$123456789aBcDeFgHa1B2c3d4E5f6g7H8I9:18015:0:20:5:::# cat /etc/gshadow | tail -3
web_admin:!:frank:frank,emma
web_developer:!:kevin:grace,kevin,christian
dave:!::

carol

/etc/passwd
dave

henry

dave

henry

/etc/passwd

henry
web_admin/etc/group

web_developer

grace

kevin

kevin

christian/etc/group/etc/gshadow

henry/etc/shadow/etc/shadow
dave
coral
/etc/shadowuseradd-mdave/etc/login.defs

CREATE_HOME

USERGROUPS_ENAB
dave

dave

/home/dave

dave

dove

/etc/shadow# cat /etc/shadow | grep dave
dave:!:18015:0:99999:7:::

dave

passwd# passwd dave
Changing password for user dave.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

dave

dave

# cat /etc/passwd | grep dave
dave:x:1015:1019::/home/dave:/bin/sh# cat /etc/group | grep 1019
dave:x:1019:

dave/etc/passwd
dave

sys_admin/etc/group
web_admin

db_admin# groupadd sys_admin# groupadd web_admin# groupadd db_admin# cat /etc/group | grep admin
sys_admin:x:1020:
web_admin:x:1021:
db_admin:x:1022:

sys_admin

web_admin

db_admincarol
sys_admin

web_admin

db_admin# useradd -u 1035 -g 1020 -G web_admin,db_admin carol# id carol
uid=1035(carol) gid=1020(sys_admin)
groups=1020(sys_admin),1021(web_admin),1022(db_admin)

dave
web_admincarol

sys_admin

db_admin# userdel -r dave
# userdel -r carol# groupdel sys_admin# groupdel web_admin# groupdel db_adminls-l/etc/passwd/etc/group/etc/shadow/etc/gshadow# ls -l /etc/passwd /etc/group /etc/shadow /etc/gshadow-rw-r--r-- 1 root root

853 mag

1 08:00 /etc/group-rw-r----- 1 root shadow 1203 mag

1 08:00 /etc/gshadow-rw-r--r-- 1 root root

1354 mag

1 08:00 /etc/passwd-rw-r----- 1 root shadow 1563 mag

1 08:00 /etc/shadow/etc/passwd/etc/groupx/etc/shadow/etc/gshadow
shadowls-l/usr/bin/passwd# ls -l /usr/bin/passwd-rwsr-xr-x 1 root root 42096 mag 17

passwd2015 /usr/bin/passwd

ls -l ls -a
chmod chown

ls

$ ls
Another_Directory

picture.jpg

text.txt

ls-l$ ls -ltotal 536
drwxrwxr-x 2 carol carol4096 Dec 10 15:57 Another_Directory-rw------- 1 carol carol 539663 Dec 10 10:43 picture.jpg-rw-rw-r-- 1 carol carol1881 Dec 10 15:57 text.txt

1番目
drwxrwxr-x
d
rwx

u

rwx

g

r-x

o

.

..

ls

-h

K

$ ls -lh
total 1,2G
drwxrwxr-x 2 carol carol 4,0K Dec 10 17:59 Another_DirectoryMG----r--r-- 1 carol carol

0 Dec 11 10:55 foo.bar-rw-rw-r-- 1 carol carol 1,2G Dec 20 18:22 HugeFile.zip-rw------- 1 carol carol 528K Dec 10 10:43 picture.jpg---xr-xr-x 1 carol carol

33 Dec 11 10:36 test.sh-rwxr--r-- 1 carol carol 1,9K Dec 20 18:13 text.txt-rw-rw-r-- 1 carol carol 2,6M Dec 11 22:14 Zipped.zipls$ ls -lh HugeFile.zip test.sh
total 1,2G
-rw-rw-r-- 1 carol carol 1,2G Dec 20 18:22 HugeFile.zip---xr-xr-x 1 carol carolls

33 Dec 11 10:36 test.sh-l$ ls -l Another_Directory/
total 0-rw-r--r-- 1 carol carol 0 Dec 10 17:59 another_file.txt

ls-d$ ls -l -d Another_Directory/
drwxrwxr-x 2 carol carol 4096 Dec 10 17:59 Another_Directory/ls -l$ ls -ltotal 544
drwxrwxr-x 2 carol carol4096 Dec 10 17:59 Another_Directory-rw------- 1 carol carol 539663 Dec 10 10:43 picture.jpg-rw-rw-r-- 1 carol carol1881 Dec 10 15:57 text.txt

.
ls
-a

$ ls -l -a
total 544
drwxrwxr-x 3 carol carol4096 Dec 10 16:01 .

drwxrwxr-x 4 carol carol4096 Dec 10 15:56 ..

drwxrwxr-x 2 carol carol4096 Dec 10 17:59 Another_Directory-rw------- 1 carol carol 539663 Dec 10 10:43 picture.jpg-rw-rw-r-- 1 carol carol-rw-r--r-- 1 carol carol.thisIsHidden.

1881 Dec 10 15:57 text.txt
0 Dec 10 16:01 .thisIsHidden

.
..

.

..

ls
ls -l -a

ls

-

d

l

-l

ls -lab/dev/sdac/dev/ttyS0
s

ls

-l

r
-

r
4

w
2

x
1

rw-

r
4

w

x

w
2

x
1
r

Another_Directory$ ls -ld Another_Directory/d--xr-xr-x 2 carol carol 4,0K Dec 20 18:46 Another_Directory

hello.sh-rwxr-xr-x 1 carol carol 33 Dec 20 18:46 hello.sh

carol

Another_Directory$ ls -l Another_Directory/
ls: cannot open directory 'Another_Directory/': Permission denied

carol
hello.sh$ sh Another_Directory/hello.shHello LPI World!

chmod$ chmod ug+rw-x,o-rwx text.txt$ chmod 660 text.txt-rw-rw---- 1 carol carol

765 Dec 20 21:25 text.txt

u
o

g

a
+
-

=
r

w

x
text.txt$ ls -l text.txt-rw-r--r-- 1 carol carol 765 Dec 20 21:25 text.txt

g+w
g

+

w

$ chmod g+w text.txt

ls$ ls -l text.txt-rw-rw-r-- 1 carol carol 765 Dec 20 21:25 text.txt

u

-

u-r

$ chmod u-r text.txt$ ls -l text.txt--w-rw-r-- 1 carol carol 765 Dec 20 21:25 text.txt

rwa

=

rw-

$ chmod a=rw- text.txt$ ls -l text.txt-rw-rw-rw- 1 carol carol 765 Dec 20 21:25 text.txt,$ chmod u+rwx,g-x text.txt$ ls -lh text.txt-rwxrw-rw- 1 carol carol 765 Dec 20 21:25 text.txt

u
rwx

+

g

-

x

chmod
chmod
-R

$ chmod -R u+rwx Another_Directory/

-R
+

u

rwx
-R

r
2

x

4

1

w
0

rwx

7

4+2+1

r-x

5

4+0+1
u
o

g
rw-rw----

660$ chmod 660 text.txt$ ls -l text.txt-rw-rw---- 1 carol carol 765 Dec 20 21:25 text.txt

シンボリックモード

rw- r-- ---

640

chmod

chown

chown ユーザー名:グループ名 ファイル名

text.txt$ ls -l text.txt-rw-rw---- 1 carol carol 1881 Dec 10 15:57 text.txt

carol

carol

student$ chown carol:students text.txt$ ls -l text.txt-rw-rw---- 1 carol students 1881 Dec 10 15:57 text.txt

carol

student

u+x

script.shchown:students

text.txt

chown carol text.txt
chgrp carol text.txt

Operation

notpermitted

groupsgroupmems
groups$ groups
carol students cdrom sudo dip plugdev lpadmin sambashare$ groups carol
carol : carol students cdrom sudo dip plugdev lpadmin sambasharegroupmems-l$ sudo groupmems -g cdrom -lcarolgroupmems
sudo

-g

1

t

ls
x

-l

t

$ ls -ld Sample_Directory/
drwxr-xr-t 2 carol carol 4096 Dec 20 18:46 Sample_Directory/

755
Another_Directory1$ chmod 1755 Another_Directory$ ls -ld Another_Directory
drwxr-xr-t 2 carol carol 4,0K Dec 20 18:46 Another_Directory

2
s

ls
x

s

-l

$ ls -l test.sh-rwxr-sr-x 1 carol carol 33 Dec 11 10:36 test.sh$ chmod g+s test.sh$ ls -l test.sh-rwxr-sr-x 1 carol root

33 Dec 11 10:36 test.shSample_Directory
carol

users

$ ls -ldh Sample_Directory/
drwxr-xr-x 2 carol users 4,0K Jan 18 17:06 Sample_Directory/

touch$ cd Sample_Directory/$ touch newfile$ ls -lh newfile-rw-r--r-- 1 carol carol 0 Jan 18 17:11 newfile

carol

carol

Sample_Directory$ sudo chmod g+s Sample_Directory/$ ls -ldh Sample_Directory/
drwxr-sr-x 2 carol users 4,0K Jan 18 17:17 Sample_Directory/

s
touch

$ cd Sample_Directory/$ touch emptyfile$ ls -lh emptyfile

-rw-r--r-- 1 carol users 0 Jan 18 17:20 emptyfile

users
users

4
s
ls
x

-l

s

$ ls -ld test.sh-rwsr-xr-x 1 carol carol 33 Dec 11 10:36 test.sh755
test.sh2$ chmod 6755 test.sh$ ls -lh test.sh-rwsr-sr-x 1 carol carol 66 Jan 18 17:29 test.sh

ls

-l

4

mkdiremptydiremptydirls

emptydirtouch

emptyfile

emptyfilechmod

emptyfile
chmod

chmod

754

text.txt

text.txt

test.sh-rwxr-sr-x 1 carol root

33 Dec 11 10:36 test.shjohn$ ls -l /dev/sdb1
brw-rw---- 1 root disk 8, 17 Dec 21 18:51 /dev/sdb1

sdb1

drwxr-xr-t 2 carol carol 4,0K Dec 20 18:46 Another_Directory----r--r-- 1 carol carol

0 Dec 11 10:55 foo.bar-rw-rw-r-- 1 carol carol 1,2G Dec 20 18:22 HugeFile.zip
drwxr-sr-x 2 carol users 4,0K Jan 18 17:26 Sample_Directory

Another_Directory

foo.barHugeFile.zip

Sample_Directory

touchemptyfile

chmod
chmod

4

000

emptyfile

emptyfile

emptyfilechmod

emptyfile
chmod

44

emptyfile

chmod

--x

/tmp

$ ls -l /tmp
drwxrwxrwt

19 root root

test.sh

16K Dec 21 18:58 tmp-rwsr-xr-x$ chmod u-x test.sh$ ls -l test.sh-rwSr-xr-x 1 carol carol 33 Dec 11 10:36 test.sh

S

user
Box

ls
chown

ls

chmod

chown

chgrp

chgrp

chmod

mkdiremptydiremptydirls

emptydirls-dls -l -d emptydir

ls

touch

-ld

emptyfile

emptydiremptyfilechmod

emptyfile
chmod

u

+

x

u+x
g
-

o

w

x

go-wx

chmod u+x,go-wx emptyfile

chmod

754

text.txtrtext.txt

4

w

2

x

1

0
rwx

rwxr-xr--

7

4+2+1

r-x

5

4+0+1

text.txt

test.sh-rwxr-sr-x 1 carol root

33 Dec 11 10:36 test.sh

ls

-l

rwx

john

r-s
root

chmod
755

0
chmod 0755

$ ls -l /dev/sdb1
brw-rw---- 1 root disk 8, 17 Dec 21 18:51 /dev/sdb1

sdb1
ls
root

-l

b
disk

drwxr-xr-t 2 carol carol 4,0K Dec 20 18:46 Another_Directory----r--r-- 1 carol carol

0 Dec 11 10:55 foo.bar-rw-rw-r-- 1 carol carol 1,2G Dec 20 18:22 HugeFile.zip
drwxr-sr-x 2 carol users 4,0K Jan 18 17:26 Sample_Directory

Another_Directory
1755
1

755

rwx

r-x

foo.bar
0044
0
---

r--

HugeFile.zip
0664
0
4

6

r--

Sample_Directory
2755
2
5

7
r-x

rwx

rw-

touchemptyfile

chmod
chmod

4

emptyfile000

emptyfile

emptyfilechmod

emptyfile
chmod

44

emptyfilechmod
emptyfile---------- 1 carol carol

0 Dec 11 10:55 emptyfile

chmod 4 emptyfile$ chmod 4 emptyfile$ ls -l emptyfile-------r-- 1 carol carol 0 Dec 11 10:55 emptyfile

chmod 44 emptyfile$ chmod 44 emptyfile$ ls -l emptyfile----r--r-- 1 carol carol 0 Dec 11 10:55 emptyfile

chmod

--x

/tmp

$ ls -l /tmp
drwxrwxrwt

19 root root

16K Dec 21 18:58 tmp

/tmp
t
/tmp

test.sh-rwsr-xr-x$ chmod u-x test.sh$ ls -l test.sh-rwSr-xr-x 1 carol carol 33 Dec 11 10:36 test.sh

S
ls
t

-l

s

x

s
S

s
S

t
t
T

user
Box

$ mkdir Box

users$ chown :users Box/
$ chmod g+wxs Box/

user

sudo

t

o

$ chmod o+t Box/

Box

drwxrwsr-t 2 carol users

4,0K Jan 18 19:09 Box

chmod$ chmod g+wxs,o+t Box/

/tmp/ /var/tmp/
ls -d
ln -s

/tmp

/var/tmp

/run
.pid

/var/run/var/run

ls
x

/run

-l

t

/tmp

$ ls -ldh /tmp/ /var/tmp/
drwxrwxrwt 25 root root 4,0K Jun

7 18:52 /tmp/

drwxrwxrwt 16 root root 4,0K Jun

7 09:15 /var/tmp/

x

t

chmod

/var/tmp

1$ chmod 1755 temp

temp
rwxr-xr-tt-t$ chmod +t templn

$ ln ターゲット リンク名+t

ターゲット$ ln target.txt /home/carol/Documents/hardlink

hardlink/home/carol/Documents/

target.txt
リンク名

ls

-i

$ ls -litotal 224
3806696 -r--r--r-- 2 carol carol 111702 Jun

7 10:13 hardlink

3806696 -r--r--r-- 2 carol carol 111702 Jun

7 10:13 target.txt

hardlilnk
target.txt

3806696

ls

-l

1

2
2

rm

mv

ln

-s

$ ln -s target.txt /home/carol/Documents/softlink/home/carol/Documents/

softlinktarget.txt

ls$ ls -lh
total 112K
-rw-r--r-- 1 carol carol 110K Jun

7 10:13 target.txt

lrwxrwxrwx 1 carol carol

7 10:14 softlink -> target.txt

12 Junsoftlinkltarget.txt

rwx

rm

mv

original.txt
softlink$ ln -s original.txt softlinkls$ ls -lh
total 112K
-r--r--r-- 1 carol carol 110K Jun

7 10:13 original.txt

lrwxrwxrwx 1 carol carol

7 19:23 softlink -> original.txt

12 Junsoftlink

original.txt→
less$ mv softlink ../$ less ../softlink../softlink: No such file or directory

original.txt

$ ln -s /home/carol/Documents/original.txt softlinkls$ ls -lh
total 112K
lrwxrwxrwx 1 carol carol

40 Jun/home/carol/Documents/original.txt

7 19:34 softlink ->chmod/home/carol/Documents

document.txt
text.txt

recipes.txt
receitas.txt

rezepte.txt$ touch recipes.txt$ ln recipes.txt receitas.txt$ ln -s recipes.txt rezepte.txt$ ls -lhi
total 160K
5388833 -rw-r--r-- 4 carol carol 77K jun 17 17:25 receitas.txt
5388833 -rw-r--r-- 4 carol carol 77K jun 17 17:25 recipes.txt
5388837 lrwxrwxrwx 1 carol carol

receitas.txt

12 jun 24 10:12 rezepte.txt -> receitas.txt

recipes.txt

receitas.txt

rezepte.txt/media/youruser/FlashA
esquema.pdf
schematics.pdf$ ln /media/youruser/FlashA/esquema.pdf ~/schematics.pdf

ls -lah$ ls -lahtotal 3,1M
drwxr-xr-x 2 carol carol 4,0K jun 17 17:27 .
drwxr-xr-x 5 carol carol 4,0K jun 17 17:29 ..
-rw-rw-r-- 1 carol carol 2,8M jun 17 15:45 compressed.zip-rw-r--r-- 4 carol carol

77K jun 17 17:25 document.txt-rw-rw-r-- 1 carol carol 216K jun 17 17:25 image.png

-rw-r--r-- 4 carol carol

77K jun 17 17:25 text.txt

document.txt

ls~/Documentsclients.txt

somedirclients.txt$ cd ~/Documents$ echo "John, Michael, Bob" > clients.txt$ mkdir somedir$ echo "Bill, Luke, Karl" > somedir/clients.txt

somedir

partners.txt$ cd somedir/$ ln -s clients.txt partners.txt

Documents|-- clients.txt`-- somedir|-- clients.txt`-- partners.txt -> clients.txt

partners.txt

somedir$ cd ~/Documents/$ mv somedir/partners.txt .

~/Documents

$ less partners.txt-rw-r--r-- 1 carol carol 19 Jun 24 11:12 clients.txt
lrwxrwxrwx 1 carol carol 11 Jun 24 11:13 partners.txt -> clients.txt

partners.txt

ln
ls

-i

/tmp

/run

/var/run
chmod

t
+t
/home/carol/Documents

document.txt
text.txtls-s$ ln -s /home/carol/Documents/document.txt text.txt

recipes.txt
receitas.txt

rezepte.txt$ touch recipes.txt$ ln recipes.txt receitas.txt$ ln -s recipes.txt rezepte.txt$ ls -lhi
total 160K
5388833 -rw-r--r-- 4 carol carol 77K jun 17 17:25 receitas.txt
5388833 -rw-r--r-- 4 carol carol 77K jun 17 17:25 recipes.txt
5388837 lrwxrwxrwx 1 carol carol

receitas.txt

12 jun 24 10:12 rezepte.txt -> recipes.txt

recipes.txt

receitas.txt

rezepte.txt

rezepte.txt
recipes.txt
receitas.txt/media/youruser/FlashA
esquema.pdf
schematics.pdf$ ln /media/youruser/FlashA/esquema.pdf ~/schematics.pdf

Invalidcross-device

link
ln

ls -lah-s

$ ls -lahtotal 3,1M
drwxr-xr-x 2 carol carol 4,0K jun 17 17:27 .
drwxr-xr-x 5 carol carol 4,0K jun 17 17:29 ..
-rw-rw-r-- 1 carol carol 2,8M jun 17 15:45 compressed.zip-rw-r--r-- 4 carol carol

77K jun 17 17:25 document.txt-rw-rw-r-- 1 carol carol 216K jun 17 17:25 image.png-rw-r--r-- 4 carol carol

77K jun 17 17:25 text.txt

document.txt
1
4

ls
-i

ls

$ ls -lahi
total 3,1M
5388773 drwxr-xr-x 2 rigues rigues 4,0K jun 17 17:27 .
5245554 drwxr-xr-x 5 rigues rigues 4,0K jun 17 17:29 ..
5388840 -rw-rw-r-- 1 rigues rigues 2,8M jun 17 15:45 compressed.zip
5388833 -rw-r--r-- 4 rigues rigues

77K jun 17 17:25 document.txt

5388837 -rw-rw-r-- 1 rigues rigues 216K jun 17 17:25 image.png
5388833 -rw-r--r-- 4 rigues rigues

77K jun 17 17:25 text.txt~/Documents
somedirclients.txt$ cd ~/Documents$ echo "John, Michael, Bob" > clients.txt$ mkdir somedir$ echo "Bill, Luke, Karl" > somedir/clients.txt

clients.txt

somedirpartners.txt$ cd somedir/$ ln -s clients.txt partners.txt

Documents|-- clients.txt`-- somedir|-- clients.txt`-- partners.txt -> clients.txt

partners.txt

somedir~/Documents$ cd ~/Documents/$ mv somedir/partners.txt .
$ less partners.txt~/Documents
John

MichaelBobpartners.txt~/Documents/somedir~/Documentsclients.txt~/Documentsclients.txt~/somedir-rw-r--r-- 1 rigues rigues 19 Jun 24 11:12 clients.txt

lrwxrwxrwx 1 rigues rigues 11 Jun 24 11:13 partners.txt -> clients.txt

partners.txt
partners.txt

rw-r—r--