LinuC 합격 1주만에 LPIC 기초 학습이 가능한 책 3일차 총결산
압축, 압축 해제, 압축 파일 정보
실행 결과
gzip을 통한 압축root@1c3df5ff4615:~# ls -l
total 12
drwxr-xr-x 2 root root 4096 Apr 6 15:34 sample_dir
-rw-r--r-- 1 root root 7644 Apr 6 15:38 sample_file
root@1c3df5ff4615:~# gzip sample_file
root@1c3df5ff4615:~# ls -l
total 8
drwxr-xr-x 2 root root 4096 Apr 6 15:34 sample_dir
-rw-r--r-- 1 root root 2777 Apr 6 15:38 sample_file.gz
gunzip을 통한 동결 해제root@1c3df5ff4615:~# ls -l
total 8
drwxr-xr-x 2 root root 4096 Apr 6 15:34 sample_dir
-rw-r--r-- 1 root root 2777 Apr 6 15:38 sample_file.gz
root@1c3df5ff4615:~# gunzip sample_file.gz
root@1c3df5ff4615:~# ls -l
total 12
drwxr-xr-x 2 root root 4096 Apr 6 15:34 sample_dir
-rw-r--r-- 1 root root 7644 Apr 6 15:38 sample_file
zip을 통한 압축nekonisi@nekonisi-mbp hoge % ls -l
total 40
drwxr-xr-x 4 nekonisi staff 128 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % zip sample_dir.zip sample_dir
adding: sample_dir/ (stored 0%)
nekonisi@nekonisi-mbp hoge % ls -l
total 48
drwxr-xr-x 4 nekonisi staff 128 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
unzip 동결해제nekonisi@nekonisi-mbp hoge % ls -l
total 48
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % unzip sample_dir.zip
Archive: sample_dir.zip
creating: sample_dir/
nekonisi@nekonisi-mbp hoge % ls -l
total 48
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
데이터 아카이빙nekonisi@nekonisi-mbp hoge % ls -l
total 48
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % tar cvf sample_dir.tar sample_dir
a sample_dir
nekonisi@nekonisi-mbp hoge % ls -l
total 56
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 1536 4 7 00:46 sample_dir.tar
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
데이터를 통한 아카이빙nekonisi@nekonisi-mbp hoge % ls -l
total 56
-rw-r--r-- 1 nekonisi staff 1536 4 7 00:46 sample_dir.tar
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % tar xvf sample_dir.tar
x sample_dir/
nekonisi@nekonisi-mbp hoge % ls -l
total 56
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 1536 4 7 00:46 sample_dir.tar
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
데이터 압축 아카이빙nekonisi@nekonisi-mbp hoge % ls -l
total 0
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
nekonisi@nekonisi-mbp hoge % tar czvf sample_dir.tar.gz sample_dir
a sample_dir
nekonisi@nekonisi-mbp hoge % ls -l
total 8
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 114 4 7 00:49 sample_dir.tar.gz
데이터 압축 압축 압축 해제nekonisi@nekonisi-mbp hoge % ls -l
total 8
-rw-r--r-- 1 nekonisi staff 114 4 7 00:49 sample_dir.tar.gz
nekonisi@nekonisi-mbp hoge % tar xzvf sample_dir.tar.gz
x sample_dir/
nekonisi@nekonisi-mbp hoge % ls -l
total 8
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 114 4 7 00:49 sample_dir.tar.gz
사용자 및 그룹 정보
실행 결과
사용자 추가[root@69523716df27 /]# useradd nekonisi
# nekonisiでログイン
[root@69523716df27 /]# su - nekonisi
[nekonisi@69523716df27 ~]$ pwd
/home/nekonisi
※ su
환경 변수를 읽을 수 없음, su -
환경 변수를 읽을 수 없음
암호 변경# rootによる初回変更
[root@69523716df27 /]# passwd nekonisi
Changing password for user nekonisi.
New password:
BAD PASSWORD: The password fails the dictionary check - it does not contain enough DIFFERENT characters
Retype new password:
passwd: all authentication tokens updated successfully.
#自分でも変更
[root@69523716df27 /]# su - nekonisi
Last login: Tue Apr 6 16:03:33 UTC 2021 on pts/1
[nekonisi@69523716df27 ~]$ passwd
Changing password for user nekonisi.
Changing password for nekonisi.
(current) UNIX password:
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
그룹 추가[root@69523716df27 /]# groupadd ginnan-boyz
[root@69523716df27 /]# cat /etc/group
root:x:0:
(省略)
nekonisi:x:1000:
ginnan-boyz:x:1001:
단체가 참가하다[root@69523716df27 /]# usermod -G ginnan-boyz nekonisi
[root@69523716df27 /]# cat /etc/group
root:x:0:
(省略)
nekonisi:x:1000:
ginnan-boyz:x:1001:nekonisi
[root@69523716df27 /]# su - nekonisi
Last login: Tue Apr 6 16:06:28 UTC 2021 on pts/1
[nekonisi@69523716df27 ~]$ groups
nekonisi ginnan-boyz
[nekonisi@69523716df27 ~]$ id
uid=1000(nekonisi) gid=1000(nekonisi) groups=1000(nekonisi),1001(ginnan-boyz)
그룹 삭제[root@69523716df27 /]# groupdel ginnan-boyz
[root@69523716df27 /]# cat /etc/gruop
cat: /etc/gruop: No such file or directory
[root@69523716df27 /]# cat /etc/group
root:x:0:
(省略)
nekonisi:x:1000:
※ 은행보이즈는 텃밭만 있으면 사라지지 않습니다.
사용자 삭제[root@69523716df27 /]# userdel nekonisi
[root@69523716df27 /]# ls /home/
nekonisi
#homeディレクトリも削除したい場合は
[root@69523716df27 /]# userdel -r nekonisi
[root@69523716df27 /]# ls /home/
Reference
이 문제에 관하여(LinuC 합격 1주만에 LPIC 기초 학습이 가능한 책 3일차 총결산), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/nekonisi/items/74ea880fbc70a4816198
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
root@1c3df5ff4615:~# ls -l
total 12
drwxr-xr-x 2 root root 4096 Apr 6 15:34 sample_dir
-rw-r--r-- 1 root root 7644 Apr 6 15:38 sample_file
root@1c3df5ff4615:~# gzip sample_file
root@1c3df5ff4615:~# ls -l
total 8
drwxr-xr-x 2 root root 4096 Apr 6 15:34 sample_dir
-rw-r--r-- 1 root root 2777 Apr 6 15:38 sample_file.gz
root@1c3df5ff4615:~# ls -l
total 8
drwxr-xr-x 2 root root 4096 Apr 6 15:34 sample_dir
-rw-r--r-- 1 root root 2777 Apr 6 15:38 sample_file.gz
root@1c3df5ff4615:~# gunzip sample_file.gz
root@1c3df5ff4615:~# ls -l
total 12
drwxr-xr-x 2 root root 4096 Apr 6 15:34 sample_dir
-rw-r--r-- 1 root root 7644 Apr 6 15:38 sample_file
nekonisi@nekonisi-mbp hoge % ls -l
total 40
drwxr-xr-x 4 nekonisi staff 128 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % zip sample_dir.zip sample_dir
adding: sample_dir/ (stored 0%)
nekonisi@nekonisi-mbp hoge % ls -l
total 48
drwxr-xr-x 4 nekonisi staff 128 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % ls -l
total 48
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % unzip sample_dir.zip
Archive: sample_dir.zip
creating: sample_dir/
nekonisi@nekonisi-mbp hoge % ls -l
total 48
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % ls -l
total 48
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % tar cvf sample_dir.tar sample_dir
a sample_dir
nekonisi@nekonisi-mbp hoge % ls -l
total 56
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 1536 4 7 00:46 sample_dir.tar
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % ls -l
total 56
-rw-r--r-- 1 nekonisi staff 1536 4 7 00:46 sample_dir.tar
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % tar xvf sample_dir.tar
x sample_dir/
nekonisi@nekonisi-mbp hoge % ls -l
total 56
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 1536 4 7 00:46 sample_dir.tar
-rw-r--r-- 1 nekonisi staff 172 4 7 00:43 sample_dir.zip
-rw-r--r-- 1 nekonisi staff 18747 4 7 00:42 sample_file
nekonisi@nekonisi-mbp hoge % ls -l
total 0
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
nekonisi@nekonisi-mbp hoge % tar czvf sample_dir.tar.gz sample_dir
a sample_dir
nekonisi@nekonisi-mbp hoge % ls -l
total 8
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 114 4 7 00:49 sample_dir.tar.gz
nekonisi@nekonisi-mbp hoge % ls -l
total 8
-rw-r--r-- 1 nekonisi staff 114 4 7 00:49 sample_dir.tar.gz
nekonisi@nekonisi-mbp hoge % tar xzvf sample_dir.tar.gz
x sample_dir/
nekonisi@nekonisi-mbp hoge % ls -l
total 8
drwxr-xr-x 2 nekonisi staff 64 4 7 00:43 sample_dir
-rw-r--r-- 1 nekonisi staff 114 4 7 00:49 sample_dir.tar.gz
실행 결과
사용자 추가
[root@69523716df27 /]# useradd nekonisi
# nekonisiでログイン
[root@69523716df27 /]# su - nekonisi
[nekonisi@69523716df27 ~]$ pwd
/home/nekonisi
※ su
환경 변수를 읽을 수 없음, su -
환경 변수를 읽을 수 없음암호 변경
# rootによる初回変更
[root@69523716df27 /]# passwd nekonisi
Changing password for user nekonisi.
New password:
BAD PASSWORD: The password fails the dictionary check - it does not contain enough DIFFERENT characters
Retype new password:
passwd: all authentication tokens updated successfully.
#自分でも変更
[root@69523716df27 /]# su - nekonisi
Last login: Tue Apr 6 16:03:33 UTC 2021 on pts/1
[nekonisi@69523716df27 ~]$ passwd
Changing password for user nekonisi.
Changing password for nekonisi.
(current) UNIX password:
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
그룹 추가[root@69523716df27 /]# groupadd ginnan-boyz
[root@69523716df27 /]# cat /etc/group
root:x:0:
(省略)
nekonisi:x:1000:
ginnan-boyz:x:1001:
단체가 참가하다[root@69523716df27 /]# usermod -G ginnan-boyz nekonisi
[root@69523716df27 /]# cat /etc/group
root:x:0:
(省略)
nekonisi:x:1000:
ginnan-boyz:x:1001:nekonisi
[root@69523716df27 /]# su - nekonisi
Last login: Tue Apr 6 16:06:28 UTC 2021 on pts/1
[nekonisi@69523716df27 ~]$ groups
nekonisi ginnan-boyz
[nekonisi@69523716df27 ~]$ id
uid=1000(nekonisi) gid=1000(nekonisi) groups=1000(nekonisi),1001(ginnan-boyz)
그룹 삭제[root@69523716df27 /]# groupdel ginnan-boyz
[root@69523716df27 /]# cat /etc/gruop
cat: /etc/gruop: No such file or directory
[root@69523716df27 /]# cat /etc/group
root:x:0:
(省略)
nekonisi:x:1000:
※ 은행보이즈는 텃밭만 있으면 사라지지 않습니다.사용자 삭제
[root@69523716df27 /]# userdel nekonisi
[root@69523716df27 /]# ls /home/
nekonisi
#homeディレクトリも削除したい場合は
[root@69523716df27 /]# userdel -r nekonisi
[root@69523716df27 /]# ls /home/
Reference
이 문제에 관하여(LinuC 합격 1주만에 LPIC 기초 학습이 가능한 책 3일차 총결산), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/nekonisi/items/74ea880fbc70a4816198텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)