데이터베이스 사용

Minhyeok Kim·2022년 8월 1일
0
post-thumbnail

[Part 1. 운영체제]

OS(운영체제), Operating System

CPU, 32 bit, 64 bit, Windows, Linux, Unix, Mac, Android, iOS

CLI (command Line Interface)
GUI (Graphical User Interface)

[Part 2. Network]

Protocol (프로토콜)
TCP UDP HTTP FTP SMTP...

RESTful API
URL (Uniform Resource Locator aka.web address)

e.g.
Protocol + domain name + port + path the the file + parameters + anchor

실전예습
지금 쓰고 있는 컴퓨터가 윈도우 10이라서 하나하나 준비를 해줘야 하는데 우선,
Windows store에서 터미널 설치하고

WSL2 를 검색해서

https://gaesae.com/161

8번과, 11번항목에 있는 주소를 터미널에 입력하여 WSL2 설치

그 다음으로 Window Store 에서 Ubuntu 를 검색하고,
22.04 LTS ver. 다운로드

[Part3. Linux]

리눅스의 역사?

[Part4. 데이터베이스]

데이터베이스란 뭘까?
데이터는 현실에 존재하는 사실적인 자료들의 집합이라고 볼 수 있다. 사람들의 나이 국적등 개인정보, 쇼핑몰의 상품종류 가격 등등 모든 게 자료로 고려된다. 이러한 데이터들이 가치를 가지려면 데이터들 사이에 논리적인 연관성이 있어야 한다. 논리적으로 연관된 데이터들을 체계적으로 정리하여 정보로 공유하고 사용할 수 있게 통합한 것을 데이터베이스라고 한다.

데이터베이스의 큰 특징으로는,

  1. Real Time Accessibility (실시간 접근성)
  2. Continuous Change (지속적인 변화)
  3. Concurrent Sharing (동시 공유)
  4. Reference By Content (내용에 따른 참조)

사용자 - 데이터베이스 관리시스템 (DBMS) - 데이터베이스

SQL설치
최신버전으로 다운로드 후 시스템환경설정에서 Path를 추가해줘
C:\Program Files\PostgreSQL\14\bin

설치후에 window + R 을 이용해 cmd 를 키고
psql --version 을 입력해서 제대로 설치가 되었는지 확인후

psql -U postgres //PW : postgres 를 입력해서 데이터베이스에 접근해

Database 를 만들고!

PostgreSQL을 활용해보자
\q :psql 종료
\l :데이타베이스를 조회
\c :입력한 데이터베이스로 이동
\dt :테이블 확인하기

If you have got a problem to write something, please check below

콘솔에서 쿼리문 작성하기 (테이블 작성)
postgres=# CREATE TABLE develop_book(book_id INTEGER,date DATE, name VARCHAR(80));

여기서,
CREATE TABLE : 명령어
develop_book (: 테이블명
book_id INTEGER, : 칼럼명(book_id) + 자료형(INTEGER)
date DATE, : 칼럼명 + 자료형
name VARCHAR(80) : 칼럼명 + 자료형
);

CRUD
Create, Read, Update, Delete

데이터 베이스 각종 명령어
CREATE DATABASE ~
DROP DATABASE ~
CREATE TABLE ~
DROP TABLE ~
INSERT INTO ~ VALUES (~)
INSERT INTO (~A) VALUES (~A) = 순서에 맞춰서
SELECT FROM ~
SELECT ~ FROM ~
SELECT
FROM ~ LIMIT ~
SELECT FROM ~ LIMIT ~ OFFSET ~
SELECT
FROM ~ ORDER BY ~ ASC
SELECT FROM ~ ORDER BY ~ DESC
SELECT
FROM ~ ORDER BY ~
SELECT FROM ~ WHERE ~
SELECT
FROM ~ WHERE ~ <> ~
대소 비교
=, <>, <=, >=, <, >

INSERT INTO board(id ,board_user,register_date,title,description,likes,image_name) VALUES (1, 1, '2020-05-02','Developer''s essay','Perhaps...',' ',' '),
(2, 3, '2020-09-28','Why the earth is round','I took...',' ','er.png'),
(3, 2, '2020-07-13','Coffee time','I had...',' ','coffee.jpeg'),
(4, 2, '2020-08-14','Chicken is inefficient','This is...',' ',' '),
(5, 1, '2020-06-22','When bothering','Let''s get...',' ',' ');

