반응형
Gnome에서 한글 설정

다음과 같이 Korean 한글 설치

영문버전으로 설치 시 한글 설정

한글 폰트 설치
한글 관련 모든 패키지 설치
/etc/sysconfig/i18n 파일 수정
다음과 같이 적용
만약, 이 방법으로 문제 해결이 되지 않는다면 다음 내용 확인

font를 바탕으로 변경

fc-cache를 하지 않아서 font가 리스트에 나오지 않았다. 설정에 나오지 않는다면 이 명령을 실행해야 한다.
언어 설정 후, logout-login 한다.


ref : http://hasunjjang.blogspot.com/2015/04/centos-2013.html


반응형
반응형

리눅스 명령어를 이용한 시스템 모니터링 하기

시스템 성능 측정을 위한 항목에는 CPU, Memory, Disk, Traffic 등이 있습니다.
리눅스 환경에서 이런 리소스들을 확인 할 수 있는 다양한 명령어들을 지원하고 있는데요.
각각의 명령어들을 통해 시스템을 모니터링 하는 방법에 대해 알아봅시다.

uname

시스템과 커널의 정보를 확인할 수 있습니다.
저는 모든 정보를 확인하기 위하여 -a 옵션을 사용하였습니다.

20150903_uname

 

보여지는 순서는
Linux . localhost . 3.13.0-24-generic . #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 . x8664 . x8664 . x86_64 . GNU/Linux
[커널명] [호스트명] [릴리즈정보] [커널버전] [머신하드웨어이름] [프로세서종료] [하드웨어플랫폼] [운영체제]
입니다.

참고 >>
uname --help
-a, --all
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, -kernel-version 커널 버전 출력
-m, --machine 머신 하드웨어 이름 출력
-p, --processor 프로세서 종류 또는 "unknown" 출력
-i,- -hardware-platform 하드웨어 플랫폼 또는 "unknown" 출력
-o, --operating-system 운영 체제 출력

ifconfig

시스템에 설정된 네트워크 인터페이스의 상태를 확인&변경 할 수 있습니다.

20150903_ifconfig

  • Eth0, Eth1 : 흔히 랜카드라고 불리는 유선 네트워크 인터페이스 입니다. 따라서 저는 랜카드가 2개!
  • Lo : 루프백 인터페이스로 자기자신과 통신하는데 사용하는 가상 장치입니다. IP가 127.0.0.1이라고 보이시나요?

IP주소는 서버에 하나씩 부여되는 것이 아니라 네트워크 인터페이스에 할당되기 때문에 각 네트워크 인터페이스마다 다른 IP주소를 가지고 있습니다.

  • HWaddr : 네트워크 인터페이스의 하드웨어 주소(MAC Address)
  • inetaddr : 네트워크 인터페이스에 할당된 IP 주소
  • Bcast : 브로드캐스트 주소
  • Mask : 넷마스크
  • MTU : 네트워크 최대 전송 단위(Maxium Transfer Unit)
  • RX packets : 받은 패킷 정보
  • TX packets: 보낸 패킷 정보
  • collision : 충돌된 패킷 수
  • Interrupt : 네트워크 인터페이스가 사용하는 인터럽트 번호
참고 >>

Ifconfig 명령어로는 private ip밖에 확인되지 않습니다.
공인아이피(Public IP) 확인하는 방법이 있을까요?
Curl을 설치후에 확인해 보세요.

curl ifconfig.me

top

윈도우의 작업관리자와 비슷한 기능을 하는 명령어입니다.
프로세스 작업 명령어로, 시스템 프로세스들의 CPU/Memory 점유율을 실시간으로 볼 수 있습니다.

현재 몇 개의 프로세스가 있는지, CPU의 자세한 사용률은 어떻게 되는지,
Memory와 Swap은 얼마나 사용하고 있는지를 확인할 수 있습니다.

20150903_top

 

CPU
  • us : 사용자가 사용중인 사용률
  • sy : 시스템이 사용중인 사용률
  • ni : 프로세스 우선순위를 기반으로 사용되는 사용률(사용자 공간에서 사용됨)
  • id : 아무일도 하지 않는 여유율
  • wa : 입출력을 기다리는 프로세스 사용률
  • hi : 하드웨어 인터럽트 사용률
  • si : 소프트웨어 인터럽트 사용률
  • st : 가상화 환경에서 손실률

User값이 높다면, 사용자 코드를 수행하는데 시간이 오래 걸린다면 내부적으로 계산을 많이 하고 있다는 것입니다.
System값이 높다면, 시스템에 의해 사용되고 있는 시간이 오래 걸린다면 프로세스들이 시스템 호출 또는 I/O가 많다고 할 수 있습니다.
idle의 값이 항상 0이라면 CPU를 100% 사용하고 있다는 것을 의미합니다. CPU를 계속사용하고 있는 프로세스를 찾아 적절하게 대응 할 필요가 있습니다.

PROCESS
  • PID : 프로세스 ID
  • USER : 프로세스를 실행 시킨 사용자 ID
  • PR : 프로세스의 우선순위
  • NI : NICE 값, 마이너스를 가지는 값이 우선순위가 높음
  • VIRT : 가상 메모리의 사용량(SWAP+RES)
  • RES : 현재 페이지가 상주하고 있는 크기
  • SHR : 가상 메모리 중 사용중인 메모리를 제외한 잔여 가상 메모리
  • S : 프로세스의 상태
  • %CPU : 프로세스가 사용하는 CPU의 사용율
  • %MEM : 프로세스가 사용하는 메모리의 사용율
  • TIME+ : 프로세스가 CPU를 사용한 시간
  • COMMAND : 실행된 명령어
참고 >>

프로세스목록을 원하는 특정 기준에 따라 정렬할 수 있을까요? top 실행화면에서 Shift 키와 영문자를 누르면 프로세스의 정렬 기준을 변경할 수 있습니다.

SHIFT + M 메모리 사용률 정렬 SHIFT + N PID 기준 정렬 SHIFT + P CPU 사용률 정렬 SHIFT + T 실행시간 기준 정렬 SHIFT + R 정렬 기준변경 (오름차순인 경우 내림차순으로, 내림차순인 경우 오름차순으로 변경)

free

메모리에 대한 정보를 확인 할 수 있습니다. 저는 Memory와 Swap에 대한 값의 총 합을 확인 하기 위하여 -t 옵션을 주었습니다.

20150903_free

 

Mem는 실제 메모리를, Swap은 일종의 가상메모리입니다.
Buffers는 일부 프로세스에 의해 발생한 임시 메모리입니다.
Cached는 기존에 실행된 프로그램들이 사용했던 메모리로 실행 중이거나 새로 시작될 프로그램들이 필요할 때 빠르게 재 사용할 수 있는 메모리 영역입니다.

Buffers와 Cached 둘 다 Free영역의 일부이므로 실제로는 2번째 줄에 보이는 364812가 실 여유메모리 즉 사용자가 사용가능한 메모리 입니다.
실제 사용률은 1번째 줄에 보이는 used – (buffers + cached)인 2번째 줄에 보이는 used값 인 것이지요.

참고 >>

옵션을 이용하여 단위 별로 출력하기

free -b # or –bytes show output in bytes free -k # or –kilo show output in kilobytes free -m # or –mega show output in megabytes free -g # or –giga show output in gigabytes

vmstat

시스템 작업, 하드웨어 및 시스템 정보를 확인 할 수 있습니다. 메모리, 페이징, 블록장치의 I/O, CPU상태 등을 볼 수 있습니다.

20150903_vmstat

Procs => 메모리가 읽어야 할 데이터의 수로 5이하가 좋다.

  • r : 현재 실행중인 프로세스의 수
  • b : 인터럽트가 불가능한 sleep 상태에 있는 프로세스의 수 (I/O 처리를 하는 동안 블럭 처리된 프로세스) 만약 b의 수치가 높은 경우라면 CPU가 계속 대기상태로 있다는 의미이므로 디스크I/O를 확인해 볼 필요가 있습니다.

Swap => 메모리가 가득 차 작업을 할 수 없을 때, 대기중인 작업을 넣어 두는 곳.

  • si(swap in) : 사용되고 있는 디스크메모리(스왑공간에 있는 데이터)가 해제되는 양(per sec)
  • so(swap out) : 물리적 메모리가 부족할 경우 디스크로부터 사용되는 메모리 양(per sec) 이 때, swap out이 지속적으로 발생한다면 메모리 부족을 의심 해 볼 수 있습니다. swap out값이 증가하면 메모리가 부족하다는 의미이므로 메모리를 늘려야 할 것 입니다. Swap out값은 0에 가까워야 좋고 초당 10블럭이하가 좋습니다. 그러나 swap필드의 값이 높다고 해도 free 메모리에 여유가 있다면 메모리가 부족한 것은 아니랍니다.

-s 옵션을 주면 메모리 통계 항목들을 확인할 수 있습니다.

20150903_vmstat-s

 

참고 >>

실시간으로 메모리 상태를 확인할 수 있습니다. 방법은? vmstat [delay [count] ]

vmstat 35# 3초 간격으로 모니터링 정보를 5개 출력하고 끝내라.

iostat

평균 CPU부하 와 디스크 I/O의 세부적인 내용을 확인 할 수 있습니다.

20150903_iostat

  • tps : 디바이스에 초당 전송 요청 건수
  • kB_read/s : 디바이스에서 초당 읽은 데이터 블록 단위
  • kB_wrtn/s : 디바이스에서 초당 쓴 데이터 블록 단위
  • kB_read : 디바이스에서 지정한 간격 동안 읽은 블록 수
  • kB_wrtn : 디바이스에서 지정한 간격 동안 쓴 전체 블록 수

