웹사이트 검색

덜 알려진 Linux용 명령 10가지 - 3부


즉, "잘 알려지지 않은 Linux 기사" 시리즈의 마지막 두 기사의 반응에 압도되었습니다.

  1. 11가지 덜 알려진 유용한 리눅스 명령 - 1부
  2. 덜 알려진 Linux 명령 10가지 - 2부
  3. 덜 알려진 효과적인 Linux 명령 10가지 - 4부
  4. 덜 알려진 유용한 Linux 명령 10가지 - 5부

우리는 덜 알려진 Linux 명령 몇 가지를 포함하는 이 시리즈의 세 번째 기사를 작성했습니다. 아마도 당신은 이미 이러한 명령을 알고 있을 것입니다. 의심할 바 없이 당신은 숙련된 Linux 사용자이고 탐색을 좋아합니다.

22. ^foo^bar 명령

단일 인스턴스에서 마지막 명령을 수정하여 실행합니다. 'Desktop'과 같은 디렉토리의 콘텐츠를 길게 나열하려면 'ls -l' 명령을 실행해야 한다고 가정해 보겠습니다. 실수로 'lls -l'을 입력했습니다. 따라서 이제 전체 명령을 다시 입력하거나 탐색 키를 사용하여 이전 명령을 편집해야 합니다. 명령이 길면 고통스럽습니다.

avi@localhost:~/Desktop$ lls -l 

bash: lls: command not found
avi@localhost:~/Desktop$ ^lls^ls 

ls -l 
total 7489440 

drwxr-xr-x 2 avi  avi       36864 Nov 13  2012 101MSDCF 
-rw-r--r-- 1 avi  avi      206833 Nov  5 15:27 1.jpg 
-rw-r--r-- 1 avi  avi      158951 Nov  5 15:27 2.jpg 
-rw-r--r-- 1 avi  avi       90624 Nov  5 12:59 Untitled 1.doc

참고: 위 교체에서는 “^typo(to be replacement)^original_command ”를 사용했습니다. 고의로 또는 무의식적으로 오타를 시스템 명령이나 rm -rf와 같은 위험한 명령으로 대체한 경우 이 명령은 매우 위험할 수 있습니다.

23. > file.txt 명령

이 명령은 동일한 파일을 제거하고 다시 생성할 필요 없이 파일의 내용을 플러시합니다. 이 명령은 출력이 필요하거나 동일한 파일에 계속해서 로그온할 때 스크립팅 언어에서 매우 유용합니다.

텍스트가 많은 '데스크톱'에 'test.txt'라는 파일이 있습니다.

avi@localhost:~/Desktop$ cat test.txt 

Linux 
GNU 
Debian 
Fedora 
kali 
ubuntu 
git 
Linus 
Torvalds
avi@localhost:~/Desktop$ > test.txt 
avi@localhost:~/Desktop$ cat test.txt

참고: 이 명령은 위험할 수 있으므로 시스템 파일이나 구성 파일의 내용을 플러시하려고 시도하지 마세요. 그렇게 하면 심각한 문제에 빠지게 됩니다.

24. 명령에

'at' 명령은 cron 명령과 유사하며 지정된 시간에 실행되도록 작업이나 명령을 예약하는 데 사용할 수 있습니다.

avi@localhost:~/Desktop$ echo "ls -l > /dev/pts/0" | at 14:012

OR

avi@localhost:~/Desktop$ echo "ls -l > /dev/pts/0" | at 2:12 PM
샘플 출력
-rw-r--r-- 1 avi  avi      220492 Nov  1 13:49 Screenshot-1.png 
-rw-r--r-- 1 root root        358 Oct 17 10:11 sources.list 
-rw-r--r-- 1 avi  avi  4695982080 Oct 10 20:29 squeeze.iso 
..
..
-rw-r--r-- 1 avi  avi       90624 Nov  5 12:59 Untitled 1.doc 
-rw-r--r-- 1 avi  avi       96206 Nov  5 12:56 Untitled 1.odt 
-rw-r--r-- 1 avi  avi        9405 Nov 12 23:22 Untitled.png

참고: echo “ls -l ”: 이 문자열 echo는 다음 명령(여기에서는 ls -l)입니다. 표준 터미널. 'ls -l'을 필요에 따라 선택한 명령으로 바꿀 수 있습니다.

> : redirects the output

/dev/pts/0: 이는 출력을 찾는 출력 장치 및/또는 파일입니다. 여기서 출력은 터미널에 있습니다.

내 경우에는 당시 tty/dev/pts/0에 있습니다. tty 명령을 실행하여 tty를 확인할 수 있습니다.

avi@localhost:~/Desktop$ tty 

/dev/pts/0

참고: 'at' 명령은 시스템 시계가 지정된 시간과 일치하는 즉시 작업을 실행합니다.

25. du -h –max-깊이=1 명령

아래 명령은 현재 디렉터리 내의 하위 폴더 크기를 사람이 읽을 수 있는 형식으로 출력합니다.

avi@localhost:/home/avi/Desktop# du -h --max-depth=1 

38M	./test 
1.1G	./shivji 
42M	./drupal 
6.9G	./101MSDCF 
16G	.

참고: 위 명령은 시스템 디스크 사용량을 확인하는 데 매우 유용할 수 있습니다.

