
유용한 Linux Commands 들을 모아 Cheat Sheet로 정리
Linux Cheat Sheet
File Commands
- ls : 디렉토리 표출
- ls -al : 상세정보 및 숨겨진 파일 표출
- cd
dir:dir로 디렉토리 이동 - cd ~ : 홈 디렉토리로 이동
- pwd : 현재 디렉토리 경로 확인
- mkdir
dir:dir경로 생성 - rm
file:file삭제 - rm -r
dir:dir디렉토리 삭제 - rm -f
file:file강제 삭제 - rm -rf
dir:dir의 하위 디렉토리, 파일 강제 삭제 - cp
file1file2:file1에서file2로 복사 - cp -r
dir1dir2:dir1에서dir2로 복사
dir2가 없을 경우 디렉토리 생성 - mv
file1file2:file1에서file2로 파일명을 변경하거나 이동
file2가 존재하는 디렉토리 일 경우,file1을file2경로로 이동 - ln -s
filelink:file로 symboliclink생성 - touch
file:file생성 및 업데이트 - cat
file1file2: catfile1결과를file2로 복사 - more
file:file을 한페이지 씩 보여줌 (자세한 사항 –help 참고) - head
file-nnum: 처음num째 줄 까지 표출 - tail
file-nnum: 마지막num째 줄 까지 표출 - tail -f
file: 10번쨰 줄 까지 표출,file의 변경사항이 있을시 업데이트 (모니터링) - watch -n
numstr:str을num초 마다 확인 (stdin 모니터링)
Process Management
- ps : 최근 활성화된 프로세스들을 표시
- top : 모든 프로세스들을 표시
- kill
pid: 프로세스 ID(pid) 종료
File Permissions
- chmod
prmfile:file에prm에 해당하는 권한 추가 (사용자, 그룹, 기타사용자 순)- 4 : read (r)
- 2 : write (w)
- 1 : execute (x)
1 | |
SSH
- ssh
user@host:user,host에 연결 - ssh -p
portuser@host:user,host에 연결port추가 - ssh-copy-id
user@host:user,host에 ssh key 추가
Searching
command| greppattern:command결과 값에서pattern에 맞는 결과 출력- locate
file: 모든 디렉토리의file명 조회
System Info
- date : 날짜와 시간 표출
- cal : 이번달 캘린더 표출
- w : 온라인인 user 조회
- uname -a :
kernel information출력 - cat /proc/cpuinfo :
cpu information출력 - cat /proc/meminfo :
memory information출력 - man
command:command의 메뉴얼 출력 (–help와 비슷) - df :
disk usage출력 - du :
directory space usage출력 - free :
memory and swap usage출력
Network
- ping
host:host에 ping 결과 출력 - wget
url:url다운로드 - wget -c
url:url다운로드 (재실행)