더 자세한 정보를 확인하기 위해 -x옵션을 사용할 수 있습니다.

20150903_iostat-x

 

참고 >>

실시간으로 디스크 상태를 확인할 수 있습니다. 방법은? iostat [delay [count] ]

iostat 35# 3초 간격으로 모니터링 정보를 5개 출력하고 끝내라.

netstat

현재 시스템에 연결된 네트워크 상태, 라우팅테이블, 인터페이스 상태 등을 볼 수 있습니다.

20150903_netstat

2개의 영역으로 나누어져 보여집니다.
Active Internet connections : TCP, UDP, raw로 연결 된 목록만 보여집니다.
Active UNIX domain sockets : 도메인소켓으로 연결 된 목록만 보여집니다.

  • -n : 호스트명, 포트명을 lookup하지 않고(도메인으로 보이지 않고) IP, Port번호를 보여준다.
  • -a : 모든 네트워크상태를 보여준다.
  • -t : TCP 프로토콜만 보여준다.
  • -u : UDP 프로토콜만 보여준다.
  • -p : 해당 포트를 사용하는 프로그램과 프로세스ID(PID)를 보여준다.
  • -r : 라우팅 테이블 출력
  • -s : 프로토콜 별(IP, ICMP, TCP, UDP 등)로 통계를 보여준다
  • -c : 연속적으로 상태를 보여준다.
  • -l : 대기중인 소켓 목록을 보여준다.

State

  • 공백 : 연결되어 있지 않음
  • FREE : socket은 존재하지만 할당되어 있지 않다.
  • LISTENING : 연결요청에 대한 응답준비가 되어 있는 상태
  • CONNECTING : 연결이 막 이루어진 상태.
  • DISCONNECTING : 연결해제 되고 있는 상태
  • UNKNOWN : 알 수 없는 연결, 알려지지 않은 연결 상태
  • LISTEN : 연결가능하도록 daemon이 떠있으며 연결이 가능한 상태
  • SYS-SENT : 연결을 요청한 상태.
  • SYN_RECEIVED : 연결요구에 응답 후 확인메세지 대기중인 상태
  • ESTABLISHED : 연결이 완료된 상태
  • FIN-WAIT1 : 소켓이 닫히고 연결이 종료되고 있는 상태
  • FIN-WAIT2 : 로컬이 원격으로부터 연결 종료 요구를 기다리는 상태
  • CLOSE-WAIT : 종료 대기 중
  • CLOSING : 전송된 메세지가 유실되었음
  • TIME-WAIT : 연결종료 후 한동안 유지되어 있음
  • CLOSED : 연결이 완전히 종료
참고 >>

각 옵션들을 어떻게 사용하냐에 따라 다른 정보를 확인 할 수 있는데 유용하게 쓰이는 옵션들 알아 두시면 좋을 것 같습니다.

netstat -r # 서버의 라우팅 테이블 출력 netstat -na --ip # tcp/udp의 세션 목록 표시 netstat -na | grep ESTABLISHED | wc -l # 활성화된 세션수 확인 netstat -nap | grep :80 | grep ESTABLISHED | wc -l # 80포트 동시 접속자수 netstat -nltp # LISTEN 중인 포트 정보 표시

df

현재 디스크의 전체 용량 및 남은 용량을 확인 할 수 있습니다.

20150903_df

참고 >>
df --help -h : 용량을 읽기 쉽게 단위를 계산하여 보여준다. -T : 파일 시스템 종류와 함께 디스크 정보를 보여준다. --total : 전체 용량을 보여준다.

마치며

지금까지 시스템모니터링을 알아볼 수 있는 명령어들을 살펴보았습니다. 간단하게만 살펴보았는데도 명령어와 옵션값들이 많고 필요에 따라 적절한 옵션값을 이용하여 모니터링 하는 것이 쉬워 보이지는 않습니다. 이 때 필요한 것이 Whatap! 아닐까요? 웹&앱 기반 모니터링 툴로써 위에서 확인했던 다양한 성능지표(CPU/Memory/Disk/Traffic/Process/Log/DB까지!)들을 언제 어디서나 손쉽게 확인할 수 있습니다. 시스템에 이상이 생겼을 때 알림을 보내 사용자가 바로 인지할 수 있고 따라서 빠르게 대응 할 수 있습니다. 직관적이며 사용하기 편한 인터페이스로, 시스템 모니터링을 원한다면 Whatap을 사용해 보세요.



ref : http://tech.whatap.io/2015/09/03/linux-monitoring/


반응형
반응형





우분투에서 한글 사용에 대한 과정 정리


우분투에서 한글 사용에 대한 과정을 정리해 보면 이렇습니다.
https://plus.google.com/101028813073033149665/posts/GaVEW9GaTuk

1) 키보드 레이아웃
101/104 한국어 호환 키보드 여야 합니다.

2) 언어 패키지
영어와 한국어 패키지를 기본으로 설치해야 합니다.
language-pack-gnome-ko 와 language-pack-gnome-en

한글 입력만 하고 싶다면 굳이 설치하지 않아도 좋지만
보통 모든 사용 하는 기본 프로그램들이 이 언어 패키지 안에 포함되어 설치되기 때문에,
한글로 번역된 프로그램들을 이용하시고자 한다면
설치하세요( 일반 적인 사용자 들은 기본으로 설치하게 됩니다.)

언어 패키지가 잘못 설치된 경우에는 위의 한국어 영어 패키지만 기본으로 설치하고
필요로 하시는 언어 패키지는 별도로 설치하시면 됩니다.
$ sudo apt purge language-pack-*
$ sudo apt install language-pack-gnome-ko language-pack-gnome-en
$ sudo apt-get autoremove --purge 

기타 자주 쓰이는 프로그램들 중에 별도로 설치되는 언어 패키지들
firefox-locale-ko
thunderbird-locale-ko
libreoffice-l10n-ko

3) 한글 입력기
여러가지 입력기들이 있습니다.
dasom
nabi
ibus-hangul
uim-byeoru
fcitx-hangul
각자 취향에 맞는 입력기를 설치하고 이용하면 됩니다.
각 입력기에 따른 설정 도구들이 있습니다.
그곳에서, 한/영 키나, 한자 키를 지정해서 이용하게 되어 있습니다.
http://bagjunggyu.blogspot.kr/2015/09/1510-ubuntu-1510.html

여러 가지 한글 입력기 설정 방법
http://bagjunggyu.blogspot.kr/2015/04/ubuntu-1504.html  
그리고, 노트북을 이용하시는 분들이나,
혹은 특별한 키를 지정해서 이용하고자 하는 경우에는
'조합 키(Compose Key)'를 지정해서 이용하면 편리합니다.
맥북을 이용하는 경우에는 특히 유용합니다.

4) 입력기 지정 도구
사용할 입력기를 지정해주는 도구입니다.
$ sudo apt install im-config
$ im-config

또는,
이런 일련의 과정을 쉽게 할 수 있도록 도와주는 도구가
우분투의 언어 지원(Language Support)입니다.
$ sudo apt install language-selector-gnome
$ gnome-language-selector

5) 글꼴
혹시 한글이 제대로 나오지 않는 경우에는
글꼴을 설치해보세요
권장하는 기본 글꼴은 nanum 입니다.
$ sudo apt install fonts-nanum

콘솔을 주로 이용하는 사람들에게는
$ sudo apt install fonts-nanum-coding

기타 유명한 한글 글꼴
* fonts-noto-cjk
* fonts-unfonts

fonts-noto-cjk는 중국어와 일본어 글꼴에도 적용됩니다.


ref : http://bagjunggyu.blogspot.com/2016/03/blog-post.html


반응형
반응형


How To Install Node.js on Ubuntu 16.04






Introduction

Node.js is a JavaScript platform for general-purpose programming that allows users to build network applications quickly. By leveraging JavaScript on both the front- and back-end, development can be more consistent and designed within the same system.

In this guide, we'll show you how to get started with Node.js on an Ubuntu 16.04 server.

If you are looking to set up a production Node.js environment, check out this link: How To Set Up a Node.js Application for Production.

Prerequisites

This guide assumes that you are using Ubuntu 16.04. Before you begin, you should have a non-root user account with sudo privileges set up on your system. You can learn how to do this by completing steps 1-4 in the initial server setup for Ubuntu 16.04.

How To Install the Distro-Stable Version for Ubuntu

Ubuntu 16.04 contains a version of Node.js in its default repositories that can be used to easily provide a consistent experience across multiple systems. At the time of writing, the version in the repositories is v4.2.6. This will not be the latest version, but it should be quite stable and sufficient for quick experimentation with the language.

In order to get this version, we just have to use the apt package manager. We should refresh our local package index first, and then install from the repositories:

  • sudo apt-get update
  • sudo apt-get install nodejs

If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. In most cases, you'll also want to also install npm, which is the Node.js package manager. You can do this by typing:

  • sudo apt-get install npm

This will allow you to easily install modules and packages to use with Node.js.

Because of a conflict with another package, the executable from the Ubuntu repositories is called nodejsinstead of node. Keep this in mind as you are running software.

To check which version of Node.js you have installed after these initial steps, type:

  • nodejs -v

Once you have established which version of Node.js you have installed from the Ubuntu repositories, you can decide whether or not you would like to work with different versions, package archives, or version managers. Next, we'll discuss these elements along with more flexible and robust methods of installation.

How To Install Using a PPA