서브쿼리... 쿼리안에 쿼리가 들어가 있는 형태
e.g) SELECT * FROM develop_book WHERE '2020-01-03' = (SELECT date FROM develop_book WHERE book_id = 3);

데이터 수정하기
UPDATE 테이블명 SET 컬럼명 = 바꿀 데이터 내용 WHERE 수정할 로우의 조건 RETURNING *

데이터 삭제하기
DELETE FROM 테이블 명 WHERE 컬럼명 = 삭제할 데이터

모든 데이터 삭제하기
DELETE FROM 테이블명

이건 진짜 검은배경에서 하나하나 타이핑하고 틀리면 다시치고 하는게 엄청난 스트레스인듯

Ubuntu를 사용해서 리눅스환경 체험
root@LAPTOP-JJPVHET9:~# sudo adduser newuser

adduser: The user `newuser' already exists.
root@LAPTOP-JJPVHET9:~# w
 13:14:02 up 0 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# w
 13:14:04 up 0 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# w
 13:14:05 up 0 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# sudo userdel newuser21
userdel: user 'newuser21' does not exist
root@LAPTOP-JJPVHET9:~# sudo userdel newuser2
root@LAPTOP-JJPVHET9:~# w
 13:16:13 up 2 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# w
 13:16:13 up 2 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# sudo userdel newsuer
userdel: user 'newsuer' does not exist
root@LAPTOP-JJPVHET9:~# sudo userdel newuser
root@LAPTOP-JJPVHET9:~# sudo adduser newuser
Adding user `newuser' ...
Adding new group `newuser' (1000) ...
Adding new user `newuser' (1000) with group `newuser' ...
The home directory `/home/newuser' already exists.  Not copying from `/etc/skel'.
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for newuser
Enter the new value, or press ENTER for the default
        Full Name []: ivan
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# sudo su
root@LAPTOP-JJPVHET9:~# su -$ivan
root@LAPTOP-JJPVHET9:~# su -$newuser
root@LAPTOP-JJPVHET9:~# w
 13:19:47 up 6 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# w
 13:19:47 up 6 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# sudo su
root@LAPTOP-JJPVHET9:~# w
 13:20:16 up 6 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# w
 13:20:18 up 6 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# whoami
root
root@LAPTOP-JJPVHET9:~# dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe: command not found
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe: command not found
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe: command not found
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# w
 13:25:55 up 12 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# w
 13:25:56 up 12 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# cd /
root@LAPTOP-JJPVHET9:/# ls
bin   dev  home  lib    lib64   media  opt   root  sbin  srv  tmp  var
boot  etc  init  lib32  libx32  mnt    proc  run   snap  sys  usr
root@LAPTOP-JJPVHET9:/#
root@LAPTOP-JJPVHET9:/# su -$newuser
root@LAPTOP-JJPVHET9:~# su -$ivan
root@LAPTOP-JJPVHET9:~# w
 13:29:01 up 15 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# w
 13:29:02 up 15 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# w
 13:30:00 up 16 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# s
s: command not found
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# w
 13:30:04 up 16 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# w
 13:30:05 up 16 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# is
Command 'is' not found, but can be installed with:
apt install ironseed
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# cd /
root@LAPTOP-JJPVHET9:/# ls
bin   dev  home  lib    lib64   media  opt   root  sbin  srv  tmp  var
boot  etc  init  lib32  libx32  mnt    proc  run   snap  sys  usr
root@LAPTOP-JJPVHET9:/# w
 13:30:29 up 16 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:/# w
 13:30:30 up 16 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:/# grep /bin/bash /etc/passwd
