[Linux] clear, history, find, export, alias

2023. 3. 14. 17:55CS/Linux

  • clear
    • 터미널 창 내용 지우기
  • history
    • 최근순으로입력한  쉘 커맨드 출력
  104  clear
  105  ls
  106  pwd
  107  cd ..
  108  ls
  109  history
yoonho@DESKTOP-QJCBDQD:/home$
  • find . -name [파일 이름]
    • 파일, 디렉토리 검색
    • .은 현재 디렉토리에서 검색
yoonho@DESKTOP-QJCBDQD:~/workspace$ find . -name test1.txt
./test1.txt
yoonho@DESKTOP-QJCBDQD:~/workspace$ find . -name test3.txt
yoonho@DESKTOP-QJCBDQD:~/workspace$
  • export [환경 변수 이름]
    • 환경 변수 설정
    • 쉘 내에서 계속 저장하기 위해서는 .bashrc, .zshrc에 환경변수를 저장
    • source ~/.bashrc or source ~/.zshrc로 리눅스 환경설정을 재 로그인하지 않고 즉시 적용 가능
yoonho@DESKTOP-QJCBDQD:~/workspace$ export environment="testpath"
yoonho@DESKTOP-QJCBDQD:~/workspace$ env
...
environment=testpath
...
  • alias [별칭 이름]="[명령어]"
    • 지정한 이름으로 별칭 설정
    • alias 명령어로 모든 별칭 확인 가능
yoonho@DESKTOP-QJCBDQD:~/workspace$ alias his="history"
yoonho@DESKTOP-QJCBDQD:~/workspace$ his
...
  127  alias
  128  alias his="history"
  129  his