An alternative that can get you a more recent version of Node.js is to add a PPA (personal package archive) maintained by NodeSource. This will have more up-to-date versions of Node.js than the official Ubuntu repositories, and allows you to choose between Node.js v4.x (the older long-term support version, which will be supported until April of 2018), Node.js v6.x (supported until April of 2019), and Node.js v8.x (the current LTS version, supported until December of 2019).

First, you need to install the PPA in order to get access to its contents. Make sure you're in your home directory, and use curl to retrieve the installation script for your preferred version, making sure to replace 8.x with your preferred version string (if different):

  • cd ~
  • curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh

You can inspect the contents of this script with nano (or your preferred text editor):

  • nano nodesource_setup.sh

And run the script under sudo:

  • sudo bash nodesource_setup.sh

The PPA will be added to your configuration and your local package cache will be updated automatically. After running the setup script from nodesource, you can install the Node.js package in the same way you did above:

  • sudo apt-get install nodejs

To check which version of Node.js you have installed after these initial steps, type:

  • nodejs -v
Output
v8.10.0

The nodejs package contains the nodejs binary as well as npm, so you don't need to install npmseparately.

npm uses a configuration file in your home directory to keep track of updates. It will be created the first time you run npm. Execute this command to verify that npm is installed and to create the configuration file:

  • npm -v
Output
5.6.0

In order for some npm packages to work (those that require compiling code from source, for example), you will need to install the build-essential package:

  • sudo apt-get install build-essential

You now have the necessary tools to work with npm packages that require compiling code from source.

How To Install Using NVM

An alternative to installing Node.js through apt is to use a specially designed tool called nvm, which stands for "Node.js version manager". Rather than working at the operating system level, nvm works at the level of an independent directory within your home directory. This means that you can install multiple, self-contained versions of Node.js without affecting the entire system.

Controlling your environment with nvm allows you to access the newest versions of Node.js and retain and manage previous releases. It is a different utility from apt-get, however, and the versions of Node.js that you manage through it are distinct from the distro-stable version of Node.js available from the Ubuntu repositories.

To start off, we'll need to get the software packages from our Ubuntu repositories that will allow us to build source packages. The nvm script will leverage these tools to build the necessary components:

  • sudo apt-get update
  • sudo apt-get install build-essential libssl-dev

Once the prerequisite packages are installed, you can pull down the nvm installation script from the project's GitHub page. The version number may be different, but in general, you can download it with curl:

  • curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh -o install_nvm.sh

And inspect the installation script with nano:

  • nano install_nvm.sh

Run the script with bash:

  • bash install_nvm.sh

It will install the software into a subdirectory of your home directory at ~/.nvm. It will also add the necessary lines to your ~/.profile file to use the file.

To gain access to the nvm functionality, you'll need to log out and log back in again, or you can source the ~/.profile file so that your current session knows about the changes:

  • source ~/.profile

Now that you have nvm installed, you can install isolated Node.js versions.

To find out the versions of Node.js that are available for installation, you can type:

  • nvm ls-remote
Output
... v8.5.0 v8.6.0 v8.7.0 v8.8.0 v8.8.1 v8.9.0 v8.9.1 v8.9.2 v8.9.3 -> v8.9.4 (Latest LTS: Carbon)

As you can see, the newest LTS version at the time of this writing is v8.9.4. You can install that by typing:

  • nvm install 8.9.4

Usually, nvm will switch to use the most recently installed version. You can explicitly tell nvm to use the version we just downloaded by typing:

  • nvm use 8.9.4

When you install Node.js using nvm, the executable is called node. You can see the version currently being used by the shell by typing:

  • node -v
Output
v8.9.4

If you have multiple Node.js versions, you can see what is installed by typing:

  • nvm ls

If you wish to default one of the versions, you can type:

  • nvm alias default 8.9.4

This version will be automatically selected when a new session spawns. You can also reference it by the alias like this:

  • nvm use default

Each version of Node.js will keep track of its own packages and has npm available to manage these.

You can have npm install packages to the Node.js project's ./node_modules directory by using the normal format. For example, for the express module:

  • npm install express

If you'd like to install it globally (making it available to the other projects using the same Node.js version), you can add the -g flag:

  • npm install -g express

This will install the package in:

~/.nvm/node_version/lib/node_modules/package_name

Installing globally will let you run the commands from the command line, but you'll have to link the package into your local sphere to require it from within a program:

  • npm link express

You can learn more about the options available to you with nvm by typing:

  • nvm help

Removing Node.js

You can uninstall Node.js using apt-get or nvm, depending on the version you want to target. To remove the distro-stable version, you will need to work with the apt-get utility at the system level.

To remove the distro-stable version, type the following:

  • sudo apt-get remove nodejs

This command will remove the package and retain the configuration files. These may be of use to you if you intend to install the package again at a later point. If you don’t want to save the configuration files for later use, however, then run the following:

  • sudo apt-get purge nodejs

This will uninstall the package and remove the configuration files associated with it. 
As a final step, you can remove any unused packages that were automatically installed with the removed package:

  • sudo apt-get autoremove

To uninstall a version of Node.js that you have enabled using nvm, first determine whether or not the version you would like to remove is the current active version:

  • nvm current

If the version you are targeting is not the current active version, you can run:

  • nvm uninstall node_version

This command will uninstall the selected version of Node.js.

If the version you would like to remove is the current active version, you must first deactive nvm to enable your changes:

  • nvm deactivate

You can now uninstall the current version using the uninstall command above, which will remove all files associated with the targeted version of Node.js except the cached files that can be used for reinstallment.

Conclusion

As you can see, there are a quite a few ways to get up and running with Node.js on your Ubuntu 16.04 server. Your circumstances will dictate which of the above methods is the best idea for your circumstance. While the packaged version in Ubuntu's repository is the easiest, the nvm method is definitely much more flexible.


ref : https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04


반응형
반응형

How to Install and Configure VNC on Ubuntu 16.04


Introduction

VNC, or "Virtual Network Computing", is a connection system that allows you to use your keyboard and mouse to interact with a graphical desktop environment on a remote server. It makes managing files, software, and settings on a remote server easier for users who are not yet comfortable with the command line.

In this guide, we will be setting up VNC on an Ubuntu 16.04 server and connecting to it securely through an SSH tunnel. The VNC server we will be using is TightVNC, a fast and lightweight remote control package. This choice will ensure that our VNC connection will be smooth and stable even on slower internet connections.

Prerequisites

To complete this tutorial, you'll need:

  • An Ubuntu 16.04 Droplet set up via the Ubuntu 16.04 initial server setup tutorial, which includes having a sudo non-root user. Note that this tutorial can be completed using any size Droplet, but a VNC built on a smaller droplet may have more limits on functionality than a larger one.

  • A local computer with a VNC client installed that supports VNC connections over SSH tunnels. If you are using Windows, you could use TightVNC, RealVNC, or UltraVNC. Mac OS X users can use the built-in Screen Sharing program, or can use a cross-platform app like RealVNC. Linux users can choose from many options: vinagrekrdc, RealVNC, TightVNC, and more.

Step 1 — Installing the Desktop Environment and VNC Server

By default, an Ubuntu 16.04 Droplet does not come with a graphical desktop environment or a VNC server installed, so we'll begin by installing those. Specifically, we will install packages for the latest Xfce desktop environment and the TightVNC package available in the official Ubuntu repository.

On your server, install the Xfce and TightVNC packages.

  • sudo apt-get update
  • sudo apt install xfce4 xfce4-goodies tightvncserver

To complete the VNC server's initial configuration after installation, use the vncserver command to set up a secure password.

  • vncserver

You'll be prompted to enter and verify a password, and also a view-only password. Users who log in with the view-only password will not be able to control the VNC instance with their mouse or keyboard. This is a helpful option if you want to demonstrate something to other people using your VNC server, but isn't necessary.

Running vncserver completes the installation of VNC by creating default configuration files and connection information for our server to use. With these packages installed, you are now ready to configure your VNC server.

Step 2 — Configuring the VNC Server

First, we need to tell our VNC server what commands to perform when it starts up. These commands are located in a configuration file called xstartup in the .vnc folder under your home directory. The startup script was created when you ran the vncserver in the previous step, but we need modify some of the commands for the Xfce desktop.

When VNC is first set up, it launches a default server instance on port 5901. This port is called a display port, and is referred to by VNC as :1. VNC can launch multiple instances on other display ports, like :2:3, etc. When working with VNC servers, remember that :X is a display port that refers to 5900+X.

Because we are going to be changing how the VNC server is configured, we'll need to first stop the VNC server instance that is running on port 5901.

  • vncserver -kill :1

The output should look like this, with a different PID:

Output
Killing Xtightvnc process ID 17648

Before we begin configuring the new xstartup file, let's back up the original.

  • mv ~/.vnc/xstartup ~/.vnc/xstartup.bak

Now create a new xstartup file with nano or your favorite text editor.

  • nano ~/.vnc/xstartup

Paste these commands into the file so that they are performed automatically whenever you start or restart the VNC server, then save and close the file.

~/.vnc/xstartup
#!/bin/bash xrdb $HOME/.Xresources startxfce4 &


위 구문을 수행해야 화면에 폴더들이 제대로 보임


The first command in the file, xrdb $HOME/.Xresources, tells VNC's GUI framework to read the server user's .Xresources file. .Xresources is where a user can make changes to certain settings of the graphical desktop, like terminal colors, cursor themes, and font rendering. The second command simply tells the server to launch Xfce, which is where you will find all of the graphical software that you need to comfortably manage your server.