root:x:0:0:root:/root:/bin/bash
newuser:x:1000:1000:ivan,,,:/home/newuser:/bin/bash
root@LAPTOP-JJPVHET9:/# grep /bin/bash /etc/passwd | cut -f1 -d:
root
newuser
root@LAPTOP-JJPVHET9:/# touch test4
root@LAPTOP-JJPVHET9:/# ls
bin   dev  home  lib    lib64   media  opt   root  sbin  srv  test4  usr
boot  etc  init  lib32  libx32  mnt    proc  run   snap  sys  tmp    var
root@LAPTOP-JJPVHET9:/# touch test
root@LAPTOP-JJPVHET9:/# ls
bin   dev  home  lib    lib64   media  opt   root  sbin  srv  test   tmp  var
boot  etc  init  lib32  libx32  mnt    proc  run   snap  sys  test4  usr
root@LAPTOP-JJPVHET9:/# touch test
root@LAPTOP-JJPVHET9:/# ls
bin   dev  home  lib    lib64   media  opt   root  sbin  srv  test   tmp  var
boot  etc  init  lib32  libx32  mnt    proc  run   snap  sys  test4  usr
root@LAPTOP-JJPVHET9:/# mkdir dir-test
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   test4  usr
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  tmp    var
root@LAPTOP-JJPVHET9:/# cd dir-test/
root@LAPTOP-JJPVHET9:/dir-test# ls
root@LAPTOP-JJPVHET9:/dir-test# touch inner-test
root@LAPTOP-JJPVHET9:/dir-test# ls
inner-test
root@LAPTOP-JJPVHET9:/dir-test# touch 이름
root@LAPTOP-JJPVHET9:/dir-test# ls
inner-test  이름
root@LAPTOP-JJPVHET9:/dir-test# whoami
root
root@LAPTOP-JJPVHET9:/dir-test# rm inner-test
root@LAPTOP-JJPVHET9:/dir-test# ls
이름
root@LAPTOP-JJPVHET9:/dir-test# cd ..
root@LAPTOP-JJPVHET9:/# rm test4
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# cd dir-test/
root@LAPTOP-JJPVHET9:/dir-test# cd -
/
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# cd -
/dir-test
root@LAPTOP-JJPVHET9:/dir-test# ls
이름
root@LAPTOP-JJPVHET9:/dir-test# cd -
/
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# pwd
/
root@LAPTOP-JJPVHET9:/# pwd
/
root@LAPTOP-JJPVHET9:/# cd ~
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# pwd
/root
root@LAPTOP-JJPVHET9:~# pwd
/root
root@LAPTOP-JJPVHET9:~# cd $HOME
root@LAPTOP-JJPVHET9:~# pwd
/root
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# pwd
/root
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# cd \
> ls
-bash: cd: ls: No such file or directory
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# cd /
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# cd ~
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# ls
root@LAPTOP-JJPVHET9:~# pwd
/root
root@LAPTOP-JJPVHET9:~# cd /home/meta-note
-bash: cd: /home/meta-note: No such file or directory
root@LAPTOP-JJPVHET9:~# pwd
/root
root@LAPTOP-JJPVHET9:~# mkdir parent
root@LAPTOP-JJPVHET9:~# ls
parent
root@LAPTOP-JJPVHET9:~# cd parent/
root@LAPTOP-JJPVHET9:~/parent# ls
root@LAPTOP-JJPVHET9:~/parent# ls
root@LAPTOP-JJPVHET9:~/parent# pwd
/root/parent
root@LAPTOP-JJPVHET9:~/parent# mkdir child
root@LAPTOP-JJPVHET9:~/parent# rm child
rm: cannot remove 'child': Is a directory
root@LAPTOP-JJPVHET9:~/parent# rmdir child
root@LAPTOP-JJPVHET9:~/parent# ls
root@LAPTOP-JJPVHET9:~/parent# pwd
/root/parent
root@LAPTOP-JJPVHET9:~/parent# mkdir child-A
root@LAPTOP-JJPVHET9:~/parent# cd child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# ls
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ..
root@LAPTOP-JJPVHET9:~/parent# cd child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# ls
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ..
root@LAPTOP-JJPVHET9:~/parent# ls
child-A
root@LAPTOP-JJPVHET9:~/parent# cd child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ..
root@LAPTOP-JJPVHET9:~/parent# mkdir child-B
root@LAPTOP-JJPVHET9:~/parent# cd child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# cd../child-B
-bash: cd../child-B: No such file or directory
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ..
root@LAPTOP-JJPVHET9:~/parent# ls
child-A  child-B
root@LAPTOP-JJPVHET9:~/parent# cd child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ../child-B
root@LAPTOP-JJPVHET9:~/parent/child-B# pwd
/root/parent/child-B
root@LAPTOP-JJPVHET9:~/parent/child-B# cd ..
root@LAPTOP-JJPVHET9:~/parent# cd ./child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# pwd
/root/parent/child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ~
root@LAPTOP-JJPVHET9:~# touch test.exe
root@LAPTOP-JJPVHET9:~# ls
parent  test.exe
root@LAPTOP-JJPVHET9:~# rm test.exe
root@LAPTOP-JJPVHET9:~# ls
parent
root@LAPTOP-JJPVHET9:~# rm --help
Usage: rm [OPTION]... [FILE]...
Remove (unlink) the FILE(s).

  -f, --force           ignore nonexistent files and arguments, never prompt
  -i                    prompt before every removal
  -I                    prompt once before removing more than three files, or
                          when removing recursively; less intrusive than -i,
                          while still giving protection against most mistakes
      --interactive[=WHEN]  prompt according to WHEN: never, once (-I), or
                          always (-i); without WHEN, prompt always
      --one-file-system  when removing a hierarchy recursively, skip any
                          directory that is on a file system different from
                          that of the corresponding command line argument
      --no-preserve-root  do not treat '/' specially
      --preserve-root[=all]  do not remove '/' (default);
                              with 'all', reject any command line argument
                              on a separate device from its parent
  -r, -R, --recursive   remove directories and their contents recursively
  -d, --dir             remove empty directories
  -v, --verbose         explain what is being done
      --help     display this help and exit
      --version  output version information and exit

