뒤로가기

리눅스 명령어

#용량
du -h 
du -hs 

#프로세스 확인
ps -ef 
kill -9 12345

#폴더
ls 
ll
ls -al 
ls -l

#권한
chmod 755 -R /test
chown www-data:www-data /test

pwd #경로

cp test.txt aaa.txt #copy
mv test.txt ./a/test.txt #move
rm -r 경로 #삭제 
mkdir 이름 #폴더생성
rmdir #빈디렉토리 삭제
cat test.txt #파일보기
vi test.txt #에디터 
tar -xvf archive.tar #압축/해제
gzip file.txt #압축
gunzip file.txt.gz #압축해제
zip -r archive.zip folder/ #zip 압축
unzip archive.zip #zip해제
wget http://example.com/file.txt #파일받기
systemctl start sshd

grep "search_term" file.txt #문자검색
# 파일에서 특정 패턴을 만족하는 부분 찾기
$ grep "패턴" 파일경로

# 파일명과 라인을 함께 표시하기
$ grep --with-filename --line-number "패턴" 파일경로

# 매칭하지 않는 부분 표시하기
$ grep --invert-match "패턴"

# cat과 함께 사용하기
$ cat 파일경로 | grep "패턴"

find / -name filename.txt #폴더검색

crontab -e #크론관리
tail -f /var/log/syslog #파일의 끝 부분을 출력

alias ll='ls -l' #별칭

mount /dev/sdb1 /mnt/usb #마운트
umount /mnt/usb #언마운트


passwd username #패스워드바꾸기

nslookup example.com #서버,dns 확인
ping example.com #핑확인

ifconfig #네트워크확인