To ensure that the VNC server will be able to use this new startup file properly, we'll need to grant executable privileges to it.

  • sudo chmod +x ~/.vnc/xstartup

Now, restart the VNC server.

  • vncserver

The server should be started with an output similar to this:

Output
New 'X' desktop is your_server_name.com:1 Starting applications specified in /home/sammy/.vnc/xstartup Log file is /home/sammy/.vnc/liniverse.com:1.log

Step 3 — Testing the VNC Desktop

In this step, we'll test the connectivity of your VNC server.

First, we need to create an SSH connection on your local computer that securely forwards to the localhost connection for VNC. You can do this via the terminal on Linux or OS X with following command. Remember to replace user and server_ip_address with the sudo non-root username and IP address of your server.

  • ssh -L 5901:127.0.0.1:5901 -N -f -l username server_ip_address

If you are using a graphical SSH client, like PuTTY, use server_ip_address as the connection IP, and set localhost:5901 as a new forwarded port in the program's SSH tunnel settings.

Next, you may now use a VNC client to attempt a connection to the VNC server at localhost:5901. You'll be prompted to authenticate. The correct password to use is the one you set in Step 1.

Once you are connected, you should see the default Xfce desktop. It should look something like this:



You can access files in your home directory with the file manager or from the command line, as seen here:

Step 4 — Creating a VNC Service File

Next, we'll set up the VNC server as a systemd service. This will make it possible to start, stop, and restart it as needed, like any other systemd service.

First, create a new unit file called /etc/systemd/system/vncserver@.service using your favorite text editor:

  • sudo nano /etc/systemd/system/vncserver@.service

Copy and paste the following into it. Be sure to change the value of User and the username in the value of PIDFILE to match your username.

/etc/systemd/system/vncserver@.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target
 
[Service]
Type=forking
User=sammy
PAMName=login
PIDFile=/home/sammy/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
 
ExecStop=/usr/bin/vncserver -kill :%i
 
[Install]
WantedBy=multi-user.target


Save and close the file.

Next, make the system aware of the new unit file.

  • sudo systemctl daemon-reload

Enable the unit file.

  • sudo systemctl enable vncserver@1.service

The 1 following the @ sign signifies which display number the service should appear over, in this case the default :1 as was discussed above. 
Stop the current instance of the VNC server if it's still running.

  • vncserver -kill :1

Then start it as you would start any other systemd service.

  • sudo systemctl start vncserver@1

You can verify that it started with this command:

  • sudo systemctl status vncserver@1

If it started correctly, the output should look like this:

Output
vncserver@1.service - TightVNC server on Ubuntu 16.04
   Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2016-04-25 03:21:34 EDT; 6s ago
  Process: 2924 ExecStop=/usr/bin/vncserver -kill :%i (code=exited, status=0/SUCCESS)

...

 systemd[1]: Starting TightVNC server on Ubuntu 16.04...
 systemd[2938]: pam_unix(login:session): session opened for user finid by (uid=0)
 systemd[2949]: pam_unix(login:session): session opened for user finid by (uid=0)
 systemd[1]: Started TightVNC server on Ubuntu 16.04.

Conclusion

You should now have a secured VNC server up and running on your Ubuntu 16.04 server. Now you'll be able to manage your files, software, and settings with an easy-to-use and familiar graphical interface


ref : https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-16-04


반응형
반응형

Unix/Linux 디스크 용량 확인 (df/du)



디스크 용량을 확인하는 명령어들이다. 


  df : 디스크의 남은 용량을 확인 

df -k : 킬로바이트 단위로 현재 남은 용량을 확인

df -m : 메가바이트 단위로 남은 용량을 왁인 

df -h : 보기 좋게 보여줌

df . : 현재 디렉토리가 포함된 파티션의 남은 용량을 확인






  du : 현재 디렉토리에서 서브디렉토리까지의 사용량을 확인 

du -a : 현재 디렉토리의 사용량을 파일단위 출력

du -s : 총 사용량을 확인

du -h : 보기 좋게 바꿔줌 

du -sh * : 한단계 서브디렉토리 기준으로 보여준다. 


* 의 있고 없고의 차이 




http://ra2kstar.tistory.com/135

반응형
반응형

viertualbox 에서 네트웍 설정을 아래처럼 바꿔준 다음





우분투에서 

ip addr show


로 ip 를 알아 볼 수 있고 그 중에서


inet 211.225.40.81/25


이 ip 로  window 쪽 브라우저에서  우분투 nodejs 서버 in virtualbox    로 접속



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
xxxxx@xxxxx-VirtualBox:~$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
 
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:c6:16:1d brd ff:ff:ff:ff:ff:ff
    inet 211.225.40.81/25 brd 211.225.40.127 scope global dynamic noprefixroute enp0s3
       valid_lft 3365sec preferred_lft 3365sec
    inet6 fe80::3eec:9e3b:1fcb:c723/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
 
3: enp0s8: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 08:00:27:20:7c:02 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::918:f04e:bfb8:4621/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
4: enp0s9: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 08:00:27:85:0f:a1 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::8d6f:592b:c08c:f10f/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
 



반응형
반응형


1. 먼저 일반->고급-> 클립보드 공유와 드래그 앤 드롭을 양방향으로 세팅





그다음 저장소->컨트롤러IDE->iso 이미지를 VBoxGuestAdditions.iso 로 변경 해준 다음







파일 창에서 VBox_CAs_5.2.12 를 클릭하면 왼쪽 상단에 '프로그래 실행'  버튼이 보이게 되는데 이것을 눌러 실행한다음






현재 상태 저장하고 난 이후 , 다시 시작하면 복붙이 됨






ref : https://www.youtube.com/watch?v=_0V2AMAcB5s


반응형
반응형




  1. https://code.visualstudio.com/  에서 ubuntu 버전 vs code  설치
  2. sudo dpkg -i code_1.......deb   실행하여 vs code 설치
  3. vnc 를 통해 vs code 실행 또는 
    code  명령어로 터미널에서 실행이 가능



그런데 실행이 안되는 경우 아래 한줄 실행 하면 vs code 가 실행됨




I've installed vscode 1.0 on ubuntu 14.4 LTS. It works fine if I log in locally with unity desktop and type the "code" command in the terminal.

However, when I rdp into the box I have to use xfce4 desktop because xrdp apparently doesn't work with unity, and when I try to launch it from the command line there I get no errors in the terminal but the UI never appears.

I did previously install an older version of vscode and did not uninstall that prior to installing 1.0 in case that could be a factor.

when I type

code --version

it correctly reports 1.0.0

anyone have any ideas to solve this? I really want to be able to work using rdp from my windows 10 machine

UPDATE: this problem seems to only occur using rdp, if I login locally with xfce4 it works as expected just as with unity desktop. My ubuntu box an intel nuc5ppyh with latest bios, I think maybe code is launching on a not visible display output. Previously the box was configured to mirror to an hdmi output at I use this also connected to a tv. I've tried disabling the hdmi output from the bios and messing around with xrandr but still cannot get it working over rdp. I'm not a linux expert but still think it might actually be loading code in a non visible display output but not sure how to troubleshoot the problem



The suggested command from the second link above helps:

sudo sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' /usr/lib/x86_64-linux-gnu/libxcb.so.1
  • This single fix allowed me to run vscode on my AWS instance over xrdp without any other changes. – steviebJul 7 '16 at 20:37


works on my ubuntu 14.04, thanks!! – sunhs May 24 '17 at 6:42

works for me on Ubuntu Server LTS 16 – RandomClown Mar 15 at 22:22



This works fine, I am using Ubuntu 16.04 XRDP:

sudo sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' /usr/lib/x86_64-linux-gnu/libxcb.so.1











ref : https://www.youtube.com/watch?v=uYE0XrM-VZA

ref : https://stackoverflow.com/questions/36694941/visual-studio-code-1-fails-to-launch-on-ubuntu-using-xrdp

반응형
반응형


먼저 vnc 설치




RealVNC 무료버전은 업데이트된지 너무 오래되었고, 더이상 업데이트되지도 않을 것 같아 대체 프로그램을 생각함.

VNC는 현재 난립한 상태로 보이며 종류가 엄청 많다.

대략, UltraVNC, TightVNC, TigerVNC 정도 테스트 해봤고 이중 TigerVNC를 사용하기로 했다.

UltraVNC는 파일전송이 가능해 매력적이었으나, 사용하는데 좀 무겁고 느렸음

아직 모든 VNC는 한글입력에 문제있음. 소스수정을 하면 되나, 그러긴 싫다.



이하 테스트를 위해 이곳저곳을 둘러보며 정리했던 내용


TigerVNC 기능점검: 파일전송, 원격지 copy/paste, 속도, 안정성, 그래픽 민첩성



Virtual Network Computing (VNC) 비교



원문: http://www.dbuggr.com/milly/vnc-viewer-comparison-tightvnc-ultravnc-realvnc/


RealVNC: http://www.realvnc.com - free버전만 무료

최초개발자가 작성하여 시장에서 가장 오래 사용됨.

무료버전은 다른 무료VNC에 비해 기능이 떨어지고, 개발이 더이상 진행되는것 같지 않음

상용화의 목적이 강해 대략 좋지 않음



TightVNC: http://www.tightvnc.com - 완전 무료

서버-클라이언트간 VNC 압축 방식을 개선

RealVNC의 대안으로 좋으나, 그래픽과 성능이 가끔 병맛이 됨

로컬-원격지간 복사/붙여넣기를 지원

개발이 활발함



UltraVNC: http://www.uvnc.com - 완전 무료