By default, rm does not remove directories.  Use the --recursive (-r or -R)
option to remove each listed directory, too, along with all of its contents.

To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:
  rm -- -foo

  rm ./-foo

Note that if you use rm to remove a file, it might be possible to recover
some of its contents, given sufficient expertise and/or time.  For greater
assurance that the contents are truly unrecoverable, consider using shred.

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/rm>
or available locally via: info '(coreutils) rm invocation'
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# touch test
root@LAPTOP-JJPVHET9:~# ls
parent  test
root@LAPTOP-JJPVHET9:~# cp test test2
root@LAPTOP-JJPVHET9:~# ls
parent  test  test2
root@LAPTOP-JJPVHET9:~# vim
root@LAPTOP-JJPVHET9:~# vim test
root@LAPTOP-JJPVHET9:~# ls
parent  test  test2
root@LAPTOP-JJPVHET9:~# cat test
aaaa
root@LAPTOP-JJPVHET9:~# vim test
root@LAPTOP-JJPVHET9:~# cat test
ivan is back aaaaaaaa!!
root@LAPTOP-JJPVHET9:~# ls
parent  test  test2
root@LAPTOP-JJPVHET9:~# cd child-A
-bash: cd: child-A: No such file or directory
root@LAPTOP-JJPVHET9:~# cd parent
root@LAPTOP-JJPVHET9:~/parent# ls
child-A  child-B
root@LAPTOP-JJPVHET9:~/parent# cd child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ./child-B
-bash: cd: ./child-B: No such file or directory
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ../child-B
root@LAPTOP-JJPVHET9:~/parent/child-B# ls
root@LAPTOP-JJPVHET9:~/parent/child-B# touch toy-B
root@LAPTOP-JJPVHET9:~/parent/child-B# ls
toy-B
root@LAPTOP-JJPVHET9:~/parent/child-B# cat toy-B
root@LAPTOP-JJPVHET9:~/parent/child-B# vim toy-B
root@LAPTOP-JJPVHET9:~/parent/child-B# ls
toy-B
root@LAPTOP-JJPVHET9:~/parent/child-B# cat toy-B
this toy is belong to child-B
root@LAPTOP-JJPVHET9:~/parent/child-B# cd ./child-A
-bash: cd: ./child-A: No such file or directory
root@LAPTOP-JJPVHET9:~/parent/child-B# cd ../child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# ls
root@LAPTOP-JJPVHET9:~/parent/child-A# touch toy-A
root@LAPTOP-JJPVHET9:~/parent/child-A# ls
toy-A
root@LAPTOP-JJPVHET9:~/parent/child-A# vim toy-A
root@LAPTOP-JJPVHET9:~/parent/child-A# ls
toy-A
root@LAPTOP-JJPVHET9:~/parent/child-A# cat toy-A
This toy is not belong to Child-B
root@LAPTOP-JJPVHET9:~/parent/child-A# cay toy-B
Command 'cay' not found, did you mean:
  command 'cam' from deb libcamera-tools (0~git20200629+e7aa92a-9)
  command 'cai' from deb emboss (6.6.0+dfsg-11ubuntu1)
  command 'cas' from deb amule-utils (1:2.3.3-2)
  command 'cal' from deb ncal (12.1.7+nmu3ubuntu2)
  command 'caf' from deb libcoarrays-mpich-dev (2.9.2-3)
  command 'caf' from deb libcoarrays-openmpi-dev (2.9.2-3)
  command 'car' from deb ucommon-utils (7.0.0-20ubuntu2)
  command 'say' from deb gnustep-gui-runtime (0.29.0-2build1)
  command 'cap' from deb capistrano (3.16.0-1)
  command 'cat' from deb coreutils (8.32-4.1ubuntu1)
