find
find / -name my.cnf 2>/dev/null
/์์๋ถํฐ my.cnf๋ผ๋ ์ด๋ฆ์ ํ์ผ์ ์ฐพ๋ ๋ช ๋ น์ด๋ค. ๋ค์ 2>/dev/null์ Permission denied ๊ฐ์ ํ์ค ์ค๋ฅ ๋ฌธ์๊ฐ ๋จ๋ฉด /dev/null๋ก ๋ฆฌ๋ค์ด๋ ์ ์์ผ์ ์ค๋ฅ ๋ฌธ๊ตฌ๊ฐ ์ถ๋ ฅ์ ํ์ง ์๊ธฐ ์ํจ์ด๋ค.
์ฅ์ : ๊ธฐ๋ณธ์ ์ธ ํ์ผ ์ฐพ๋ ๋ช ๋ น์ด์ด๊ณ ๋ค์ํ ์ต์ ๋ค์ ์ฌ์ฉํ ์ ์๋ค.
๋จ์ : ํ์ผ์ ์ฐพ๋๋ฐ ์ค๋ ์๊ฐ์ด ๊ฑธ๋ฆฐ๋ค.
locate
locate my.cnf
๊ฒ์ ๋ชฉ๋ก์ ๋ฏธ๋ฆฌ mlocate.db ํ์ผ์ ์ธ๋ฑ์ฑ ํ๋ฏ๋ก find ๋ณด๋ค ๋ ๋น ๋ฅด๊ฒ ํ์ผ์ ์ฐพ์ ์ ์๋ค. ์ฃผ๊ธฐ์ ์ผ๋ก ํ์ผ์ ๋ชฉ๋ก์ ๊ธฐ๋กํ๋ cron ์ค์ผ์ค์ด ์๋ํ๋ค.
์ฅ์ : find ๋ช ๋ น์ด ๋ณด๋ค ๋น ๋ฅธ ์๋๋ก ํ์ผ์ ์ฐพ์ ์ ์๋ค.
๋จ์ : ๋ฆฌ๋ ์ค์ ์ค์น๊ฐ ๋์ง ์์ ๊ฒฝ์ฐ์ ์ค์น๊ฐ ํ์ํ๋ค. (sudo apt install mlocate -y)
์ฐธ๊ณ :
๋ฆฌ๋ ์ค locate ๋ช ๋ น์ด ์ฌ์ฉ๋ฒ ์ ๋ฆฌ (updatedb ๋ช ๋ น์ด, mlocate ์ค์น, ํ์ผ ๊ฒ์)
๋ฆฌ๋ ์ค(Linux)์์ ํ์ผ์ ๊ฒ์ํ๊ธฐ ์ํด ์ฃผ๋ก find ๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํฉ๋๋ค. find ๋ช ๋ น์ด๋ ๋ค์ํ ์ต์ ์ด ์์ด์ ์ํ๋ ํ์ผ์ ๊ฑฐ์ ์๋ฒฝํ๊ฒ ์ฐพ์๋ผ ์ ์์ง๋ง ์ฒ์๋ถํฐ ํ๋ํ๋ ๊ฒ์์ ์ํํ๊ธฐ
withcoding.com