기존 VNC에 파일전송, 채팅 기능을 추가

위의 2 VNC보다 빠르며, 향상된 그래픽을 제공하고 파일전송과 채팅을 지원함

로컬-원격지간 복사/붙여넣기를 지원



TigerVNC: http://tigervnc.org - 위 3개를 아우르는 차세대(?) VNC



tigervnc > realvnc > tightvnc > ultravnc > turbovnc(?) > winvnc


realvnc: 속도

tightvnc, ultravnc: 파일전송, 로컬-원격지간 복사/붙여넣기 지원



기타

tigervnc: realvnc의 변종으로, tightVNC의 기능중 많은 부분을 흡수

turbovnc

winvnc









먼저 크롬때문에 apt-get install 이 아래 에러와 함께  설치가 안된다면 

google-chrome-stable : Depends: libappindicator1 but it is not going to be installed

sudo apt-get update

sudo apt-get -f install







First install autocutsel.

Now, you need to modify the file ~/.vnc/xstartup.

Add the following lines to it:

1
2
export XKL_XMODMAP_DISABLE=1
autocutsel -fork

The file finally looks like this:

1
2
3
4
5
6
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
autocutsel -fork
/etc/X11/Xsession

You may need to install autocutsel



First install autocutsel (sudo apt-get install autocutsel)

Then open your /home/pi/.vnc/xstartup (nano /home/pi/.vnc/xstartup) and put autocutsel -forkon it like this:

1
2
3
4
5
6
7
8
9
10
#!/bin/sh
 
xrdb $HOME/.Xresources
xsetroot -solid grey
autocutsel -fork
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession


Then it will work after restart of the vnc server

To Stop VNC Server:

vncserver –kill :1 (pick your display)

To Start VNC Server:

vncserver :1 –geometry 1024x600 –depth 24





autocutsel 다운

*Download

This software is released under the GNU GPL.

*News






ref : https://m.blog.naver.com/PostView.nhn?blogId=myunggyu&logNo=60136003809&proxyReferer=https%3A%2F%2Fwww.google.co.kr%2F

ref: https://askubuntu.com/questions/787725/ubuntu-16-google-chrome-stable-depends-libappindicator1-but-it-is-not-going

ref : https://blog.droidzone.in/2015/04/11/allow-copy-and-paste-between-tightvnc-server-and-client/

ref : https://www.nongnu.org/autocutsel/



반응형
반응형

[리눅스] Linux, 현재 디렉토리를 터미널에서 열기: nautilus-open-terminal


때때로, 노틸러스를 이용해 디렉토리를 탐색하다가 그 디렉토리에서 특정 터미널 작업을 하고 싶을 때가 있다. 그 때를 위해서 깔면 좋은 프로그램을 소개한다.


$ sudo apt-get install nautilus-open-terminal


설치 후 활성화를 위해 로그아웃하고 다시 로그인 한다.


원하는 디렉토리에 가서 마우스 오른쪽 버튼을 누르면 '터미널에서 열기'라는 새로운 메뉴가 뜨는 걸 볼 수 있다. 클릭하면 그 디렉토리 상태에서 터미널을 열어준다.






덧붙여: 


앗, 근데 반대로 터미널에서 작업하다가 노틸러스 탐색기를 갑자기 열고 싶을 때는?


생각해보면 당연히 쉽게 할 수 있다.


$ nautilus .& 





간단한 자료이지만 자주 잊어버려서 적어둔다. find로 검색하는 간단한 방법.



1. 현재 디렉토리 + 하위 디렉토리


$ find -name '*.abc'



2. 전체 시스템에서 찾기


$ find / -name '*.abc'



3. abc라는 이름이 들어가는 디렉토리 찾기


$ find / -name 'abc*' -type d




ref : http://yongsop.tistory.com/67
ref: http://yongsop.tistory.com/entry/Linux-리눅스-find-명령어-사용법

반응형
반응형

PS 명령어의 상세설명

1.
기능
http://www.linuxone.co.kr/images/0.gif
유닉스는 동시에 여러 개의 프로세서가 동작되기 때문에 사용자가 그것들의 목록과 
상태를 점검할 필요가 있다
ps
라는 이름은 processor status를 의미한다. ps를 사용하여 프로세서들의 상태를 
점검할 수 있다.


2. 
문법 
http://www.linuxone.co.kr/images/0.gif
# ps [ 
옵션 ]


3. 
옵션
http://www.linuxone.co.kr/images/0.gif
-l : 
자세한 형태의 정보를 출력한다
-u : 
각 프로세서의 사용자 이름과 시작 시간을 보여준다
-j : 
작업 중심 형태로 출력한다.
-s : 
시그널 중심 형태로 출력한다.
-v : 
가상 메모리 중심 형태로 출력한다.
-m : 
메모리 정보를 출력한다
-a : 
다른 사용자들의 프로세서도 보여준다.
-x : 
로그인 상태에 있는 동안 아직 완료되지 않은 프로세서들을 보여준다
유닉스 시스템은 사용자가 로그아웃하고 난 후에도 임의의 프로세서가 계속 동작하게 할 수 있다그러면 그 프로세서는 자신을 실행시킨 셸이 없이도 계속 자신의 일을 
수행한다이러한 프로세서는 일반적인 ps 명령으로 확인할 수 없다이때 -x 옵션을 
사용하면 자신의 터미널이 없는 프로세서들을 확인할 수 있다
-S : 
차일드(child) CPU 시간과 메모리 페이지 결함(fault) 정보를 추가 한다
-c : 
커널 task_structure로 부터 명령 이름을 보여준다
-e : 
환경을 보여준다
-w : 
(wide) 형태로 출력한다한 행 안에 출력이 잘리지 않는다
-h : 
헤더를 출력하지 않는다
-r : 
현재 실행중인 프로세서를 보여준다.
-n : USER 
 WCHAN 을 위해 수치 출력을 지원한다.


4. 
사용방법 및 정보
http://www.linuxone.co.kr/images/0.gif
기본적으로 ps는 현재 명령이 내려지는 쉘에서 만들어진 프로세서들의 목록만을 
보여준다
ps
는 자신이 실행되는 당시현재의 쉘에 의해서 수행된 프로세서들을 검사하고 
보고한다는 점을 생각하자
그러면 ps의 출력결과 리스트에 ps 자신이 있는 이유를 쉽게 이해할 수 있을 것이다
각 필드의 의미는 다음과 같다
http://www.linuxone.co.kr/images/0.gif

COMMAND : 
명령어의 이름 
PID : 
프로세서 ID, 각 프로세서를 구분하기 위한 고유의 ID 
RSS : 
프로세서에 의해 사용되는 실제 메모리의 용량(K byte 단위
USER : 
프로세서를 실행시킨 소유자의 계정을 보여준다
SZ : 
프로세서의 자료와 스텍 크기의 (K byte 단위
TIME : 
현재까지 사용된 CPU의 시간(,
TT : 
프로세서의 제어 터미널(t3=/dev/tty3) 
%CPU : 
마지막 분동안 프로세서가 사용한 CPU시간의 백분율 
START : 
프로세서가 시작된 시간 
STAT : 
프로세서의 상태

이 중 STAT 필드는 몇 가지의 부호를 사용해서 프로세서의 상태를 표시하고 있다
그것들을 정리해 보면 다음과 같다.

P : 수행 가능/수행 중 
T : 
일시 정지 
D : 
디스크 입출력 대기 같은 인터럽트할 수 없는 대기상태 
S : 20
초 미만의 짧게 잠듦(sleep) 
I : 20
초 이상의 길게 잠듦 
Z : 
좀비(zombi) 프로세서

좀비(zomb) 상태라는 것은 프로세서가 사라질 때 시그널 처리의 문제로 완전히 
소멸되지 못한 상태를 말한다.

대개는 _aux 옵션을 많이 사용한다이 중 필요한 프로세스에 대한 결과만 선택적으로
보고자 한다면 grep 명령을 같이 사용한다

http://www.linuxone.co.kr/images/0.gif

[root@sense ~]# ps  -aux
USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1  3444  564 ?        S    Mar17   0:00 init [5]
root         2  0.0  0.0     0    0 ?        SN   Mar17   0:00 [ksoftirqd/0]
root         3  0.0  0.0     0    0 ?        S<   Mar17   0:00 [events/0] --------------------
lebowski  8632  0.0  0.2  5756 1376 pts/3    S    17:10   0:00 -bash
root      8683  0.0  0.2  5692 1152 pts/3    S    17:10   0:00 su -
root      8684  0.0  0.2  5324 1432 pts/3    S    17:10   0:00 -bash
root      8817  0.0  0.1  3244  776 pts/3    R+   18:11   0:00 ps _aux

 

[root@sense ~]# ps -aux | grep vsftpd
root      2319  0.0  0.1  4912  988 ?        S    Mar17   0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root      8822  0.0  0.1  5544  672 pts/3    R+   18:13   0:00 grep vsftpd




ref : http://lily.mmu.ac.kr/lecture/08sm/Fedora2/7jang/4.htm

반응형
반응형



■ 리눅스 기본 디렉토리 (Reserved Directory)

 

리눅스는 중요한 파일들을 주제별로 분류하여 놓고, 각각의 주제에 맞는 디렉토리를 미리 만들어 거기에 파일들을 넣어 두었습니다. 이것을 미리 만들어진 디렉토리 또는 예약된 디렉토리라고 부릅니다.






디렉토리 구조

* /

– 리눅스 경로의 출발점인 최상위 디렉토리(윈도우의 c드라이브같은 역할)

* /bin

– 일반 사용자들이 사용하는 명령어가 포함 되어있다

– ex) cp,mv,vi,rm….

* /etc

– 시스템 설정 파일이 들어있는 디렉토리

* /home

– 일반 사용자들의 홈 디렉토리가 생성 되는 곳

* /root

– root,시스템 관리자의 홈 디렉토리

* /sbin

– 시스템 운영에 필요한 명령어가 존재하는 디렉토리

– ex) 재부팅, 포맷 등

* /tmp

– 임시파일을 저장하는 디렉토리

– 우리가 공부할때 주로 여기서 이용

* /usr

– 윈도우 programs files 폴더와 유사

* /var

– 시스템 운영할 때 발생되는 로그 (기록) 가 위치한 디렉토리

* 그외에 /opt,/proc,/boot 등은 생략

리눅스 경로 

 

 

절대 경로 : 제일 위부터 순서대로 내려가는 경로   ex) cd /tmp/hello

