Linux 전문가를 위한 20가지 고급 명령
이 기사의 처음 두 부분에서 우리에게 주신 좋아요, 좋은 말, 지원에 감사드립니다. 첫 번째 기사에서는 방금 Linux로 전환했고 시작하는 데 필요한 지식이 필요한 사용자를 위한 명령에 대해 논의했습니다.
- 리눅스 초보자를 위한 20가지 유용한 명령
두 번째 기사에서는 중간 수준 사용자가 자신의 시스템을 관리하는 데 필요한 명령에 대해 논의했습니다.
- 중급 Linux 사용자를 위한 20가지 고급 명령
다음은 무엇입니까? 이 문서에서는 Linux 서버를 관리하는 데 필요한 명령에 대해 설명합니다.
41. 명령: ifconfig
ifconfig는 커널 상주 네트워크 인터페이스를 구성하는 데 사용됩니다. 필요에 따라 인터페이스를 설정하기 위해 부팅 시 사용됩니다. 그 이후에는 일반적으로 디버깅할 때나 시스템 조정이 필요할 때만 필요합니다.
활성 네트워크 인터페이스 확인
[avishek@tecmint ~]$ ifconfig
eth0 Link encap:Ethernet HWaddr 40:2C:F4:EA:CF:0E
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::422c:f4ff:feea:cf0e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:163843 errors:0 dropped:0 overruns:0 frame:0
TX packets:124990 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:154389832 (147.2 MiB) TX bytes:65085817 (62.0 MiB)
Interrupt:20 Memory:f7100000-f7120000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:78 errors:0 dropped:0 overruns:0 frame:0
TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4186 (4.0 KiB) TX bytes:4186 (4.0 KiB)
모든 네트워크 인터페이스 확인
"-a" 인수를 사용하여 비활성화된 인터페이스를 포함한 모든 인터페이스의 세부 정보를 표시합니다.
[avishek@tecmint ~]$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 40:2C:F4:EA:CF:0E
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::422c:f4ff:feea:cf0e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:163843 errors:0 dropped:0 overruns:0 frame:0
TX packets:124990 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:154389832 (147.2 MiB) TX bytes:65085817 (62.0 MiB)
Interrupt:20 Memory:f7100000-f7120000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:78 errors:0 dropped:0 overruns:0 frame:0
TX packets:78 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4186 (4.0 KiB) TX bytes:4186 (4.0 KiB)
virbr0 Link encap:Ethernet HWaddr 0e:30:a3:3a:bf:03
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
인터페이스 비활성화
[avishek@tecmint ~]$ ifconfig eth0 down
인터페이스 활성화
[avishek@tecmint ~]$ ifconfig eth0 up
인터페이스에 IP 주소 할당
인터페이스 eth0의 IP 주소로 "192.168.1.12"를 할당합니다.
[avishek@tecmint ~]$ ifconfig eth0 192.168.1.12
인터페이스 eth0의 서브넷 마스크 변경
[avishek@tecmint ~]$ ifconfig eth0 netmask 255.255.255.
인터페이스 eth0의 브로드캐스트 주소 변경
[avishek@tecmint ~]$ ifconfig eth0 broadcast 192.168.1.255
인터페이스 eth0에 IP 주소, 넷마스크 및 브로드캐스트 할당
[avishek@tecmint ~]$ ifconfig eth0 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255
참고: 무선 네트워크를 사용하는 경우 "iwconfig" 명령을 사용해야 합니다. 더 많은 “ifconfig” 명령 예제와 사용법을 보려면 15가지 유용한 “ifconfig ” 명령을 읽어보세요.
42. 명령: netstat
netstat 명령은 네트워크 연결, 라우팅 테이블, 인터페이스 통계, 가장 무도회 연결, 멀티캐스트 멤버십 등과 같은 다양한 네트워크 관련 정보를 표시합니다.
모든 네트워크 포트 나열
[avishek@tecmint ~]$ netstat -a
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 741379 /run/user/user1/keyring-I5cn1c/gpg
unix 2 [ ACC ] STREAM LISTENING 8965 /var/run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 18584 /tmp/.X11-unix/X0
unix 2 [ ACC ] STREAM LISTENING 741385 /run/user/user1/keyring-I5cn1c/ssh
unix 2 [ ACC ] STREAM LISTENING 741387 /run/user/user1/keyring-I5cn1c/pkcs11
unix 2 [ ACC ] STREAM LISTENING 20242 @/tmp/dbus-ghtTjuPN46
unix 2 [ ACC ] STREAM LISTENING 13332 /var/run/samba/winbindd_privileged/pipe
unix 2 [ ACC ] STREAM LISTENING 13331 /tmp/.winbindd/pipe
unix 2 [ ACC ] STREAM LISTENING 11030 /var/run/mysqld/mysqld.sock
unix 2 [ ACC ] STREAM LISTENING 19308 /tmp/ssh-qnZadSgJAbqd/agent.3221
unix 2 [ ACC ] STREAM LISTENING 436781 /tmp/HotShots
unix 2 [ ACC ] STREAM LISTENING 46110 /run/user/ravisaive/pulse/native
unix 2 [ ACC ] STREAM LISTENING 19310 /tmp/gpg-zfE9YT/S.gpg-agent
....
모든 TCP 포트 나열
[avishek@tecmint ~]$ netstat -at
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:mysql *:* LISTEN
tcp 0 0 *:5901 *:* LISTEN
tcp 0 0 *:5902 *:* LISTEN
tcp 0 0 *:x11-1 *:* LISTEN
tcp 0 0 *:x11-2 *:* LISTEN
tcp 0 0 *:5938 *:* LISTEN
tcp 0 0 localhost:5940 *:* LISTEN
tcp 0 0 ravisaive-OptiPl:domain *:* LISTEN
tcp 0 0 ravisaive-OptiPl:domain *:* LISTEN
tcp 0 0 localhost:ipp *:* LISTEN
tcp 0 0 ravisaive-OptiPle:48270 ec2-23-21-236-70.c:http ESTABLISHED
tcp 0 0 ravisaive-OptiPle:48272 ec2-23-21-236-70.c:http TIME_WAIT
tcp 0 0 ravisaive-OptiPle:48421 bom03s01-in-f22.1:https ESTABLISHED
tcp 0 0 ravisaive-OptiPle:48269 ec2-23-21-236-70.c:http ESTABLISHED
tcp 0 0 ravisaive-OptiPle:39084 channel-ecmp-06-f:https ESTABLISHED
...
모든 포트에 대한 통계 표시
[avishek@tecmint ~]$ netstat -s
Ip:
4994239 total packets received
0 forwarded
0 incoming packets discarded
4165741 incoming packets delivered
3248924 requests sent out
8 outgoing packets dropped
Icmp:
29460 ICMP messages received
566 input ICMP message failed.
ICMP input histogram:
destination unreachable: 98
redirects: 29362
2918 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
destination unreachable: 2918
IcmpMsg:
InType3: 98
InType5: 29362
OutType3: 2918
Tcp:
94533 active connections openings
23 passive connection openings
5870 failed connection attempts
7194 connection resets received
....
좋아요! 어떤 이유로 호스트, 포트 및 사용자 이름을 netstat의 출력으로 확인하지 않으려는 경우.
[avishek@tecmint ~]$ netstat -an
좋습니다. 인터럽트 명령이 전달될 때까지 계속해서 netstat의 출력을 가져와야 할 수도 있습니다(ctrl+c).
[avishek@tecmint ~]$ netstat -c
더 많은 "netstat" 명령 예제 및 사용법은 20 Netstat 명령 예제 문서를 참조하세요.
43. 명령: nslookup
인터넷 서버에 대한 정보를 얻는 데 사용되는 네트워크 유틸리티 프로그램입니다. 이름에서 알 수 있듯이 이 유틸리티는 DNS를 쿼리하여 도메인에 대한 이름 서버 정보를 찾습니다.
[avishek@tecmint ~]$ nslookup linux-console.net
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: linux-console.net
Address: 50.16.67.239
메일 교환기 레코드 쿼리
[avishek@tecmint ~]$ nslookup -query=mx linux-console.net
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
linux-console.net mail exchanger = 0 smtp.secureserver.net.
linux-console.net mail exchanger = 10 mailstore1.secureserver.net.
Authoritative answers can be found from:
쿼리 네임서버
[avishek@tecmint ~]$ nslookup -type=ns linux-console.net
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
linux-console.net nameserver = ns3404.com.
linux-console.net nameserver = ns3403.com.
Authoritative answers can be found from:
DNS 레코드 쿼리
[avishek@tecmint ~]$ nslookup -type=any linux-console.net
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
linux-console.net mail exchanger = 10 mailstore1.secureserver.net.
linux-console.net mail exchanger = 0 smtp.secureserver.net.
linux-console.net nameserver = ns06.domaincontrol.com.
linux-console.net nameserver = ns3404.com.
linux-console.net nameserver = ns3403.com.
linux-console.net nameserver = ns05.domaincontrol.com.
Authoritative answers can be found from:
권한 시작 쿼리
[avishek@tecmint ~]$ nslookup -type=soa linux-console.net
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
linux-console.net
origin = ns3403.hostgator.com
mail addr = dnsadmin.gator1702.hostgator.com
serial = 2012081102
refresh = 86400
retry = 7200
expire = 3600000
minimum = 86400
Authoritative answers can be found from:
쿼리 포트 번호
연결하려는 포트 번호를 변경하세요.
[avishek@tecmint ~]$ nslookup -port 56 linux-console.net
Server: linux-console.net
Address: 50.16.76.239#53
Name: 56
Address: 14.13.253.12
추가 읽기: 8개의 Nslookup 명령
44. 명령: 파다
dig는 호스트 주소, 메일 교환, 네임서버 및 관련 정보에 대한 정보를 찾기 위해 DNS 네임서버를 쿼리하는 도구입니다. 이 도구는 모든 Linux(Unix) 또는 Macintosh OS X 운영 체제에서 사용할 수 있습니다. dig의 가장 일반적인 용도는 단일 호스트를 쿼리하는 것입니다.
[avishek@tecmint ~]$ dig linux-console.net
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<
주석 줄 끄기
[avishek@tecmint ~]$ dig linux-console.net +nocomments
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +nocomments
;; global options: +cmd
;linux-console.net. IN A
linux-console.net. 14400 IN A 40.216.66.239
;; Query time: 418 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Sat Jun 29 13:53:22 2013
;; MSG SIZE rcvd: 45
권한 섹션 끄기
[avishek@tecmint ~]$ dig linux-console.net +noauthority
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +noauthority
;; global options: +cmd
;; Got answer:
;; ->>HEADER<
추가 섹션 끄기
[avishek@tecmint ~]$ dig linux-console.net +noadditional
; <<>> DiG 9.9.2-P1 <<>> linux-console.net +noadditional
;; global options: +cmd
;; Got answer:
;; ->>HEADER<
통계 섹션 끄기
[avishek@tecmint ~]$ dig linux-console.net +nostats
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +nostats
;; global options: +cmd
;; Got answer:
;; ->>HEADER<
답변 섹션 끄기
[avishek@tecmint ~]$ dig linux-console.net +noanswer
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +noanswer
;; global options: +cmd
;; Got answer:
;; ->>HEADER<
모든 섹션을 한 번에 비활성화
[avishek@tecmint ~]$ dig linux-console.net +noall
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> linux-console.net +noall
;; global options: +cmd
추가 읽기: Linux Dig 명령 예 10개
45. 명령: 가동 시간
방금 Linux 서버 시스템에 연결했는데 이상하거나 악의적인 것을 발견했습니다. 어떻게 하시겠습니까? 추측하다… 아니요, 서버가 무인 상태일 때 실제로 무슨 일이 일어났는지 확인하기 위해 uptime을 실행할 수는 없습니다.
[avishek@tecmint ~]$ uptime
14:37:10 up 4:21, 2 users, load average: 0.00, 0.00, 0.04
46. 명령: 벽
관리자에게 가장 중요한 명령 중 하나인 wall은 mesg 권한이 "yes"로 설정된 로그인된 모든 사람에게 메시지를 보냅니다. 메시지는 wall에 대한 인수로 제공되거나 wall의 표준 입력으로 전송될 수 있습니다.
[avishek@tecmint ~]$ wall "we will be going down for maintenance for one hour sharply at 03:30 pm"
Broadcast message from [email (pts/0) (Sat Jun 29 14:44:02 2013):
we will be going down for maintenance for one hour sharply at 03:30 pm
47. 명령: 메시지
사람들이 "write" 명령을 사용하여 화면을 통해 텍스트를 보낼 수 있는지 제어할 수 있습니다.
mesg [n|y]
n - prevents the message from others popping up on the screen.
y – Allows messages to appear on your screen.
48. 명령: 쓰다
'mesg'가 'y'인 경우 다른 Linux 시스템의 화면으로 직접 텍스트를 보낼 수 있습니다.
[avishek@tecmint ~]$ write ravisaive
49. 명령: 말하다
write 명령이 향상된 talk 명령을 사용하면 로그인한 사용자와 대화할 수 있습니다.
[avishek@tecmint ~]$ talk ravisaive
참고: talk 명령이 설치되지 않은 경우 언제든지 필요한 패키지를 apt 또는 yum할 수 있습니다.
[avishek@tecmint ~]$ yum install talk
OR
[avishek@tecmint ~]$ apt-get install talk
50. 명령: w
어떤 'w' 명령이 재미있어 보이나요? 그러나 실제로는 그렇지 않습니다. 단 한 글자라도 명령입니다! "w" 명령은 uptime과 who 명령이 순서대로 바로 다음에 주어지는 조합입니다.
[avishek@tecmint ~]$ w
15:05:42 up 4:49, 3 users, load average: 0.02, 0.01, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
server tty7 :0 14:06 4:43m 1:42 0.08s pam: gdm-passwo
server pts/0 :0.0 14:18 0.00s 0.23s 1.65s gnome-terminal
server pts/1 :0.0 14:47 4:43 0.01s 0.01s bash
51. 명령: 이름 바꾸기
이름에서 알 수 있듯이 이 명령은 파일 이름을 바꿉니다. rename은 파일 이름에서 첫 번째 항목을 대체하여 지정된 파일의 이름을 바꿉니다.
Give the file names a1, a2, a3, a4.....1213
명령을 입력하면 됩니다.
rename a1 a0 a?
rename a1 a0 a??
52. 명령: 상단
CPU의 프로세스를 표시합니다. 이 명령은 기본적으로 자동으로 새로 고쳐지고 인터럽트 명령이 제공되지 않는 한 CPU 프로세스를 계속 표시합니다.
[avishek@tecmint ~]$ top
top - 14:06:45 up 10 days, 20:57, 2 users, load average: 0.10, 0.16, 0.21
Tasks: 240 total, 1 running, 235 sleeping, 0 stopped, 4 zombie
%Cpu(s): 2.0 us, 0.5 sy, 0.0 ni, 97.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 2028240 total, 1777848 used, 250392 free, 81804 buffers
KiB Swap: 3905532 total, 156748 used, 3748784 free, 381456 cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23768 ravisaiv 20 0 1428m 571m 41m S 2.3 28.9 14:27.52 firefox
24182 ravisaiv 20 0 511m 132m 25m S 1.7 6.7 2:45.94 plugin-containe
26929 ravisaiv 20 0 5344 1432 972 R 0.7 0.1 0:00.07 top
24875 ravisaiv 20 0 263m 14m 10m S 0.3 0.7 0:02.76 lxterminal
1 root 20 0 3896 1928 1228 S 0.0 0.1 0:01.62 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.06 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:17.28 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
7 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0H
8 root rt 0 0 0 0 S 0.0 0.0 0:00.12 migration/0
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
10 root 20 0 0 0 0 S 0.0 0.0 0:26.94 rcu_sched
11 root rt 0 0 0 0 S 0.0 0.0 0:01.95 watchdog/0
12 root rt 0 0 0 0 S 0.0 0.0 0:02.00 watchdog/1
13 root 20 0 0 0 0 S 0.0 0.0 0:17.80 ksoftirqd/1
14 root rt 0 0 0 0 S 0.0 0.0 0:00.12 migration/1
16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H
17 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 cpuset
18 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper
19 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
21 root 20 0 0 0 0 S 0.0 0.0 0:00.04 bdi-default
22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd
23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kblockd
24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 ata_sff
추가 읽기: 12 TOP 명령 예
53. 명령: mkfs.ext4
이 명령은 지정된 장치에 새로운 ext4 파일 시스템을 생성합니다. 이 명령 다음에 잘못된 장치를 사용하면 전체 블록이 지워지고 포맷됩니다. 따라서 전까지는 이 명령을 실행하지 않는 것이 좋습니다. 당신은 당신이하고있는 일을 이해합니다.
Mkfs.ext4 /dev/sda1 (sda1 block will be formatted)
mkfs.ext4 /dev/sdb1 (sdb1 block will be formatted)
자세히 알아보기: Ext4란 무엇이며 생성 및 변환 방법
54. 명령: vi/emacs/nano
vi(시각적), emacs, nano는 Linux에서 가장 일반적으로 사용되는 편집기 중 일부입니다. 텍스트, 구성,… 파일을 편집하는 데 자주 사용됩니다. vi 및 nano 문제를 해결하는 빠른 가이드는 emacs입니다.
vi-편집기
[avishek@tecmint ~]$ touch a.txt (creates a text file a.txt)
[avishek@tecmint ~]$ vi a.txt (open a.txt with vi editor)
echo "Hello" (your text here for the file)
- alt+x(삽입 모드를 종료합니다. 마지막 문자 사이에 약간의 공백을 유지해야 합니다.
- ctrl+x 명령을 사용하지 않으면 마지막 단어가 삭제됩니다).
- :wq! (현재 텍스트로 파일을 저장합니다. '!'는 재정의된다는 점을 기억하세요.)
나노 에디터
[avishek@tecmint ~]$ nano a.txt (open a.txt file to be edited with nano)
edit, with the content, required
Ctrl +x(편집기 닫기) 다음과 같이 출력이 표시됩니다.
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
Y Yes
N No ^C Cancel
'y'를 클릭하여 '예'를 선택하고 파일 이름을 입력하면 완료됩니다.
55. 명령: rsync
Rsync는 파일을 복사하며 진행률 표시줄에 -P 스위치가 있습니다. 따라서 rsync가 설치되어 있으면 간단한 별칭을 사용할 수 있습니다.
alias cp='rsync -aP'
이제 터미널에서 대용량 파일을 복사하고 진행률 표시줄과 비슷하게 남은 항목이 포함된 출력을 확인해보세요.
더욱이, 백업을 유지하고 유지하는 것은 시스템 관리자가 수행해야 하는 가장 중요하고 지루한 작업 중 하나입니다. Rsync는 터미널에서 백업을 생성하고 유지 관리하는 데 매우 유용한 도구입니다(다른 여러 도구도 있음).
[avishek@tecmint ~]$ rsync -zvr IMG_5267\ copy\=33\ copy\=ok.jpg ~/Desktop/
sending incremental file list
IMG_5267 copy=33 copy=ok.jpg
sent 2883830 bytes received 31 bytes 5767722.00 bytes/sec
total size is 2882771 speedup is 1.00
참고: 압축의 경우 -z, 자세한 내용의 경우 -v, 재귀의 경우 -r입니다.
56. 명령: 무료
메모리와 리소스를 추적하는 것은 관리자가 수행하는 다른 작업만큼 중요하며 'free' 명령이 여기서 구출됩니다.
메모리 사용현황
[avishek@tecmint ~]$ free
total used free shared buffers cached
Mem: 2028240 1788272 239968 0 69468 363716
-/+ buffers/cache: 1355088 673152
Swap: 3905532 157076 3748456
KB, MB, GB 단위의 튜닝된 출력
[avishek@tecmint ~]$ free -b
total used free shared buffers cached
Mem: 2076917760 1838272512 238645248 0 71348224 372670464
-/+ buffers/cache: 1394253824 682663936
Swap: 3999264768 160845824 3838418944
[avishek@tecmint ~]$ free -k
total used free shared buffers cached
Mem: 2028240 1801484 226756 0 69948 363704
-/+ buffers/cache: 1367832 660408
Swap: 3905532 157076 3748456
[avishek@tecmint ~]$ free -m
total used free shared buffers cached
Mem: 1980 1762 218 0 68 355
-/+ buffers/cache: 1338 641
Swap: 3813 153 3660
[avishek@tecmint ~]$ free -g
total used free shared buffers cached
Mem: 1 1 0 0 0 0
-/+ buffers/cache: 1 0
Swap: 3 0 3
사람이 읽을 수 있는 형식으로 현재 사용량 확인
[avishek@tecmint ~]$ free -h
total used free shared buffers cached
Mem: 1.9G 1.7G 208M 0B 68M 355M
-/+ buffers/cache: 1.3G 632M
Swap: 3.7G 153M 3.6G
정기적으로 상태를 지속적으로 확인
[avishek@tecmint ~]$ free -s 3
total used free shared buffers cached
Mem: 2028240 1824096 204144 0 70708 364180
-/+ buffers/cache: 1389208 639032
Swap: 3905532 157076 3748456
total used free shared buffers cached
Mem: 2028240 1824192 204048 0 70716 364212
-/+ buffers/cache: 1389264 638976
Swap: 3905532 157076 3748456
추가 읽기: 자유 명령의 10가지 예
57. 명령: mysqldump
자, 지금까지는 이 명령의 이름을 통해 이 명령이 실제로 무엇을 의미하는지 이해했을 것입니다.mysqldump 명령은 전체 또는 특정 데이터베이스 데이터를 주어진 파일에 덤프(백업)합니다. 예를 들어,
[avishek@tecmint ~]$ mysqldump -u root -p --all-databases > /home/server/Desktop/backupfile.sql
참고: mysqldump를 사용하려면 mysql이 실행되고 승인을 위한 올바른 비밀번호가 필요합니다. 우리는 mysqldump 명령을 사용한 데이터베이스 백업에서 몇 가지 유용한 “mysqldump” 명령을 다뤘습니다.
58. 명령: mkpasswd
지정된 길이의 추측하기 어려운 임의의 비밀번호를 만드십시오.
[avishek@tecmint ~]$ mkpasswd -l 10
zI4+Ybqfx9
[avishek@tecmint ~]$ mkpasswd -l 20
w0Pr7aqKk&hmbmqdrlmk
참고: -l 10은 10자의 무작위 비밀번호를 생성하는 반면 -l 20은 자의 비밀번호를 생성합니다. Strong>20, 원하는 결과를 얻기 위해 무엇이든 설정할 수 있습니다. 이 명령은 매우 유용하며 종종 임의의 암호를 생성하기 위해 스크립팅 언어로 구현됩니다. 이 명령을 사용하려면 'expect' 패키지를 yum 또는 apt해야 할 수도 있습니다.
[root@tecmint ~]# yum install expect
OR
[root@tecmint ~]# apt-get install expect
59. 명령: 붙여넣기
다음을 사용하여 두 개 이상의 텍스트 파일을 한 줄에 병합합니다. 예. file1의 내용이 다음과 같은 경우:
1
2
3
and file2 was:
a
b
c
d
the resulting file3 would be:
1 a
2 b
3 c
d
60.명령: lsof
lsof는 '열린 파일 나열'을 의미하며 시스템이 현재 열려 있는 모든 파일을 표시합니다. 어떤 프로세스가 특정 파일을 사용하는지 파악하거나 단일 프로세스의 모든 파일을 표시하는 데 매우 유용합니다. 유용한 10개 lsof 명령 예제를 읽어보고 싶을 수도 있습니다.
[avishek@tecmint ~]$ lsof
COMMAND PID TID USER FD TYPE DEVICE SIZE/OFF NODE NAME
init 1 root cwd DIR 8,1 4096 2 /
init 1 root rtd DIR 8,1 4096 2 /
init 1 root txt REG 8,1 227432 395571 /sbin/init
init 1 root mem REG 8,1 47080 263023 /lib/i386-linux-gnu/libnss_files-2.17.so
init 1 root mem REG 8,1 42672 270178 /lib/i386-linux-gnu/libnss_nis-2.17.so
init 1 root mem REG 8,1 87940 270187 /lib/i386-linux-gnu/libnsl-2.17.so
init 1 root mem REG 8,1 30560 263021 /lib/i386-linux-gnu/libnss_compat-2.17.so
init 1 root mem REG 8,1 124637 270176 /lib/i386-linux-gnu/libpthread-2.17.so
init 1 root mem REG 8,1 1770984 266166 /lib/i386-linux-gnu/libc-2.17.so
init 1 root mem REG 8,1 30696 262824 /lib/i386-linux-gnu/librt-2.17.so
init 1 root mem REG 8,1 34392 262867 /lib/i386-linux-gnu/libjson.so.0.1.0
init 1 root mem REG 8,1 296792 262889 /lib/i386-linux-gnu/libdbus-1.so.3.7.2
init 1 root mem REG 8,1 34168 262840 /lib/i386-linux-gnu/libnih-dbus.so.1.0.0
init 1 root mem REG 8,1 95616 262848 /lib/i386-linux-gnu/libnih.so.1.0.0
init 1 root mem REG 8,1 134376 270186 /lib/i386-linux-gnu/ld-2.17.so
init 1 root 0u CHR 1,3 0t0 1035 /dev/null
init 1 root 1u CHR 1,3 0t0 1035 /dev/null
init 1 root 2u CHR 1,3 0t0 1035 /dev/null
init 1 root 3r FIFO 0,8 0t0 1714 pipe
init 1 root 4w FIFO 0,8 0t0 1714 pipe
init 1 root 5r 0000 0,9 0 6245 anon_inode
init 1 root 6r 0000 0,9 0 6245 anon_inode
init 1 root 7u unix 0xf5e91f80 0t0 8192 @/com/ubuntu/upstart
init 1 root 8w REG 8,1 3916 394 /var/log/upstart/teamviewerd.log.1 (deleted)
이것이 끝이 아닙니다. 시스템 관리자는 여러분이 작업할 수 있는 멋진 인터페이스를 제공하기 위해 많은 일을 합니다. 시스템 관리는 실제로 매우 완벽한 방법으로 학습하고 구현하는 기술입니다. 우리는 Linux 전문가가 배워야 할 다른 모든 필수 항목을 제공하려고 노력할 것입니다. 실제로 Linux는 기본적으로 학습하고 학습하는 과정입니다. 귀하의 좋은 말은 항상 추구되며, 이는 우리가 귀하에게 지식이 풍부한 기사를 제공하기 위해 더 많은 노력을 기울이도록 격려합니다. “우리가 널리 퍼지는 데 도움이 되도록 좋아요를 누르고 공유하세요 ”.