Try: apt install <deb name>
root@LAPTOP-JJPVHET9:~/parent/child-A# cat -toyB
cat: invalid option -- 'o'
Try 'cat --help' for more information.
root@LAPTOP-JJPVHET9:~/parent/child-A# cat toy-B
cat: toy-B: No such file or directory
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ../child-B
root@LAPTOP-JJPVHET9:~/parent/child-B# ls
toy-B
root@LAPTOP-JJPVHET9:~/parent/child-B# cd ../
root@LAPTOP-JJPVHET9:~/parent# cd ../
root@LAPTOP-JJPVHET9:~# cd parent
root@LAPTOP-JJPVHET9:~/parent# cd ./parent
-bash: cd: ./parent: No such file or directory
root@LAPTOP-JJPVHET9:~/parent# cd ../
root@LAPTOP-JJPVHET9:~# cd parent
root@LAPTOP-JJPVHET9:~/parent# cat toy-A
cat: toy-A: No such file or directory
root@LAPTOP-JJPVHET9:~/parent# ls
child-A  child-B
root@LAPTOP-JJPVHET9:~/parent# cd ../
root@LAPTOP-JJPVHET9:~# ls
parent  test  test2
root@LAPTOP-JJPVHET9:~# cat test
ivan is back aaaaaaaa!!
root@LAPTOP-JJPVHET9:~# cat test2
root@LAPTOP-JJPVHET9:~# pwd
/root
root@LAPTOP-JJPVHET9:~# ls
parent  test  test2
root@LAPTOP-JJPVHET9:~# ls
parent  test  test2
root@LAPTOP-JJPVHET9:~# vim test
root@LAPTOP-JJPVHET9:~# cat =test
cat: '=test': No such file or directory
root@LAPTOP-JJPVHET9:~# cat test
ivan is back. when you come back to this file to edit the contents, you should press "i" to revise.
it means, it activates insert mode

let apple = 3
function ~

consol.log("ivan");
.
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# vim test2
root@LAPTOP-JJPVHET9:~# python3 test.py
python3: can't open file '/root/test.py': [Errno 2] No such file or directory
root@LAPTOP-JJPVHET9:~# ls
parent  test  test2
root@LAPTOP-JJPVHET9:~# ls
parent  test  test2
root@LAPTOP-JJPVHET9:~# vim test.py
root@LAPTOP-JJPVHET9:~# cat test.py
print("python test");

root@LAPTOP-JJPVHET9:~# vim test.py
root@LAPTOP-JJPVHET9:~# cat test.py
print("python test")