상대 경로 : 현재 있는 경로에서 위나 하위 디렉토리로 이동 ex)[tmp]#  cd hello   ex) [tmp]# cd ..



ref : http://blog.daum.net/question0921/727

ref : http://javakorean.com/%EB%A6%AC%EB%88%85%EC%8A%A4-%EB%94%94%EB%A0%89%ED%84%B0%EB%A6%AC-%EA%B5%AC%EC%A1%B0

반응형
반응형

접근 권한 변경(chmod)

- chmod 명령: 기존 파일 또는 디렉토리에 대한 접근 권한(파일 모드)을 변경할 때 사용

- 파일 모드의 변경은 파일 소유자나 슈퍼 유저만 가능

- 파일 모드는 기호(문자)나 8진수로 지정


1. chmod 명령 도움말



- 주요 옵션

 옵 션

 설 명

 -R

 하위 디렉토리와 파일의 권한 까지 변경 (동일 권한을 디렉토리와 파일에 지정)


2. 접근 권한을 기호(문자)로 표현

- 문자 표기법은 변경할 사용자(대상), 수행할 명령(연산), 설정할 퍼미션(접근 권한) 세 부분으로 분류됨

- 다른 대상의 속성을 건드리지 않고 한 대상 속성만을 설정할 수 있는 장점을 가짐

- 복수 지정은 콤마(,)를 사용하여 구분

 구 분

 기 호

 설 명

 사용자

(대상)

 u

 user의 약자, 파일이나 디렉토리 소유자를 의미

 g

 그룹 소유자

 o

 others의 약자, 기타 사용자를 의미

 a

 all의 약자, u,g,o의 조합

 

 아무 문자를 사용하지 않으면 all로 추정

 수행할 명령

(연산)

 +

 추가

 -

 제거

 =

 지정, 기존의 속성 값은 사라짐

 설정할 퍼미션

(접근 권한)

 r

 읽기

 w

 쓰기

 x

 실행


- 사용 예시

 표기법

 의 미

 u+x

 소유자에게 실행 권한을 추가

 u-x

 소유자의 실행 권한 제거

 +x

 모든 사용자(소유자, 그룹, 기타사용자)에게 실행 권한 추가

 o-rw

 기타사용자의 읽기, 쓰기 권한 제거

 go=rw

 그룹, 기타사용자에게 읽기, 쓰기 권한 지정, 이전에 실행 권한을 가지고 있다면 제거됨

 u+x,go=rw

 소유자에게 실행권한을 추가하고 그룹, 기타 사용자에게 읽기, 쓰기 권한 지정

 a=rw

 모든 사용자에게 읽기, 쓰기 권한 지정

 g-w 그룹 소유자의 쓰기 권한 제거

 g+w,o-x

 그룹 소유자에게 쓰기 권한 추가, 기타 사용자의 쓰기 권한을 제거


3. 접근 권한을 8진수로 표현

- 원하는 파일의 접근 권한을 설정하기 위해 8진수 표기법을 사용

- 3자리의 8진수로 소유자, 그룹 소유자, 기타 사용자를 위한 파일 모드를 설정할 수 있음

- r(읽기, 4), w(쓰기, 2), x(실행, 1)

- 2진법과 8진법의 파일 모드

 8진법

 2진법

 파일 모드

 0

 000

 ---

 1

 001

 --x

 2

 010

 -w-

 3

 011

 -wx

 4

 100

 r--

 5

 101

 r-x

 6

 110

 rw-

 7

 111

 rwx


4. chmod 사용 예시








소유권 또는 그룹 변경(chown / chgrp)

- 파일이나 디렉토리의 소유주나 그룹을 변경할 때 사용

- 명령을 실행하고 나면 파일에 대한 이전 소유주는 해당 파일에 이 명령을 다시 실행할 수 없음

- 명령어를 사용하기 위해서는 슈퍼유저 권한이 필요함(보안의 특성상 슈퍼유저만 사용)


1. 파일 소유자와 그룹 변경(chown)

1) chown 명령어 도움말


- 주요 옵션

 옵 션

 설 명

 -h

 심볼릭 링크 파일 자체의 소유주나 그룹을 변경

 -R

 하위 디렉토리와 디렉토리 하위의 모든 파일의 소유주를 변경


2) chown 명령어 사용 예시


2. 그룹 소유권 변경(chgrp)

- UNIX의 이전 버전에서는 chown 명령어가 그룹 소유권이 아닌 파일 소유권만 변경할 수 있었음

- chgrp 명령어: 그룹 소유권을 변경하기 위한 독립된 명령어

1) chgrp 명령어 도움말


- 주요 옵션

 옵 션

 설 명

 -h

 심볼릭 링크 파일 자체의 그룹 소유권 변경

 -R

 하위 디렉토리와 디렉토리 하위의 모든 파일의 그룹 소유권 변경


2) chgrp 명령어 사용 예시


접근 권한 마스크(umask)

- chmod 명령: 기존 파일의 접근 권한을 변경할 때 사용, 8진수로 지정하는 접근 권한은 해당 파일이 가져야 할 권한을 명시함

- umask 명령: 앞으로 만들어질 파일에 영향을 미치는 명령, 명령으로 지정한 8진수는 새로 만들어질 파일에서 제거될 권한을 명시


1. 접근 권한 기본 값(파일과 디렉토리 생성시 접근 권한, 단, umask로 지정한 값은 기본값에서 제거)

- 일반(정규) 파일; 666(rw-rw-rw-) - umask로 지정한 값

- 디렉토리: 777(rwxrwxrwx) - umask로 지정한 값


2. umask 값 설정

- 시스템 관리자는 /etc/profile 파일에 umask를 지정하여 시스템 전체 사용자에게 획일적인 umask값을 적용 가능

- 보통 group과 other의 쓰기권한에 제한을 두는 022를 많이 사용


3. umask 명령어 사용 예시





ref : http://eunguru.tistory.com/93

반응형
반응형

셸과 각종 명령어들


셸은 리눅스/유닉스 셸은 텍스트 기반에서 사용자가 원하는 작업을 실행하고 그 명령을 운영체제를 통하여 수행하고 다시 사용자에게 결과를 출력하여 보여준다. bash는 그중 가장 많이 사용하는 셸 중에 하나이다.

bash 셸로 전환

#!/bin/bash


실행한 뒤 현재 디렉터리의 파일들이 잘 변경되었는지 확인하려면 ls -al 명령을 사용해야 한다. 이 명령을 스크립트에 포함하면 한 번 실행에 파일 목록까지 확인할 수 있다.

#!/bin/bash
echo test

를 입력하면 화면에 test 가 출력됨


ls -al 명령어 모습





4 Bash If Statement Examples(If then fi, If then else fi, If elif else fi, Nested if )





if 문 예제


Bash conditional statements perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false. These statements are used to execute different parts of your shell program depending on whether certain conditions are true. The ability to branch makes shell scripts powerful.

In Bash, we have the following conditional statements:

  1. if..then..fi statement (Simple If)
  2. if..then..else..fi statement (If-Else)
  3. if..elif..else..fi statement (Else If ladder)
  4. if..then..else..if..then..fi..fi..(Nested if)

These are similar to the awk if statements we discussed earlier.

1. Bash If..then..fi statement

if [ conditional expression ]
then
	statement1
	statement2
	.
fi

This if statement is also called as simple if statement. If the given conditional expression is true, it enters and executes the statements enclosed between the keywords “then” and “fi”. If the given expression returns zero, then consequent statement list is executed.

if then fi example:

#!/bin/bash
count=100
if [ $count -eq 100 ]
then
  echo "Count is 100"
fi

2. Bash If..then..else..fi statement

If [ conditional expression ]
then
	statement1
	statement2
	.
else
	statement3
	statement4
	.
fi

If the conditional expression is true, it executes the statement1 and 2. If the conditional expression returns zero, it jumps to else part, and executes the statement3 and 4. After the execution of if/else part, execution resume with the consequent statements.

if then else fi example:

#!/bin/bash
count=99
if [ $count -eq 100 ]
then
  echo "Count is 100"
else
  echo "Count is not 100"
fi

Note: This article is part of the ongoing Bash Tutorial series.

3. Bash If..elif..else..fi

If [ conditional expression1 ]
then
	statement1
	statement2
	.
elif [ conditional expression2 ]
then
	statement3
	statement4
	.
.
.
else
	statement5
fi

You can use this if .. elif.. if , if you want to select one of many blocks of code to execute. It checks expression 1, if it is true executes statement 1,2. If expression1 is false, it checks expression2, and if all the expression is false, then it enters into else block and executes the statements in the else block.

