관리 메뉴

IT & Life

이 팁과 요령으로 Linux 커맨드 라인 마스터가 되십시오. 본문

프로그래밍/Linux

이 팁과 요령으로 Linux 커맨드 라인 마스터가 되십시오.

미운앙마 2017. 11. 15. 22:45

Linux 사용자의 경우, 명령 행은 본질적으로 매우 강력한 도구입니다. 사용자 친화적 인 Linux 운영 체제 (OS)는 터미널에 들어갈 필요없이 많은 기능을 제공하지만 OS의 필수 요소입니다. 대중적인 의견과는 달리 커맨드 라인은 특정 행동을 단순화 할 수 있습니다 .

For Linux users, the command line is an essentially, and ultra-powerful tool. While more user-friendly Linux operating systems (OS) offer loads of functionality without the need for entering the terminal, it’s a necessary element of the OS. Contrary to popular opinion, the command line can even simplify certain actions.

 

리눅스 배포판에 익숙하지 않거나 노련한 노련한 베테랑 인 지 여부에 관계없이 명령 줄은 다양한 용도를 제공합니다. 명령 행을 마스터하기위한 다음 팁을 시도하십시오.

Whether you’re brand new to Linux distros, or a seasoned Linux veteran, the command line offers a bevy of uses. Try these tips for mastering the command line.

 

 

 

파일 및 폴더

Files and Folders

 

 

 

 

그래픽 사용자 인터페이스 (GUI)를 사용하여 폴더를 손쉽게 만들고 이동하고 탐색 할 수 있지만 명령 줄은 파일과 폴더를 완벽하게 처리 할 수 ​​있습니다.

Although you can easily create, move, and navigate between folders with a graphical user interface (GUI), the command line is perfectly capable of handling files and folders.

 

 

 

디렉토리 변경

Change Directory

 

디렉토리를 변경하는 것은 매우 간단합니다. 터미널에서 다음을 입력하십시오.

Changing directories is pretty simple. In a terminal, enter:

 

cd


예를 들어 하드 드라이브 의 다운로드 폴더 와 같은 특정 폴더로 이동 하려면 원하는 디렉토리의 경로를 입력하기 만하면됩니다.

For instance, to navigate into a specific folder like the Downloads folder on your harddrive, merely enter the path to your desired directory:

 

cd /home/user/Downloads


디렉토리를 변경하면 커맨드 라인을 통해 소프트웨어를 설치할 때 매우 유용합니다. 터미널을 사용하여 설치 프로그램을 실행하려면 먼저 해당 설치 프로그램이있는 폴더로 변경해야합니다.

Changing directories is incredibly beneficial when installing software via the command line. To run an installer using the terminal, you’ll first need to change into the folder where that installer resides.

 

 

 

디렉토리 만들기

Make Directory

 

명령 줄을 사용하면 폴더를 전환 할 수있을뿐만 아니라 폴더를 만들 수 있습니다. 다음 명령을 실행하여 디렉토리를 만들 수 있습니다.

In addition to switching folders, the command line allows for folder creation. You can make a directory by running the command:

 

mkdir

따라서 Apps라는 폴더를 만들려면 다음을 입력하십시오.

Therefore, to make a folder called Apps, you would enter:

 

mkdir Apps

그러나 이것은 현재 디렉토리에 폴더를 만듭니다. 디렉토리가 생성되는 위치를 지정하려면 해당 디렉토리로 디렉토리를 변경하거나 전체 경로를 입력해야합니다.

But this makes a folder in the current directory. If you want to specify where a directory is created, you’ll either need to change directory into that folder, or enter the full path:

 

mkdir /home/user/Documents/Apps

전체 경로에 대한 폴더가 없으면이 명령을 실행하면 경로의 모든 폴더에 대한 디렉토리가 만들어집니다.

If there aren’t folders for the full path, running this command creates directories for all of the folders in the path.

 

 

 

복사

Copy

 

파일과 폴더를 처리 할 때 자주 사용되는 명령은 copy :

An oft-used command when handling files and folders is copy:

 

cp

파일을 다른 파일에 복사하려면 다음을 실행하십시오.

To copy a file into another file, run:

 

cp [NAME OF FILE 1] [NAME OF FILE 2]

또는 다음 명령을 사용하여 파일을 디렉토리에 복사 할 수 있습니다.

Alternately, you can copy files into directories using this command:

 

cp [NAME OF FILE] [NAME OF DIRECTORY]

 

 

이동

Move

 

파일 및 폴더를 복사하는 것처럼 터미널을 사용하여 항목을 이동할 수 있습니다. 그 명령은 :

Like copying files and folders, you can move items with the terminal. That command is:

 