root@LAPTOP-JJPVHET9:~# python3
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('dett')
dett
>>>
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# python3
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# cd parent
root@LAPTOP-JJPVHET9:~/parent# cd child-A
root@LAPTOP-JJPVHET9:~/parent/child-A# cd ../child-B
root@LAPTOP-JJPVHET9:~/parent/child-B# ../
-bash: ../: Is a directory
root@LAPTOP-JJPVHET9:~/parent/child-B# cd ../
root@LAPTOP-JJPVHET9:~/parent# cd /
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/#
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# cd /HOME
-bash: cd: /HOME: No such file or directory
root@LAPTOP-JJPVHET9:/# ls
bin   dev       etc   init  lib32  libx32  mnt  proc  run   snap  sys   tmp  var
boot  dir-test  home  lib   lib64  media   opt  root  sbin  srv   test  usr
root@LAPTOP-JJPVHET9:/# cd parent
-bash: cd: parent: No such file or directory
root@LAPTOP-JJPVHET9:/#
root@LAPTOP-JJPVHET9:/# w
 14:10:56 up 57 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:/# w
 14:10:56 up 57 min,  0 users,  load average: 0.52, 0.58, 0.59
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root@LAPTOP-JJPVHET9:/#
root@LAPTOP-JJPVHET9:/# /cd ~
-bash: /cd: No such file or directory
root@LAPTOP-JJPVHET9:/#
root@LAPTOP-JJPVHET9:/# /pwd
-bash: /pwd: No such file or directory
root@LAPTOP-JJPVHET9:/# pwd
/
root@LAPTOP-JJPVHET9:/# mkdir root
mkdir: cannot create directory ‘root’: File exists
root@LAPTOP-JJPVHET9:/# pwd
/
root@LAPTOP-JJPVHET9:/# cd root
root@LAPTOP-JJPVHET9:~# pwd
/root
root@LAPTOP-JJPVHET9:~# touch test3
root@LAPTOP-JJPVHET9:~# mkdir aaa
root@LAPTOP-JJPVHET9:~# ls
aaa  parent  test  test.py  test2  test3
root@LAPTOP-JJPVHET9:~# rm test3
root@LAPTOP-JJPVHET9:~# ls
aaa  parent  test  test.py  test2
root@LAPTOP-JJPVHET9:~# cat test2

root@LAPTOP-JJPVHET9:~# co test test2
Command 'co' not found, but can be installed with:
apt install rcs
root@LAPTOP-JJPVHET9:~# cp test test2
root@LAPTOP-JJPVHET9:~# cat test2
ivan is back. when you come back to this file to edit the contents, you should press "i" to revise.
it means, it activates insert mode

let apple = 3
function ~

consol.log("ivan");
.
root@LAPTOP-JJPVHET9:~# cat test
ivan is back. when you come back to this file to edit the contents, you should press "i" to revise.
it means, it activates insert mode

let apple = 3
function ~

consol.log("ivan");
.
root@LAPTOP-JJPVHET9:~# ls
aaa  parent  test  test.py  test2
root@LAPTOP-JJPVHET9:~# rm test.py
root@LAPTOP-JJPVHET9:~# ls
aaa  parent  test  test2
root@LAPTOP-JJPVHET9:~# cp test ./aaa
root@LAPTOP-JJPVHET9:~# ls
aaa  parent  test  test2
root@LAPTOP-JJPVHET9:~# cd aaa
root@LAPTOP-JJPVHET9:~/aaa# ls
test
root@LAPTOP-JJPVHET9:~/aaa# cat test
ivan is back. when you come back to this file to edit the contents, you should press "i" to revise.
it means, it activates insert mode

let apple = 3
function ~

consol.log("ivan");
.
root@LAPTOP-JJPVHET9:~/aaa# is
Command 'is' not found, but can be installed with:
apt install ironseed
root@LAPTOP-JJPVHET9:~/aaa# ls
test
root@LAPTOP-JJPVHET9:~/aaa# cp test /root/parent/aaa/test999
cp: cannot create regular file '/root/parent/aaa/test999': No such file or directory
root@LAPTOP-JJPVHET9:~/aaa# pwd
/root/aaa
root@LAPTOP-JJPVHET9:~/aaa# cp test /root/aaa/test999
root@LAPTOP-JJPVHET9:~/aaa# ls
test  test999
root@LAPTOP-JJPVHET9:~/aaa# cat test999
ivan is back. when you come back to this file to edit the contents, you should press "i" to revise.
it means, it activates insert mode

let apple = 3
function ~