if then elif then else fi example:

#!/bin/bash
count=99
if [ $count -eq 100 ]
then
  echo "Count is 100"
elif [ $count -gt 100 ]
then
  echo "Count is greater than 100"
else
  echo "Count is less than 100"
fi

4. Bash If..then..else..if..then..fi..fi..

If [ conditional expression1 ]
then
	statement1
	statement2
	.
else
	if [ conditional expression2 ]
	then
		statement3
		.
	fi
fi

If statement and else statement could be nested in bash. The keyword “fi” indicates the end of the inner if statement and all if statement should end with the keyword “fi”.

The “if then elif then else fi” example mentioned in above can be converted to the nested if as shown below.

#!/bin/bash
count=99
if [ $count -eq 100 ]
then
  echo "Count is 100"
else
  if [ $count -gt 100 ]
  then
    echo "Count is greater than 100"
  else
  echo "Count is less than 100"
  fi
fi

In our next article, we’ll discuss about how to use Bash conditional expressionswith practical examples.


ref : https://terms.naver.com/entry.nhn?docId=4125984&cid=59321&categoryId=59321

ref : https://www.thegeekstuff.com/2010/06/bash-if-statement-examples/

반응형
반응형

※ 요약

리눅스 명령어 rm은 파일이나 디렉토리를 삭제할 때 사용하는 명령어이며 -r 옵션을 붙이지 않으면 디렉토리는 삭제하지 못 한다.

참고로 리눅스처럼 유닉스형 운영체제는 삭제를 취소할 수 있는 명령어가 없다. 고로 rm 명령어로 삭제가 시작되면 되찾을 수 없다.


※ 경로

/bin/rm

※ 사용법

rm [옵션]... 파일명...

rm [옵션]... 디렉토리명...

※ 옵션

 옵션

 Long 옵션

 설명

 -f

 --force

 강제로 파일이나 디렉토리를 삭제하고, 삭제할 대상이 없을 경우 메시지를 출력하지 않음

 -i

 --interactive

 매번 삭제할 때마다 사용자에게 질문함

 -I

 

 셋 이상의 파일을 삭제하거나 하위의 파일이나 디렉토리가 있을 경우 질문함

 

 --interactive[=WHEN]

 상호대화형 모드로 값(WHEN)을 지정함

 WHEN 대신 once(-I 옵션과 같음)와 always(-i 옵션과 같으며 디폴트 값)가 올 수 있음

 

 --no-preserve-root

 '/'를 특별하게 취급하지 않음

 

 --preserve-root

 '/'를 삭제하지 않음(디폴트 값)

 -r, -R

 --recursive

 하위 디렉토리를 포함하여 모든 내용을 삭제

 -d

 --dir

 빈 디렉토리들만 제거

 -v

 --verbose

 지워지는 파일의 정보를 출력

 

 --help

 rm 명령어 사용법을 출력

 

 --version

 rm 명령어의 버전 정보를 출력

 

※ 사용예

rm  file1  file2

: 파일1과 파일2를 삭제한다.



rm directory

: rm 명령어는 -r 옵션을 주지 않을 경우 디렉토리는 삭제할 수 없다.



m -i file1 file2

: rm 명령어에 -i 옵션을 줘서 삭제하기 전 사용자에게 지울지 물어본다.


rm -fr di* fi*

: 옵션으로 f와 r을 줘서 디렉토리 및 그 하위 모든 내용을 강제로 삭제하는데, di로 시작하는 모든것과 fi로 시작하는 모든 것을 삭제한다. 다른 예로 rm *.txt라고 하면 확장자가 txt인것들을 삭제한다.



ref : http://shaeod.tistory.com/506

반응형
반응형


Linux – sudo와 su의 차이




su와 sudo 모두 root권한으로 명령을 내리는데 사용된다. root는 윈도우에서 Administrator와 같은 개념으로 시스템에 대한 모든 권한을 갖고 작업을 할 수 있다. 일반 사용자 계정의 경우 작업 내용과 보안 수준에 따라 필요한 권한만을 가지고 시스템에서 작업을 한다. 예로, 시스템에 새로운 프로그램을 설치하거나 특정 디렉토리에 접근이 안될 수 있다. 만약 이러한 작업을 수행해야한다면 su나 sudo로 권한을 획득할 수 있다.

su를 아무런 옵션 없이 실행하면 root계정으로 사용자를 전환(switch user)할 수 있다. 이때 root계정의 암호를 입력해야 한다. 물론 아시다시피 root계정뿐만 아니라 다른 사용자 계정으로 전환이 가능하다. 예로, su keepdelight를 입력하고 keepdelight계정의 암호를 입력하면 keepdelight계정으로 전환이 된다.
root계정으로 작업을 수행한 후에는 exit로 빠져나와 다시 원래 – 제한된 권한이 부여된 – 계정으로 돌아와야 한다.

이에비해 sudo는 root권한으로 한 번 명령어를 실행한다. 만약 sudo command(root권한으로 실행할 명령어)를 입력하면 명령어를 실행하기 전에 먼저 현재 사용자 계정의 비밀번호를 물어본다. 비밀번호 입력 후 실행되는 명령은 일반 사용자 권한이 아닌 root 권한으로 실행하게 된다.

이상이 su와 sudo의 주요 차이점이다. su는 사용자를 아예 root사용자로 전환시키는데 비해(root계정의 비밀번호 입력 필요) sudo는 사용자 전환 없이 단일 명령에 대해 root권한을 부여하게 된다.(root계정의 비밀번호를 입력하지 않는다.)

참고로 su를 sudo처럼, 그리고 sudo를 su처럼 사용할 수도 있다.

su -c 'command'

 
su에 c 옵션을 줘서 sudo처럼 입력한 command에 한해 root권한으로 실행할 수 있다. 다만, sudo와는 달리 이때에도 root계정의 비밀번호를 입력해야 한다.

sudo –i

 
sudo에 i옵션을 주면 root계정으로 전환된다. 이때도 역시 root계정의 암호 대신 현재 사용자의 암호를 입력하게 된다.

 

howtogeek 번역 및 정리 (원문보기)

ref : http://plaboratory.org/archives/4398

반응형
반응형

[CPU 점유율이 높은 프로세스 종료시키기]

 

리눅스에서는 기본적으로 프로세스의 CPU 점유율이 한 자릿수입니다.

그런데 만일 두 자릿수가 존재한다면, 이는 해킹을 시도하는 백도어 파일일 가능성이 높습니다.

오늘 실습에서는 두 자릿수 프로세스를 백그라운드로 실행하고, 프로세스를 찾아 없애는 작업을 해보겠습니다.

 

일단 CPU를 잡아먹는 프로세스를 백그라운드로 실행시킵니다.

yes > /dev/null &

& 기호는 백그라운드에서 실행시킨다는 뜻입니다.

 





이 루프 계속 실행되는 것을 종료 시킬때는 ctrl + c


jobs 명령으로 백그라운드에서 돌아가는 프로세스를 확인할 수 있습니다.

이제 CPU 상태를 살펴 보겠습니다.

>top


 


CPU의 전반적인 상황이 실시간으로 보여집니다. 5초 간격으로 새로고침이 되는 중입니다.

Shift + P 키를 누르면, CPU 점유율이 높은 순으로 목록이 떨어집니다.


 

맨 위에 yes라는 프로세스가 무려 CPU의 98.9%를 차지하고 있네요. 엄청난 수치입니다.


 

해당 프로세스의 PID를 기억해둡니다.

PID: Process ID

 

이 프로세스를 없애기 위해서는, KILL 시그널을 보내줘야 합니다. 다음과 같은 명령어를 실행합니다.

>kill -9 20519

20519가 yes의 PID 입니다. kill -9를 쓰면 특정 프로세스를 종료시킬 수 있습니다.

 

*PID가 아닌 프로세스명으로 명령을 내리기 위해서는?

>killall 프로세스명

예를 들어 여기에서는 killall yes를 눌러도 프로세스 종료가 됩니다. 하지만 우리는 kill -9를 적용해보겠습니다.


 

네, 매우 정직하게도 죽었다고 메시지가 나왔습니다.

제대로 죽었는지 CPU에서 확인해봅시다.

>top



 

yes가 없어진 것을 확인할 수 있습니다.

 

 

**Tip!

top 상태를 벗어나지 않고 KILL 시그널을 수행하려면?

k 키를 눌러 PID를 입력하고 해당 시그널 번호를 입력해주면 수행된다.

ex> top → Shift+P → PID 확인 후 k 키→ PID → 9 (프로세스 종료)




ref : https://blog.naver.com/7meaning/60203209840


반응형
반응형



1. vi 실행하기


명령어 

동작 

vi file 

file을 연다 

vi file1 file2

file1 과 file2 를 차례로 연다 

view file 

file을 읽기 모드로 연다 

vi -R file 

file을 읽기 모드로 연다 

vi + file

file을 열때 커서가 file 본문의 마지막 행에 위치한다. 

vi +n file 

file을 열어 n행에 위치한다. 

vi -r file

손상된 파일 회복


2. 입력모드 전환 명령어


명령어 

동작 

i 

커서 있는데서 입력모드 전환 

I

커서 왼쪽, 행의 처음에 몬자 삽입 

커서 있는 줄 끝에서 입력모드 전환 

A

커서 오른쪽, 행의 끝에 문자 삽입 

커서 있는 줄 아래에 빈 줄 삽입 

커서 있는 줄 위에 빈 줄을 삽입 

덮어쓰기 모드로 전환 


3. 커서의 이동


명령어 