mv

한 파일의 내용을 다른 파일로 이동할 때 다음을 실행하십시오.

When moving the content of one file to another, run:

 

mv [NAME OF FILE 1] [NAME OF FILE 2]

그러나 두 번째 파일이 없으면 첫 번째 파일의 이름이 두 번째 파일로 바뀝니다. 그러나 두 번째 파일이 존재하면 첫 번째 파일의 내용으로 대체됩니다. 또한 move 명령을 디렉토리와 함께 사용할 수도 있습니다.

However, if the second file doesn’t exist, the first file is renamed as the second file. But if the second file does exist, then its contents are replaced with those of the first file.You can also use the move command with directories:

 

mv [NAME OF DIRECTORY 1] [NAME OF DIRECTORY 2]

move 명령이 파일을 처리하는 방법과 유사하게 두 번째 디렉토리가 존재하지 않으면 첫 번째 디렉토리의 이름이 변경됩니다. 그러나 두 번째 디렉토리가 존재하면 첫 번째 디렉토리의 내용이 두 번째 디렉토리로 이동됩니다.

Similar to how the move command handles files, if the second directory does not exist then the first directory is simply renamed. Yet if the second directory does exist, the contents of the first directory are moved into the second directory.

 

 

 

제거

Remove

 

파일이나 폴더를 제거하고 싶습니까? 그냥 실행 :

Want to remove files or folders? Just run:

 

rm

파일을 삭제할 때 다음과 같이 표시됩니다.

When you’re deleting a file, that would look like:

 

rm [NAME OF FILE]

또는 디렉토리를 삭제하는 경우 :

Or if you’re deleting a directory:

 

rm [NAME OF DIRECTORY]

또한 여러 파일과 폴더를 동시에 제거 할 수 있습니다.

Plus, you can remove multiple files and folders simultaneously:

 

rm [NAME OF FILE 1] [NAME OF FILE 2]

 

 

특수 문자

Special Characters

 

특수 문자 또는 공백이있는 파일 및 폴더에 문제가있는 경우가 있습니다. 이 경우 따옴표를 사용하십시오. 예 :

Occasionally, files and folders with special characters or spaces present a problem. In these instances, use quotes. For example:

 

cd /path/to/folder/"My Documents"

따옴표없이 이것을 실행하면 해당 디렉토리로 이동하지 못합니다.

Running this without the quotes will fail to navigate into that directory.

 

 

 

역사

History

 

 

 


Linux를 사용하려면 명령 행이 필요합니다. 때로는 터미널에서 실행되는 명령의 내역을 알아야합니다. 최근에 실행 한 명령을 보는 것은 입력하는 것만 큼 쉽습니다.

Using Linux requires the command line. Sometimes, you’ll need to know the history of commands run in the terminal. Viewing recently run commands is as easy as entering:

 

history

명령 번호와 해당 bash 명령을 보여주는 목록이 생성됩니다. 때로는 충분하지 않으며 시간 기록이 필요합니다. 이 경우 다음을 실행하십시오.

This yields a list that shows the command number and it corresponding bash command. Occasionally, this won’t be sufficient and you’ll need a timestamped history. In this case, run:

 

histtimeformat


그런 다음 날짜와 시간이 포함 된 명령 내역 목록이 표시됩니다. 때로는 명령을 검색하려고 할 수 있습니다. 그것은 커맨드 라인에서 완전히 가능합니다. 그냥 bash 프롬프트에서 CTRL + R을 사용하십시오. 그러면 다음 메시지가 표시됩니다.

Then, you’ll see a list of the command history with dates and times. Sometimes you may wish to search for a command. That’s totally feasible with the command line. Just use CTRL + R at the bash prompt. Then, you’ll see a message which reads:

 

reverse-i-search

여기에서 명령 검색을 시작할 수 있습니다.

From here, you may begin to search for commands.

 

 

 

문자열 명령

String Commands

 

 

 


별도의 줄에 명령을 입력 할 수 있지만 명령을 함께 실행할 수도 있습니다. 이는 특히 소프트웨어를 설치하거나 업데이트 할 때 유용합니다. 이렇게하면 두 작업을 동시에 수행 할 수 있습니다.

While you can enter commands on separate lines, you can also run commands together. This is particularly useful when installing or updating software. That way, you can perform both actions simultaneously:

 

sudo apt-get update && sudo apt-get upgrade

이중 앰퍼샌드 대신 세미콜론을 사용하여 Linux 명령 줄에 명령을 함께 입력 할 수도 있습니다.

Rather than the double ampersands, you can also string commands together in the Linux command line with a semicolon:

 

sudo apt-get update ; sudo apt-get upgrade

