Linux - soup1997/Study-Alone GitHub Wiki
WIFI ์๋ ์ฐ๊ฒฐ
sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
wpa_passphrase ์์ดํ์ด์ด๋ฆ '๋น๋ฐ๋ฒํธ'
# ์ ๋ช
๋ น์ด ์
๋ ฅ ์ ์๋ ์ฒ๋ผ ์ถ๋ ฅ๋จ
network={
   ssid="์์ดํ์ด์ด๋ฆ"
   #psk="๋น๋ฐ๋ฒํธ"
   psk = ~~~
}
network={
   ssid="์์ดํ์ด์ด๋ฆ"
   #psk="๋น๋ฐ๋ฒํธ"
   psk=53d92a34f43d2dcda92866d8d99f70b895dd6bc247831a5310deea525d47eab1
}
# ์์ ๋ด์ฉ์ ๋ณต์ฌํด์ wpa_supplicant.conf์ ๋ถ์ฌ๋ฃ๊ธฐ
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
sudo reboot
IP ๊ณ ์  ํ ๋น
sudo nano /etc/dhcpcd.conf
interface wlan0
static ip_address=172.16.1.~
static routers=172.16.255.255
static netmask=255.255.0.0
sudo wpa_cli -i wlan0 reconfigure
์ฅ์น ์ด๋ฆ, ๊ถํ ๊ณ ์ 
๐น ์ฅ์น ์ด๋ฆ ๊ณ ์  ๋ฐ ๊ถํ ๊ณ ์ 
Difference between 'purge' and 'remove'
sudo apt remove package_name   
sudo apt purge package_name   
Both apt-remove and apt-purge do the same thing and that is to uninstall a package. The apt-purge removes the package and purges any configuration files associated with it. Thatโs the only difference between the two.
ํ๊ฒฝ๋ณ์ ์ค์ 
๐น ํ๊ฒฝ๋ณ์ ์ผ์ ์ ์ฉ
export ํ๊ฒฝ๋ณ์๋ช
 = ๊ฐ
๐น ์๋ฅผ๋ค์ด JAVA_HOME ํ๊ฒฝ ๋ณ์์ jdk์ ๊ฒฝ๋ก๋ฅผ ๋ฃ์ด์ฃผ๊ณ ์ถ๋ค๋ฉด ์๋์ ๊ฐ์ด ์ฌ์ฉ
export JAVA_HOME=/usr/java/jdk1.6.0_45
๐น ํ๊ฒฝ๋ณ์ ์๊ตฌ ์ ์ฉ
sudo sh -c "echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/lib64' >>/etc/profile"
๋๋ /etc/bash.bashrc ํ์ผ์ ์ด์ด์ ๋งจ ๋ง์ง๋ง ์ค์ ์ ์ฉํ๊ณ ์ ํ๋ ํ๊ฒฝ ๋ณ์๋ฅผ export ๋ช ๋ น์ด๋ก ์ค์ ํ๋ค.
GCC/G++ ์ฌ์ฉ๋ฒ
๐น GCC, c์ธ์ด ์ปดํ์ผ๋ฌ
# ์ค์น ๋ฐฉ๋ฒ
sudo apt get install gcc 
# ์ฝ๋ ์ปดํ์ผ
gcc [ํ์ผ๋ช
].c -o [์ถ๋ ฅํ  ํ์ผ๋ช
]
๐น G++, c++ ์ปดํ์ผ๋ฌ
# ์ค์น ๋ฐฉ๋ฒ
sudo apt get install g++
# ์ฝ๋ ์ปดํ์ผ
g++ [ํ์ผ๋ช
].cpp -o [์ถ๋ ฅํ  ํ์ผ๋ช
]
์ง์ ํ ํ์ผ๋ช ์ ์คํํ์ผ์ด ์์ฑ๋๋ฉด ํด๋น ํ์ผ์ ์คํ
./[์ถ๋ ฅ๋ ํ์ผ๋ช
]
Terminator
terminator
- 
์ํ ๋ถํ : Ctrl + Shift + O 
- 
์์ง ๋ถํ : : Ctrl + Shift + E 
- 
๋ค์ ์ฐฝ ํ์ฑํ : Ctrl + Tab or Ctrl + Shift + N 
- 
์ด์  ์ฐฝ ํ์ฑํ : Ctrl + Shift + Tab or Ctrl + Shift + P 
- 
ํ์ฌ ํ์ฑํ ๋ ์ฐฝ ๋ซ๊ธฐ : Ctrl + Shift + W 
- 
ํฐ๋ฏธ๋ค์ดํฐ ์คํ : Ctrl + Alt + T 
- 
ํฐ๋ฏธ๋ค์ดํฐ ์ข ๋ฃ : Ctrl + Shift + Q 
- 
์ ์ฒดํ๋ฉด : F11 
WSL
๐น Windows 10 WSL2 ์ค์น ๋ฐ ์ฌ์ฉ๋ฒ
๐น Linux์ฉ Windows ํ์ ์์คํ
 Linux GUI ์ฑ ์คํ