Linux 명령줄 치트 시트 다운로드

26. expr 명령

'expr' 명령은 그다지 덜 알려진 명령이 아닙니다. 이 명령은 터미널에서 간단한 수학적 계산을 수행하는 데 매우 유용합니다.

avi@localhost:/home/avi/Desktop# expr 2 + 3 
5
avi@localhost:/home/avi/Desktop# expr 6 – 3 
3
avi@localhost:/home/avi/Desktop# expr 12 / 3 
4
avi@localhost:/home/avi/Desktop# expr 2 \* 9 
18

27. 명령을 봐

헷갈릴 경우에는 단말기 자체에서 영어 사전의 단어를 확인하세요. 즉, 철자가 Carrier인지 Carieer인지 약간 헷갈립니다.

avi@localhost:/home/avi/Documents# look car 

Cara 
Cara's 
…
... 
carps 
carpus 
carpus's 
carrel 
carrel's 
carrels 
carriage 
carriage's 
carriages 
carriageway 
carriageway's 
carried 
carrier 
carrier's 
carriers 
carries 
…
... 
caryatids

위 명령은 'car'라는 문자열로 시작하는 사전의 모든 단어를 보여줍니다. 내가 찾고 있던 것을 얻었습니다.

28. 예 명령

정기적으로 자주 사용되지는 않지만 일반적으로 스크립팅 언어 및 시스템 관리자에게 매우 유용한 또 다른 명령입니다.

이 명령은 사용자가 인터럽트 명령을 내릴 때까지 주어진 문자열을 계속해서 인쇄합니다.

avi@localhost:~/Desktop$ yes "Tecmint is one of the best site dedicated to Linux, how to" 

Tecmint is one of the best site dedicated to Linux, how to 
Tecmint is one of the best site dedicated to Linux, how to 
Tecmint is one of the best site dedicated to Linux, how to 
Tecmint is one of the best site dedicated to Linux, how to 
…
…
...
Tecmint is one of the best site dedicated to Linux, how to 
Tecmint is one of the best site dedicated to Linux, how to 
Tecmint is one of the best site dedicated to Linux, how to

29. 인자 명령

요인 명령은 실제로 수학적 기원의 명령입니다. 이 명령은 주어진 숫자의 모든 요소를 출력합니다.

avi@localhost:~/Desktop$ factor 22 
22: 2 11
avi@localhost:~/Desktop$ factor 21 
21: 3 7
avi@localhost:~/Desktop$ factor 11 
11: 11

30. 핑 -i 60 -a IP_주소

우리 모두는 ping 명령을 사용하여 서버가 활성화되어 있는지 확인합니다. 그리고 저는 보통 인터넷에 연결되어 있는지 확인하기 위해 Google에 핑을 보냅니다.

ping 명령에 대한 응답을 받기 위해 터미널을 계속 지켜보거나 서버가 연결될 때까지 기다리는 것은 때때로 짜증스럽습니다.

서버가 활성화되자마자 들리는 소리는 어떻습니까?

avi@localhost:~/Desktop$ ping -i 60 -a www.google.com 

PING www.google.com (74.125.200.103) 56(84) bytes of data. 
64 bytes from www.google.com (74.125.200.103): icmp_req=1 ttl=44 time=105 ms 
64 bytes from 74.125.200.103: icmp_req=2 ttl=44 time=281 ms

명령이 가청 소리를 반환하지 않았다고 보고하기 전에 한 가지 말씀드리겠습니다. 시스템 오디오가 음소거되어 있지 않은지 확인하고 '사운드 환경설정'에서 사운드 테마를 활성화해야 하며 '창 및 창 사운드 활성화'가 선택되어 있는지 확인하세요.

31. tac 명령

이 명령은 텍스트 파일의 내용을 역순으로 즉, 마지막 줄에서 첫 번째 줄로 인쇄하는 매우 흥미로운 명령입니다.

내 문서 디렉터리의 홈 폴더 아래에 텍스트 파일 35.txt가 있습니다. cat 명령을 사용하여 내용을 확인합니다.

avi@localhost:~/Documents$ cat 35.txt
샘플 출력
1. Linux is built with certain powerful tools, which are unavailable in windows. 

2. One of such important tool is Shell Scripting. Windows however comes with such a tool but as usual it is much weak as compared to it's Linux Counterpart. 

3.Shell scripting/programming makes it possible to execute command(s), piped to get desired output in order to automate day-to-day usages.

이제 tac 명령을 사용하여 파일 내용을 반전시킵니다.

avi@localhost:~/Documents$ tac 35.txt
샘플 출력
3.Shell scripting/programming makes it possible to execute command(s), piped to get desired output in order to automate day-to-day usages. 

2. One of such important tool is Shell Scripting. Windows however comes with such a tool but as usual it is much weak as compared to it's Linux Counterpart. 

1. Linux is built with certain powerful tools, which are unavailable in windows.

지금은 여기까지입니다. 덜 알려진 다른 Linux 명령에 대해 알고 계시다면 댓글을 달아 향후 기사에 포함시킬 수 있습니다.

소중한 의견을 보내주시는 것을 잊지 마세요. 조만간 또 다른 흥미로운 기사로 찾아오겠습니다. 그때까지 Tecmint에 계속 관심을 갖고 연결해 주세요.