동작 

^, 0 

줄의 처음으로 이동 

줄의 끝으로 이동 

H 

화면 맨 위로 이동 

M

화면의 중간으로 이동 

L 

화면 맨 아래로 이동 

다음 단어 끝으로 커서 이동 

e

다음 단어 앞으로 커서 이동

b  

이전 단어로 이동 

shift + ↑ 

한 페이지 앞으로 이동 

shift + ↓

한 페이지 뒤로 이동 

3l , 3G

현재 커서 위치한 행에서 3번째 행으로 이동 

Ctrl + i

한 화면 위로 이동 

Ctrl + b

한 화면 아래로 이동 

Ctrl + d

반 화면 위로 이동 

Ctrl + u

반 화면 아래로 이동 

Ctrl + e

한 줄씩 위로 이동 

Ctrl + y

한 줄씩 아래로 이동 


4. 삭제


명령어 

동작 

x 

한 문자 삭제 

5x

커서가 있는 위치부터 5개의 문자를 삭제 

d + ↑ 

커서있는 줄, 윗줄 2줄 삭제 

d + ↓ 

커서잇는 줄, 아래줄 2줄 삭제 

dw 

한 단어 삭제 

dd 

한 줄 삭제 

5dd

커서가 있는 라인부터 5개의 라인 삭제 

db

커서의 위치에서 거꾸로 한 단어 삭제 

한줄 내에서 커서있는 뒤 모두 삭제 

u 

바로 전에 수행한 명령을 취소 

:5,10ㅇ

5~10번째 행 삭제 


5. 복사와 붙여넣기


명령어

동작

yy

현재 줄을 버퍼로 복사 

p 

버퍼에 있는 내용을 커서 뒤에 삽입 

P

버퍼에 있는 내용을 커서 앞에 삽입 

3y 

현재 줄에서부터 아래로 3줄 복사 

:5, 10y

5~10줄을 버퍼로 복사 

:30pu

30행에 버퍼 내용을 삽입 

d 

현재 커서가 위치해 있는 단어 복사 

3yy

현재 행을 기준으로 3번째 행까지 n행 복사 


6. 문자열 찾기


명령어

동작

/name

name 문자열 찾기 

n

다음 name으로 이동

N

n과 같으며 역방향으로 이동 


7. 문자열 대체


명령어 

동작 

:s/str/rep

현재 행의 str을 rep로 대체

:l,.s/str/rep/ 

1부터 현재 행의 str을 rep로 대체 

:%s/str/rep/g 

파일 전체 str을 rep로 전부 대체 

:.$/aaa/bbb

커서의 위치로부터 파일의 끝까지 있는 모든 aaa를 bbb로 대체 


8. 파일 저장 및 불러오기


명령어 

동작 

:w 

지정된 파일에 저장 

:wq, :x, ZZ 

지정된 파일에 저장하고 vi를 종료 

:w php.ini 

php.ini 파일에 저장 

 :q

저장하지 않고 종료 

:q!

저장하지 않고 강제 종료 

:wq php.ini 

php.ini에 저장하고 vi를 종료 

:r php.ini 

php.ini의 내용을 현재 커서가 있는데로 불러온다. 

:e php.ini 

현재의 화면을 지우고 새로운 파일 php.ini를 불러온다. 

:5,10 w php.ini 

5~10 줄까지의 내용을 php.ini에 저장


9. 기타


명령어 

동작 

:set nu

행 번호 보여주기 

:set nonu 

행 번호 보여주기 취소 

 .

바로 전에 실행한 명령어 재 실행 

 Ctrl + l

불필요한 화면 정리후 다시 표시 



녹색으로 표시한 명령어는 많이 사용하는 명령어이다.





ref : http://hyeonstorage.tistory.com/274

반응형
반응형

WinSCP를 사용하여 Linux 인스턴스로 파일 전송

WinSCP는 SFTP, SCP, FTP 및 FTPS 프로토콜을 사용하여 원격 컴퓨터로 파일을 업로드하고 전송할 수 있는 Windows용 GUI 기반 파일 관리자입니다. WinSCP를 사용하면 Windows 시스템에서 Linux 인스턴스로 파일을 끌어 놓거나 두 시스템 간에 전체 디렉터리 구조를 동기화할 수 있습니다.

WinSCP를 사용하려면 PuTTYgen을 사용하여 프라이빗 키 변환에서 생성한 프라이빗 키가 필요합니다. 또한 Linux 인스턴스의 퍼블릭 DNS 주소도 필요합니다.

  1. http://winscp.net/eng/download.php에서 WinSCP를 다운로드하여 설치합니다. 대부분 사용자의 경우 기본 설치 옵션을 그대로 사용해도 좋습니다.

  2. WinSCP를 시작합니다.

  3. [WinSCP Login] 화면에서 [Host name]에 인스턴스의 퍼블릭 DNS 호스트 이름 또는 퍼블릭 IPv4 주소를 입력합니다.

    (IPv6 전용) 인스턴스의 IPv6 주소를 이용해 로그인하려면 인스턴스의 IPv6 주소를 입력합니다.

  4. 사용자 이름에는 AMI의 기본 사용자 이름을 입력합니다.

    • Amazon Linux AMI의 경우 사용자 이름은 ec2-user입니다.

    • Centos AMI의 경우 사용자 이름은 centos입니다.

    • Debian AMI의 경우 사용자 이름은 admin 또는 root입니다.

    • Fedora AMI의 경우 사용자 이름은 ec2-user 또는 fedora입니다.

    • RHEL AMI의 경우 사용자 이름은 ec2-user 또는 root입니다.

    • SUSE AMI의 경우 사용자 이름은 ec2-user 또는 root입니다.

    • Ubuntu AMI의 경우 사용자 이름은 ubuntu 또는 root입니다.

    • ec2-user 및 root를 사용할 수 없는 경우 AMI 공급자에게 문의하십시오.

  5. 인스턴스의 프라이빗 키를 지정합니다. [Private key]에서는 프라이빗 키의 경로를 입력하거나 ["..."] 버튼을 선택하여 파일을 찾아봅니다. 최신 WinSCP 버전의 경우 [Advanced]를 선택하여 고급 사이트 설정을 열고 [SSH]에서 [Authentication]을 선택하여 [Private key file] 설정을 찾습니다.

    다음은 WinSCP 버전 5.9.4의 스크린샷입니다.




    WinSCP에는 PuTTY 프라이빗 키 파일(.ppk)이 필요합니다. PuTTYgen을 사용하여 .pem 보안 키 파일을 .ppk 형식으로 변환할 수 있습니다. 자세한 내용은 PuTTYgen을 사용하여 프라이빗 키 변환 단원을 참조하십시오.

  6. (선택 사항) 왼쪽 패널에서 [Directories]를 선택하고 파일을 추가할 디렉터리의 경로를 [Remote directory]에 입력합니다. 최신 WinSCP 버전의 경우 [Advanced]를 선택하여 고급 사이트 설정을 연 다음 [Environment]에서 [Directories]를 선택하여 [Remote directory] 설정을 찾습니다.

  7. [Login]을 선택하여 연결하고 [Yes]를 선택하여 호스트 지문을 호스트 캐시에 추가합니다.

  8. 연결이 설정된 후 연결 창에서 Linux 인스턴스는 오른쪽에 있고 로컬 시스템은 왼쪽에 있습니다. 로컬 시스템에서 원격 파일 시스템으로 파일을 직접 끌어 놓을 수 있습니다. WinSCP에 대한 자세한 내용은 http://winscp.net/eng/docs/start의 프로젝트 설명서를 참조하십시오.

    "Cannot execute SCP to start transfer" 오류가 표시되는 경우 먼저 Linux 인스턴스에 scp를 설치해야 합니다. 일부 운영 체제의 경우, 이 명령어는 openssh-clients 패키지에 있습니다. Amazon ECS 최적화 AMI 같은 Amazon Linux 변형의 경우에는 다음 명령을 사용하여 scp를 설치하십시오.

    [ec2-user ~]$ sudo yum install -y openssh-clients



ref : https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/putty.html

반응형
반응형


리눅스/유닉스] 디렉토리 이동 명령, 변경 방법 - Linux, Unix Directory Command



Q: 리눅스/유닉스/Cygwin 프롬프트에서 경로 변경 방법은?


cd 명령으로 디렉토리를 이동할 수 있습니다.


하위 디렉토리로 이동


z 라는 이름의 하위 디렉토리로 가려면
cd z
이렇게 합니다.


상위 디렉토리로 이동


cd ..
이렇게 합니다. 마침표 2개입니다. 그러나 cd.. 이렇게 점2개를 붙이면 안 됩니다. (윈도우에서는 되지만)


루트 디렉토리로 이동


최상위 디렉토리로 이동하려면
cd /
이렇게 합니다. 슬래쉬 기호입니다.


특정 디렉토리로 이동


예를 들어, /usr/bin 디렉토리로 이동하려면
cd /usr/bin
이렇게 합니다.


직전 디렉토리로 이동


방금 전에 있던 디렉토리로 다시 되돌아가려면
cd -
이렇게 합니다. 마이너스 기호입니다.


자신의 홈(home) 디렉토리 이동


물결무늬(~)가, 자신의 ID 명의의 홈 디렉토리를 의미하므로
cd ~
이렇게 하면 됩니다.


현재 디렉토리 이름 확인


지금 위치한 디렉토리명을 알려면
pwd
이렇게 합니다.




ref : http://mwultong.blogspot.com/2006/09/linux-unix-directory-command.html


반응형

+ Recent posts