동일한 작업을 수행합니다.

This performs the same action.

 

 


PPA 추가

Add PPA

 

 

 


PPA는 개인 패키지 아카이브입니다 , 또는 소프트웨어 저장소는 리눅스 OS 시스템이 기본 설치에 포함되지 않습니다. 일부 소프트웨어를로드하려면 먼저 PPA를 추가해야합니다. 많은 리눅스 동작처럼, 이것은 일반적으로 명령 행으로 수행됩니다.

A PPA is a personal package archive, or software repository not included in the default Linux OS system install. In order to load some software, you’ll first need to add a PPA. Like many Linux actions, this is usually performed with the command line.


sudo add-apt-repository [NAME OF REPOSITORY]

제가 좋아하는 리눅스 소프트웨어 옵션 중 하나는 게임 스트리밍에 사용되는 Open Broadcaster Software 입니다. OBS는 완전히 설치되기 전에 PPA 추가가 필요합니다.

One of my favorite Linux software options is Open Broadcaster Software, used for game streaming. OBS requires a PPA addition before it’s fully installed:

 

sudo add-apt-repository ppa:obsproject/obs-studio

 

 

명령 재실행

Re-Run Command

 

명령 줄을 마스터하는 데 도움이되는 가장 유용한 명령 중 하나는 명령을 반복하는 기능입니다. 일반적인 방법은 다음을 입력하는 것입니다.

One of the most helpful commands to truly help you master the command line is the ability to repeat commands. A common method is by typing:

 

!!


더욱이, 이것을 사용하여 놓친 명령을 던질 수 있습니다. 예를 들어 수퍼 유저 권한으로 명령을 실행하는 것을 잊어 버린 경우

Moreover, you can use this and throw on a piece of the command you missed. For example, if you forget to run a command with super user permissions, entering

 

sudo!!


명령을 한 번 더 실행합니다. 이번에는 두 번째로 수퍼 유저 권한을 추가합니다. 그것은 모든 것을 다시 입력하지 않아도됩니다. 그러나 이것이 명령을 반복하는 유일한 방법은 아닙니다. 위쪽 화살표를 사용하여 이전에 입력 한 명령을 볼 수 있으며 Enter 키를 눌러 다시 실행할 수 있습니다.

runs the command once more, this time adding super user permissions the second time. It saves you from having to type everything out again. But that’s not the only method to repeat commands. You can also use the up arrow to see previously entered commands, and hit enter to execute them again.

 

마찬가지로 다음을 입력 할 수 있습니다.

Similarly, you can enter:

 

!-1

또는 Ctrl + P를 누르면 이전에 실행 한 명령이 표시됩니다. 그런 다음 Enter 키를 눌러 실행하십시오.

Alternatively, pressing Ctrl + P shows the previously run command. Then, hit enter to execute it.

 

 

 

리스트

List

 

 

 


ls

믿을 수 없지만 기본적으로 사용되는 명령은 목록 기능입니다. 이것은 특정 파일 시스템 아래의 주요 디렉토리를 보여주는 목록을 터미널에 제공합니다.

예를 들면 :

A basic but incredibly useful command is the list function. This presents a list in the terminal which shows the major directories under a specific file system. For instance:

 

ls /apps

그러면 / apps 디렉토리 아래의 모든 폴더 목록이 생성 됩니다.

This yields a list of all the folders under the /apps directory.

 

 

 

어떻게 리눅스 커맨드 라인 마스터 : 최종 생각

How to Master the Linux Command Line: Final Thoughts

 

처음에는 리눅스 커맨드 라인이 힘들어 보일 수 있습니다. 그러나 나타날 수있는만큼 복잡하지는 않습니다. 파일 및 폴더 관리, 명령 내역보기 및 명령 문자열화는 터미널의 가장 일반적인 용도 중 하나입니다.

The Linux command line can seem daunting at first. But it’s not as complicated as it may appear. Managing files and folders, viewing the history of commands, and stringing commands together rank among the most common uses of the terminal.

 

리눅스 커맨드 라인을 배우기위한 초보자 팁 이 많이 있습니다 . 이 다용도 도구는 Facebook에 액세스하는 데 적합합니다 . Android에서 명령 줄을 실행하고 싶습니까? Termux를 사용하여 Android 운영 체제 에서 Linux 터미널 의 모든 기능을 사용해보십시오.

There are loads of beginner tips for learning the Linux command line. This multipurpose tool is even suitable for accessing Facebook. Want to run the command line on Android? Try Termux for the full functionality of the Linux terminal on Android operating systems.

 

 

 

해외 원문 : http://www.makeuseof.com/tag/become-linux-command-line-master-tips-tricks/

Comments