๋ช ๋ น์ด ์ถ์ฝ: Alias
bashrc์์ ๋ค์๊ณผ ๊ฐ์ด ์ถ๊ฐ
alias chrome='/usr/bin/google-chrome-stable'
๋๋ ํ ๋ฆฌ ์ญ์ 
๋น ๋๋ ํ ๋ฆฌ๋ฅผ ์ญ์ ํ๋ ค๋ฉด -d(--dir) ์ต์ ์ ์ฌ์ฉํ๊ณ ๋น์ด ์์ง ์์ ๋๋ ํ ๋ฆฌ๋ฅผ ์ญ์ ํ๋ฉฐ ๋ชจ๋ ๋ด์ฉ์ -r(--recursive ๋๋ -R) ์ต์ ์ ์ฌ์ฉ
rm -r directory_name
๊ถํ ๋ณ๊ฒฝ
๋๋ ํ ๋ฆฌ ๋ด๋ถ์ ์กด์ฌํ๋ ํ์ ๋๋ ํ ๋ฆฌ์ ํ์ผ์ ๊ถํ์ ๋ชจ๋ ๋ณ๊ฒฝํ๋ ค๋ฉด -R ์ต์ ์ ์ฌ์ฉ
- read(4), write(2), execute(1)
- ์ง์ ํ๋ ๊ถํ์ ์์๋๋ก User, Group, Other
sudo chmod XXX -R directory_name
Requirements.txt
requirements.txt ์์ฑ
pip freeze requirements.txt
requirements.txt ์ค์น
pip install -r requirements.txt 
CMake
1. CMake ํ๋ก์ ํธ ์์ฑ
ํ๋ก์ ํธ ํ์ผ๋ค์ ์์น์ํฌ ๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํ๋ค.
mkdir project
cd project
code .
2. CMakeLists.txt ์์ฑ
CMakeLists.txt ํ์ผ์ ํ๋ก์ ํธ ๊ฒฝ๋ก๋ง๋ค ์์น์์ผ์ผ ํ๋ค. ๋ฌธ๋ฒ์ ๋ํ ์ฌํญ์ ๋งํฌ ์ฐธ๊ณ
cmake_minimum_required(VERSION 3.0.0)
# create project
project(pcl_tutorial VERSION 0.1.0)
add_executable(pcl_tutorial main.cpp)
# find packages
find_package(PCL 1.10 REQUIRED)
if(PCL_FOUND)
  # [C/C++]>[General]>[Additional Include Directories]
  include_directories( ${PCL_INCLUDE_DIRS} )
  # [C/C++]>[Preprocessor]>[Preprocessor Definitions]
  add_definitions( ${PCL_DEFINITIONS} )
  # For Use Not PreCompiled Features 
  #add_definitions( -DPCL_NO_PRECOMPILE )
  # [Linker]>[General]>[Additional Library Directories]
  link_directories( ${PCL_LIBRARY_DIRS} )
  # [Linker]>[Input]>[Additional Dependencies]
  target_link_libraries( pcl_tutorial ${PCL_LIBRARIES} )
endif()
3. Build
- ๋จ์ถํค (Ctrl + Shift + P) ๋๋ฅธ ํ์ CMake: Build์คํ
- ๋๋ buildํด๋๋ก ๋๋ ํ ๋ฆฌ ๋ณ๊ฒฝ ํ
make
make ์๋ฃ ํ build/projectName ํ์ผ์ด ์์ฑ๋๋ค. ํด๋น ํ์ผ์ด ์คํํ์ผ์ด๋ฉฐ ์ฝ๋์ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํ  ์ ์๋ค.
cd ./build
./projectName
ํฌํธ/๋ฐฉํ๋ฒฝ ํ์ธ ๋ฐ ํฌํธ ์ด๊ธฐ
ํฌํธ ์ํ ํ์ธ
netstat -nap | grep LISTEN ํฌํธ๋ฒํธ
- n: host๋ช ์ผ๋ก ํ์ ์ํจ
- a: ๋ชจ๋ ์์ผ ํ์
- p: ํ๋ก์ธ์คID์ ํ๋ก๊ทธ๋จ๋ช ํ์
ํฌํธ ์ด๊ธฐ
์ธ๋ถ์์ ๋ค์ด์ค๋ inbound TCP/UDP ํฌํธ 12345์ ์ฐ๊ฒฐ์ ๋ฐ์๋ค์ธ๋ค๋ ๊ท์น์ 1๋ฒ ๋ฐฉํ๋ฒฝ ๊ท์น์ผ๋ก ์ถ๊ฐ
iptables -I INPUT 1 -p tcp --dport 12345 -j ACCEPT
iptables -I INPUT 1 -p udp --dport 12345 -j ACCEPT