consol.log("ivan");
.
root@LAPTOP-JJPVHET9:~/aaa# cd ..
root@LAPTOP-JJPVHET9:~# ls
aaa  parent  test  test2
root@LAPTOP-JJPVHET9:~# mv test aaa
root@LAPTOP-JJPVHET9:~# ls
aaa  parent  test2
root@LAPTOP-JJPVHET9:~# cd aaa
root@LAPTOP-JJPVHET9:~/aaa# ls
test  test999
root@LAPTOP-JJPVHET9:~/aaa# mv test2 test
mv: cannot stat 'test2': No such file or directory
root@LAPTOP-JJPVHET9:~/aaa# ls
test  test999
root@LAPTOP-JJPVHET9:~/aaa# cd ..
root@LAPTOP-JJPVHET9:~# ls
aaa  parent  test2
root@LAPTOP-JJPVHET9:~# mv test2 test
root@LAPTOP-JJPVHET9:~# is
Command 'is' not found, but can be installed with:
apt install ironseed
root@LAPTOP-JJPVHET9:~# ls
aaa  parent  test
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# git
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [--super-prefix=<path>] [--config-env=<name>=<envvar>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone     Clone a repository into a new directory
   init      Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add       Add file contents to the index
   mv        Move or rename a file, a directory, or a symlink
   restore   Restore working tree files
   rm        Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
   bisect    Use binary search to find the commit that introduced a bug
   diff      Show changes between commits, commit and working tree, etc
   grep      Print lines matching a pattern
   log       Show commit logs
   show      Show various types of objects
   status    Show the working tree status

grow, mark and tweak your common history
   branch    List, create, or delete branches
   commit    Record changes to the repository
   merge     Join two or more development histories together
   rebase    Reapply commits on top of another base tip
   reset     Reset current HEAD to the specified state
   switch    Switch branches
   tag       Create, list, delete or verify a tag object signed with GPG
Selecting previously unselected package net-tools.
(Reading database ... 33875 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60+git20181103.0eebece-1ubuntu5_amd64.deb ...
Unpacking net-tools (1.60+git20181103.0eebece-1ubuntu5) ...
Setting up net-tools (1.60+git20181103.0eebece-1ubuntu5) ...
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning candidates...
Scanning processor microcode...
Scanning linux images...
   pull      Fetch from and integrate with another repository or a local branch
Failed to retrieve available kernel versions.sociated objects

Failed to check for processor microcode upgrades.bcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
No services need to be restarted.nd or concept.
See 'git help git' for an overview of the system.
No containers need to be restarted.
root@LAPTOP-JJPVHET9:~# netstat
User sessions running outdated binaries:installed with:
 root @ /dev/pts/0: bash[85,93,109], su[84,92,108]
 root @ /dev/pts/1: apt[429,503], bash[129,170,186], sh[508], su[128,169,185]
 root @ /dev/tty1: bash[9], init[8]
Building dependency tree... Done
No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# remove it.
root@LAPTOP-JJPVHET9:~# es will be installed:
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# alled, 0 to remove and 0 not upgraded.
root@LAPTOP-JJPVHET9:~# chives.
root@LAPTOP-JJPVHET9:~# 9 kB of additional disk space will be used.
root@LAPTOP-JJPVHET9:~# ntu.com/ubuntu jammy/main amd64 net-tools amd64 1.60+git20181103.0eebece-1ubuntu5 [204 kB]
root@LAPTOP-JJPVHET9:~# .7 kB/s)
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# git
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [--super-prefix=<path>] [--config-env=<name>=<envvar>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone     Clone a repository into a new directory
   init      Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add       Add file contents to the index
   mv        Move or rename a file, a directory, or a symlink
   restore   Restore working tree files
   rm        Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
   bisect    Use binary search to find the commit that introduced a bug
   diff      Show changes between commits, commit and working tree, etc
   grep      Print lines matching a pattern
   log       Show commit logs
   show      Show various types of objects
   status    Show the working tree status

grow, mark and tweak your common history
   branch    List, create, or delete branches
   commit    Record changes to the repository
   merge     Join two or more development histories together
   rebase    Reapply commits on top of another base tip
   reset     Reset current HEAD to the specified state
   switch    Switch branches
   tag       Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
   fetch     Download objects and refs from another repository
   pull      Fetch from and integrate with another repository or a local branch
   push      Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.
root@LAPTOP-JJPVHET9:~#
root@LAPTOP-JJPVHET9:~# netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node   Path
root@LAPTOP-JJPVHET9:~#

리눅스환경에서 작업하는데 필요한 단축키는 꽤나 많으니 꼭 찾아서 연습해보는것이 좋겠다.

0개의 댓글