linux 기본 명령어 정리 - (1)

chn3·2021년 9월 9일
0

linux

목록 보기
1/1
post-thumbnail

<리눅스>

오늘부턴 secure shell의 약자인 SSH를 이용한 putty를 이용해서 리눅스를 공부하려 한다. putty란 다른 컴퓨터에 원격으로 연결해 명령을 실행하는 프로그램이다.

putty 다운로드 링크

위를 통해 다운받고 실행시키면,


첫 화면은 이렇게 생겼고 연결하고자 하는 host ip에 접속해 실행할 수 있다. connection type으론 위의 SSH를 이용한다.

기본 명령어 및 사용법

(dir은 디렉토리, f는 파일을 의미한다)


0. ls | ls-a | ls -al
list -> 디렉토리/파일 목록 보기

-a, -al : 모든 파일 출력
-l : 소유자, 권한, 크기, 날짜 등 정보 출력
-s : 파일 크기 출력
--help : 도움말 출력

1. mkdir | rmdir | touch | rm -f | rm -d

mkdir (dir_name) -> to make a dir
rmdir (dir_name) -> to remove a dir
touch (file_name) -> to make a file
rm -f -> to remove a file
rm -d -> to remove a directory

2. drwxrwxrwx
user, group, other의 read,write,excute에 대한 권한 여부를 나타낸다.

명령어 ls -al을 했을 때 보이는 문자열 중 맨 앞 하나는 d, l, - 중 하나가 오게 된다.

d : directory
l : link
- : file
------------------------------------------
rwx * 3 -> user, group, other respectively
(r : read, w : write, x : excute)

3. chmod
2번의 rwx를 1비트를 이용해 권한 부여

r = 2^2, w = 2^1, x = 2^0; 1bit
ex) r-w = 2^2 + 0 + 2^0 = 5


how) chmod (755) (file_name)
+ ls -al to check out

4. cd
Change Directiory -> 디렉터리 이동

cd (dir) : dir로 이동
/ : 최상위 디렉토리
. : 현재 디렉토리
.. : 상위 디렉토리
~ : 홈 디렉토리

+) 주소

pwd : 현지 주소
/ : 절대 주소
./ : 현재 주소
../ : 현재 주소 상위
~/ : home 주소


ex)
절대 주소) cd /home/test/(dir)
현재 주소) cd ./(dir)
home 주소) cd ~/(dir)

5. mv
디렉토리나 파일을 새로운 이름이나 경로로 설정

mv (origin_file) (new_file or dir)
	: change the name and location of the file

6. cp
파일, 디렉토리 각각을 다른 것에 복사

cp (origin_file) (new_file)
cp -r (origin_dir) (new_dir)
	: copy the file or dir to another

0개의 댓글